ABAP Frequently
Asked Question
Q: When we create a customer the information is updated in structure RF02D and the some tables like KNA1 are updated. How can we find the tables for master data transactions?
A: Go to ABAP Workbench -> Overview -> application hierarchy - SAP -> follow the customizing based tree for your application. Double click on a lowest hierarchy level to get for the correct marked development class. Here you can find all the tables, views, logical databases etc. used for a system operation.
R F C
Importing parameters are
DBNAME
DEST
FLG_APPEND
FLG_POPUP
LANGU
The table has three columns:
TABNAM
MANDT
SDATA
We have no Exporting parameters.
How shall we set the parameters?
A: Install the PS utilities, which are part of SAPGUI install CD. You may run report RIACCESS from SE38. Go to SALE -> Communication -> Define RFC Destination. Setup two RFC destinations PS_ACCESS_1 and PS_ACCESS_2 and will have to get them to point to wdpsastr.exe and wdpsatab.exe respectively. Then execute RIACCESS and choose PS_ACCESS_1 to generate access tables. Please note that Access only supports tables with up 255 fields.
Q: We want an RFC do the following transactions - MB1A, MB1C, >MB01 (Goods receipt/issue).
A: Call the RFC INBOUND_IDOC_PROCESS with IDOC_CONTROL and IDOC_DATA. The structure in the field sdata in the IDOC_DATA is e1mbxyh and e1mbxyi.
Q: In a Dev instance, we want to transport a modification to a layout set from one client to another. What is the best way?
A: use transaction SE71. Choose Utilities->Copy from Client. Layout sets need not be transported between clients, via transport requests DEVKxxxxxx.
Q: We need to keep track of the transports that need to flow through to other systems (i.e., DEV, TST, TRN, PRD etc). Is there a way do this?
A: SAPCRAFT enables you to control the CTS from DEV system. This keeps track of all transports at all stages and enables you to allocate Import, export and Authorization functions to specific user.
Q: 1 we created an EDI Vendor and created all required output conditions. However no IDOC is generated when PO is printed. Why?
A: Go to Header->output for the PO. The output type shall be '6'. The status shall be '1'. If the status is '0' check the timing. If the status is '2' , go to 'GOTO->Processing Log' and the explanation for non-generation of IDOC can be seen.
Q: How can we create / upload IDOC's from legacy system to SAP?
A: Third party tool Mercator may be used to convert Legacy files to Idoc format. Mercator provides an IDOC tree import facility, SAP provides the export facility. You can transfer the Idoc layouts from SAP to Mercator automatically and then map.
Q: We want to receive an outbound EDI 855 IDOC only if E2EDP20 -scheduling confirmation segment is present. Else get an "error" status preventing triggering the EDI subsystem.
A: User exit logic has to be added in function IDOC_INPUT_ORDRSP.
# Set up a test flag and set it off when the IDOC header is read.
# Turn the flag ON when the EDP20 segment is read.
# Interrogate this flag when the next segment after EDP20 in the same IDOC comes in. If it is on, you have an EDP20 coming in.
# Issue an error status 51 with suitable message for whichever condition you don't want the IDOC to be processed, This will stop the IDOC from posting.
Q: Wherever PO is sent to the vendor via EDI, we want an acknowledgement of the PO by vendor. Which fields are updated and what should be my procedure?
A: Execute Program: IDOC_INPUT_ORDRSP
Process code: ORDR
Message type: ORDRSP
IDOC: ORDERS01
The confirmation process allows the supplier to return an acknowledgment. Only Dates and quantities can be changed the information is stored in the PO and can be viewed via Item->Confirmation->Overview. The PO can be flagged as 'confirmation required' so that Pos without acknowledgement receipt can be monitored. Control keys and tolerances (days and quantities) have to be customized.
Q: Our IDOC remains in status 51 (not posted) while testing ALE setup by passing DEBMAS02 Idocs. The message 'Field KNA1-BRSCH is not an input field'. This is the Industry key. What are we missing?
A: Go to IMG - menu path IMG->Logistics General-> Logistics Basic Data: Business partners->Customers-> Control->Define Account groups and field selection for customer.
Select sold-to or ship-to. Select General Data. Select control and double click. Industry key is found here. Change the option to 'Optional Entry'.
Check OSS 5599. You may have to update view V_T078D also.
Q: We are calling transaction VL01 in batch input to create deliveries using a program for delivery due list. How ever we are unable to create deliveries for transport stock orders. Why?
a: Batch-inputs can not be used to fill the "delivery due list" screen because it is not a dynpro. This is a standard SAP report. A SAP report (check with "System -> Status") may be called using SUBMIT sentence with the appropriate options . It is preferred to call a report than create a Batch-input program.
Q: What are some sample Direct input data transfer programs?
A: In MM for Material Master data - RMDATIND
FI - for Accounting Documents - RFBIBL00
PP - for Independent requirements - RM06IN00
CA - for Classification data - RCCLBI03
Q: We specify the logical database. And we want a field that is not present in any of the tables defaulted in logical database. How can we want to add this additional field from a different table?
A: . Presume you have a
Logical database
Table 1
Table 2
Table 3
Define the required field as additional field say fld of table 1, table 2 or table 3
And then in the code section define.
Perform get_f1d (zxxxxxxx) using f1d.
Form zxxxxxxx could be like;
Form get_f1d-using f.
Select * from where 'conditions'
f =
table4 - f1d.
Q: We need to download an internal table
to the Presentation Server (local workstation). Whenever we run the program,
the same file has to be saved as a separate file in
sequential order. Ex: 0001.txt, 0002.txt etc. Where can we store the
last file number? A: SAP has a table TVARV for storing the variants.
A record may be created in TVARV for all the programs that require this kind of incremental records.
For Ex: the record could be 100Zmm10001 MM sequence rec where first part consists of client code and the program being run. Client code is required because TVARV does not have a field for client code. The second part is the description indicating the purpose what the record is created. This entire string may be posted in the Name field (char - 30).
The Type field (char- 1) may be populated with P or S (Parameter or Selection)
Low field (char- 45) may be populated with '0001' when run first time and increment it by one in your program for downloading of the internal table.
Q: How can we use CAD with SAP?
A: Third party tools from Eigner + Partner provide interfaces to SAP. Another third party software - Fast look Plus from Kamel Software enables you to view all of the Autocad formats.
Q: How can I access SAP through Internet?
A: SAP has its own Internet transaction Server (ITS). Other products include Haht, Web Objects, Net Dynamics etc. Each product has its' own architecture.
However to access the database, access paths SAP GUI or RFC Channel have to be used.
Q: How can we transport the standard text?
A: Refer note 3355 in OSS for a complete explanation. The SAP script objects that should be transported must be written in a transport request.
The entries are as follows:
R3TR FORM NAME (NAME = Name of the layout set)
R3TR STYL NAME (NAME = Name of the style)
R3TR TEXT OBJECT,NAME,ID,L
(OBJECT = Text object, NAME = Text name, ID = Text ID, L = Text language)
If you want to transport a number of texts, you can use report RSTXTRAN to insert the individual text keys into a correction. The transport request must be entered and released via the transport system.
Q: How to find what transactions a particular user was running for a given period in the past (Eg: from 1st of a month)
A: You may use the transaction - STAT.
Q: We want protect/lock a field so that only selected people can change the value while others can only read. How to set the authorizations?
A: Create an authorization object for change mode. Loop at screen in the user exit and set input to 0. Check the user based on sy-uname and the authorization. Decide whether input should be 0 or 1.
Q: How to lock a user-defined transaction for some time during which no user can access the same?
A: Use transaction SM01. Scroll through the transactions and check against the transaction to be locked. And after the maintenance is over, go back to SM01 and uncheck the same to unlock.
ABAP Tips
and Tricks
Find out in what all Tables a specified field is available. You can find out through transaction code SE15.
1) Give SE15 on command prompt.
2) Select ABAP Dictionary
3) Select "fields" folder
4) Click on table fields
5) Then you can enter the desired field name (In your case EKGRP)
6) Run OR press F8.
The system will list out all the tables, which contain your desired field name.
Or
1) Using transaction Code SE11 (ABAP Dictionary)
2) enter the Data table name where in the respective field (EKGRP) is used eg; EKKO
3) Click the where -used list button
4) Check out the box (DB tables) only.
There you can see entire list of tables containing the desired field.
Here the difficulty is that one should know at least the name of the one of the data tables, which contains the desired field.
With Compliment by: Manohar TS & Kotha
**********
Find the Table Name For a Field.
I know couple of ways to find the table name for a field.
Like.
1. Part the cursor at the field and press F1 & F9.
2. Se84 or se15
3. St05 (sql trace).
4. Setting Break point in ABAP.
If you will tell other methods it will be appreciate.
**********
*
* How to print Apostrophe using the write statement
* for e.g. you'll be there.
*
Report zapostrophe message-id z1.
DATA: LINE (20).
CONCATENATE 'You''' 'll be there.' INTO LINE.
WRITE:/ LINE.
**********
**********
Given a transaction code, how can I find the menu path?
In 4.6c, you can used tcode search_sap_menu to find the SAP MENU tcode.
Please note that there are no tcode available to find the path of the IMG transaction.
**********
How to un-encrypt SAP user password?
It is not possible to un-encrypt the SAP password, because a one-way encoding (with strong 1024 bit key) is used for this. The result is stored and each time one has entered the password the encoding result is checked.
**********
When you delete an entry from an internal table in ABAP, the system has to re-generate the index for all entries after your delete, slowing the report if you have many records to eliminate.
It is much quicker to do an insert of the correct records into a second table than to delete entries from the first. The reason for this is because the index is only generated for the newest element.
**********
If you want to protect a program against debugging, you just have to set the STATUS = S in the attributes view of the main program.
**********
BDC.
When you use a call transaction, and populate the BDCDATA table.
Make sure you pass the "DATE FIELDS" of any transaction by formatting it as "XX/XX/YYYY" cos if you pick this data from database it will be of the format 20030505 or something like that. Make sure you pass this value as character field.
Same is true for the "Rate Fields". Make sure you pass them as "Character Fields" by formatting them.
**********
If you need to find out the Okcodes for BDC sessions, look for program RSBDCCUA and run it for any platform say 'WN' for windows or MC for Mac and it will generate list of function codes
**********
To save the contents of an internal table as a Microsoft Excel Worksheet when debugging code in SAP R/3 Enterprise:
1. Click on the "Table" button
2. Type in the name of your internal table in the "Internal table" field and hit Enter.
3. Hit CTRL + F11 or click on the "Save as Excel Worksheet" button.
4. Type in the record numbers that you want to save. (Ex. From Line: 1 To Line: 10) Hit Enter.
5. Save your file.
**********
Starts with a Z are homegrown program.
You cannot be sure that anything, which starts with a Z, is a homegrown program.
SAP provides a number of correction programs, especially within the archiving area, which start with a Z.
for e.g. ZZSTOCKL from note 202345.
**********
Can line-size of abap report large than 255?
You can have line-size up to 1023.
Along with Report statement pass the line-size as 1023. Ex. Report xyz line-size 1023.
**********
How to find out the number of days between a given date, excluding Saturdays and Sundays and public holidays?
Try functions,
=> DATE_CONVERT_TO_FACTORYDATE
=> HR_HK_DIFF_BT_2_DATES
Testing and
Debugging ABAP Codes, Functions
Could some one help me? I am looking out answers for the following
questions: Explain what sort of testing you would do on your own code?
What steps would you take to debug a function or report in SAP?
Tips by: Kiran
First test your code with '/h' type in command window which shall take you to debug or by putting break points with F8. You test your program from code and then go to se30 performance analysis transaction and there you can know what are the drawbacks. Then go to SLIN transaction and do extended syntax check or from code in menu options where you have debugging -> extended check and the program id ready without error.
Tips by: Harichand Chandunair
Testing your code.
As mentioned above after doing syntax check and extended syntax check you have to create a TEST PLAN. You have to test all possible Positive & Negative test cases.
Test for division by zero if it involves calculation or code accordingly.
Try to test for field overflows. If it involves sap script or smart forms try to print outputs, which have single, page and also multiple pages and which does not have any output at all.
Test by leaving all parameters in selection screen blank.
Test by entering wrong values in selection screen and display a pop-up if the user enters wrong selection screen values.
You can also do ABAP trace and SQL trace to make sure that your program is efficient.
Debugging code/program.
As mentioned above type /h in command line and try to execute the program. Another way is to set break point at the function module or the required line and do single step execute or execute. Once you finished debugging, you can select Delete to clear all the break points.

Third option in certain cases is to check for sy-subrc <> 0 and proceed from there by making it 0 by updating the sy-subrc in the debug editor and see how the program behaves if the value is what you enterd in the debug screen. For certain case try to use WATCH POINT feature in debug editor.
Internal
table in ABAP
*An internal table is a run time instance.
It gets created when program starts execution. *It gets destroyed when program terminates. it has two different parts. Header Line (optional) & Body (Compulsory).
*Any value that comes to or goes from internals table, that travels through header line \
*A related program is.
*Declaration.
Data: begin of inernaltable occurs 0,
x type c,
y type I,
end of itab.
*Initializing header line
internal table-x = 'd'.
Internal table-y = 34.
*Storing value into internal table
Append internal table.
Append internal table.
Append internal table.
*Reading internal table
loop at itab.
Write: / internal table-x, internal table-y. "Writes to output list
end loop.
ABAP Tips by: Abdul Sayeed
Email: sayeed_mail2005@yahoo.com
Fields of Internal Tables
SY-TABIX
Current line of an internal table. The statements below, but only for index tables set SY-TABIX. The field is either not set or is set to 0 for hashed tables.
APPEND sets SY-TABIX to the index of the last line of the table, that is, it contains the overall number of entries in the table.
COLLECT sets SY-TABIX to the index of the existing or inserted line in the table. If the table has the type HASHED TABLE, SY-TABIX is set to 0.
LOOP AT sets SY-TABIX to the index of the current line at the beginning of each loop lass. At the end of the loop, SY-TABIX is reset to the value that it had before entering the loop. It is set to 0 if the table has the type HASHED TABLE.
READ TABLE sets SY-TABIX to the index of the table line read. If you use a binary search, and the system does not find a line, SY-TABIX contains the total number of lines, or one more than the total number of lines. SY-INDEX is undefined if a linear search fails to return an entry.
SEARCH <itab> FOR sets SY-TABIX to the index of the table line in which the search string are found.
SY-TFILL
After the statements DESCRIBE TABLE, LOOP AT, and READ TABLE, SY-TFILL contains the number of lines in the relevant internal table.
SY-TLENG
After the statements DESCRIBE TABLE, LOOP AT, and READ TABLE, SY-TLENG contains the length of the lines in the relevant internal table.
SY-TOCCU
After the statements DESCRIBE TABLE, LOOP AT, and READ TABLE, SY-TLENG contains the initial amount of memory allocated to the relevant internal table.
List Box in
ABAP Report
* List Box in ABAP Report
* Written by: SAP Basis, ABAP Programming and Other IMG Stuff
* http://www.sap-img.com
REPORT ZLIST.
TYPE-POOLS: VRM.
DATA: NAME TYPE VRM_ID,
LIST TYPE VRM_VALUES,
VALUE LIKE LINE OF LIST.
PARAMETERS: PS_PARM (10) AS LISTBOX VISIBLE LENGTH 10.
AT SELECTION-SCREEN OUTPUT.
NAME = 'PS_PARM'.
VALUE-KEY = '1'.
VALUE-TEXT = 'LINE 1'.
APPEND VALUE TO LIST. VALUE-KEY = '2'.
VALUE-TEXT = 'LINE 2'.
APPEND VALUE TO LIST.
CALL FUNCTION 'VRM_SET_VALUES' EXPORTING ID = NAME VALUES = LIST.
START-OF-SELECTION.
WRITE: / ‘PARAMETER:’ PS_PARM.
Example Code
For Drill Down Report
REPORT zmm_rept_purchorderkkb01 LINE-SIZE 80
LINE-COUNT 65(3)
MESSAGE-ID z_msg_class
NO STANDARD PAGE HEADING.
*------------------DECLARING THE STANDARD TABLES---------------------*
TABLES: ekko, "PURCHASE ORDER: HEADER
ekpo. "PURCHASE ORDER: ITEM
*------------------DECLARING THE INTERNAL TABLE----------------------*
DATA: BEGIN OF it_ekko OCCURS 2,
ebeln LIKE ekko-ebeln, "PURCHASE ORDER NUMBER
Bukrs LIKE ekko-bukrs, "COMPANY CODE
Bsart LIKE ekko-bsart, "PURCHASING DOCUMENT TYPE
Lifnr LIKE ekko-lifnr, "VENDOR
Spras LIKE ekko-spras, "LANGUAGE KEY
Zterm LIKE ekko-zterm, "PAYMENT TERMS KEY
End of it_ekko.
DATA: BEGIN OF it_ekpo OCCURS 2,
Ebeln LIKE ekpo-ebeln, "PURCHASE ORDER NUMBER
Ebelp LIKE ekpo-ebelp, "PURCHASE ORDER NUMBER
Werks LIKE ekpo-werks, "PLANT
Matnr LIKE ekpo-matnr, "MATERIAL NUMBER
Matkl LIKE ekpo-matkl, "MATERIAL GROUP
END OF it_ekpo.
DATA: it_ebeln LIKE ekko-ebeln OCCURS 0 WITH HEADER LINE.
*DATA: it_ebeln_high LIKE ekko-ebeln OCCURS 0 WITH HEADER LINE.
DATA: p_ebeln TYPE i.
*------------------Declaring the selection screen--------------------*
SELECTION-SCREEN BEGIN OF BLOCK blk1 WITH FRAME TITLE text-001.
SELECT-OPTIONS: s_ebeln FOR ekko-ebeln.
PARAMETER: p_limit TYPE i.
SELECTION-SCREEN END OF BLOCK blk1.
*INCLUDE z_incl_purorderkkb01_sub_f01.
*--------------------------------------------------------------------*
* Validation for number of records to be printed *
*--------------------------------------------------------------------*
*AT SELECTION-SCREEN ON p_limit.
* IF p_limit IS INITIAL.
* MESSAGE e011.
* ENDIF.
* IF p_limit GT sy-linct.
* MESSAGE e010.
* ENDIF.
*----------------------------------------------------------------------*
* Search help for purchase document number (s_ebeln-low) *
*----------------------------------------------------------------------*
AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_ebeln-low.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
Input = s_ebeln-low
IMPORTING
Output = s_ebeln-low.
Perform form_search_help.
IF sy-subrc <> 0.
CASE sy-subrc.
WHEN 2.
LEAVE TO SCREEN 1000.
ENDCASE.
ELSE.
LOOP AT it_ebeln.
IF sy-tabix = p_ebeln.
S_ebeln-low = it_ebeln.
EXIT.
ENDIF.
ENDLOOP.
ENDIF.
*----------------------------------------------------------------------*
* Search help for purchase document number (s_ebeln-high) *
*----------------------------------------------------------------------*
AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_ebeln-high.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
Input = s_ebeln-high
IMPORTING
Output = s_ebeln-high.
Perform form_search_help.
IF sy-subrc <> 0.
CASE sy-subrc.
WHEN 2.
LEAVE TO SCREEN 1000.
ENDCASE.
ELSE.
LOOP AT it_ebeln.
IF sy-tabix = p_ebeln.
S_ebeln-high = it_ebeln.
EXIT.
ENDIF.
ENDLOOP.
ENDIF.
*----------------------------------------------------------------------
* Start-of-selection event
*----------------------------------------------------------------------
START-OF-SELECTION.
*----------------------To attach a user interface----------------------
SET PF-STATUS '0010'.
*---------To fetch the data for the basic list-------------------------
SELECT ebeln "PURCHASE ORDER NUMBER
Bukrs "COMPANY CODE
Bsart "PURCHASING DOCUMENT TYPE
Lifnr "VENDOR
Spras "LANGUAGE KEY
Zterm "PAYMENT TERMS KEY
Up to p_limit rows
Into table it_ekko from ekko
Where ebeln in s_ebeln.
REFRESH it_ekpo.
*---------To fetch the data for the secondary list---------------------
If it_ekpo is initial.
SELECT ebeln "PURCHASE ORDER NUMBER
Ebelp "PURCHASING DOCUMENT TYPE
Werks "PLANT
Matnr "MATERIAL NUMBER
Matkl "MATERIAL GROUP
FROM ekpo INTO TABLE it_ekpo for all entries in it_ekko
WHERE ebeln EQ it_ekko-ebeln.
Endif.
*----------------------------------------------------------------------
* End-of-selection event
*----------------------------------------------------------------------
END-OF-SELECTION.
*---------To display the data for the basic list-----------------------
Format color 4 intensified off.
LOOP AT it_ekko.
WRITE :/ sy-vline, it_ekko-ebeln UNDER text-002, 18 sy-vline,
"PURCHASE ORDER NUMBER
It_ekko-bukrs UNDER text-003, 27 sy-vline,
"COMPANY CODE
It_ekko-bsart UNDER text-004, 38 sy-vline,
"PURCHASING DOCUMENT TYPE
It_ekko-lifnr UNDER text-005, 50 sy-vline,
"VENDOR
It_ekko-spras UNDER text-006, 62 sy-vline,
"LANGUAGE KEY
It_ekko-zterm UNDER text-007, 80 sy-vline.
"PAYMENT TERMS KEY
Hide: it_ekko-ebeln.
ENDLOOP.
WRITE :/ sy-uline (80).
*----------------------------------------------------------------------
* To generate the detailed lists
*----------------------------------------------------------------------
AT LINE-SELECTION.
CASE sy-lsind.
WHEN 1.
SET PF-STATUS '0011'.
*---------To display the data for the secondary list-----------------------*
WINDOW STARTING AT 10 10
ENDING AT 90 30.
Format color 5 intensified off.
LOOP AT it_ekpo where ebeln = it_ekko-ebeln.
WRITE :/ sy-vline, it_ekpo-ebeln UNDER text-002, 15 sy-vline,
"PURCHASE ORDER NUMBER
It_ekpo-ebelp UNDER text-008, 30 sy-vline,
"PO ITEM NUMBER
It_ekpo-werks UNDER text-009, 45 sy-vline,
"PLANT
It_ekpo-matnr UNDER text-010, 60 sy-vline,
"MATERIAL NUMBER
It_ekpo-matkl UNDER text-011, 80 sy-vline.
"MATERIAL GROUP
ENDLOOP.
WRITE :/ sy-uline (80).
ENDCASE.
CASE sy-ucomm.
WHEN 'EXIT' OR 'CANC' OR 'BACK'.
LEAVE TO SCREEN 0.
ENDCASE.
*----------------------------------------------------------------------
* At user-command event
*----------------------------------------------------------------------
AT USER-COMMAND.
CASE sy-ucomm.
WHEN 'SELE' OR 'LIST1'.
IF sy-lsind = 1.
SET PF-STATUS '0011'.
*---------To display the data for the secondary list-----------------------*
WINDOW STARTING AT 10 10
ENDING AT 90 30.
Format color 5 intensified off.
LOOP AT it_ekpo where ebeln = it_ekko-ebeln .
WRITE :/ sy-vline, it_ekpo-ebeln UNDER text-002, 15 sy-vline, "PURCHASE ORDER NUMBER
It_ekpo-ebelp UNDER text-008, 30 sy-vline, "PO ITEM NUMBER
It_ekpo-werks UNDER text-009, 45 sy-vline, "PLANT
It_ekpo-matnr UNDER text-010, 60 sy-vline, "MATERIAL NUMBER
It_ekpo-matkl UNDER text-011, 80 sy-vline. "MATERIAL GROUP
ENDLOOP.
WRITE :/ sy-uline (80).
Endif.
ENDCASE.
CASE sy-ucomm.
WHEN 'EXIT' OR 'CANC' OR 'BACK'.
LEAVE TO SCREEN 0.
ENDCASE.
*----------------------------------------------------------------------*
* Top-of-page for basic list *
*----------------------------------------------------------------------*
TOP-OF-PAGE.
Format color 3 intensified off.
WRITE :/ sy-uline (80).
WRITE :/ sy-vline,
03 sy-repid,
60 text-015,
Sy-uname,
80 sy-vline.
WRITE :/ sy-vline, 03 sy-datum,
35 text-012,
60 text-014,
Sy-pagno,
80 sy-vline.
WRITE :/ sy-uline (80).
WRITE :/ sy-vline, text-002, 18 sy-vline, "PURCHASE ORDER NUMBER
Text-003, 27 sy-vline, "COMPANY CODE
Text-004, 38 sy-vline, "PURCHASING DOCUMENT TYPE
Text-005, 50 sy-vline, "VENDOR
Text-006, 62 sy-vline, "LANGUAGE KEY
Text-007, 80 sy-vline. "PAYMENT TERMS KEY
WRITE :/ sy-uline (80).
*----------------------------------------------------------------------
* Top-of-page for secondary list
*----------------------------------------------------------------------
TOP-OF-PAGE DURING LINE-SELECTION.
Format color 2 intensified off.
WINDOW STARTING AT 10 10
ENDING AT 90 30.
WRITE :/ sy-uline (80).
WRITE :/ sy-vline,
03 sy-repid,
60 text-015,
Sy-uname,
80 sy-vline.
WRITE :/ sy-vline,
03 sy-datum,
35 text-013,
60 text-014,
Sy-pagno,
80 sy-vline.
WRITE :/ sy-uline (80).
WRITE :/ sy-vline, text-014, 15 sy-vline, "PURCHASE ORDER NUMBER
Text-008, 30 sy-vline, "PO ITEM NUMBER
Text-009, 45 sy-vline, "PLANT
Text-010, 60 sy-vline, "MATERIAL NUMBER
Text-011, 80 sy-vline. "MATERIAL GROUP
WRITE :/ sy-uline (80).
*----------------------------------------------------------------------
* End-of-page event
*----------------------------------------------------------------------
END-OF-PAGE.
WRITE :/ sy-vline,
03 text-016,
P_limit,
60 text-014,
Sy-pagno,
80 sy-vline.
Write:/ sy-uline(80).
INCLUDE Z_INCLUDE_PURCHORDERKKB01.
form form_search_help .
REFRESH it_ebeln.
CLEAR it_ebeln.
CLEAR P_ebeln.
SELECT ebeln FROM ekko INTO TABLE it_ebeln.
CALL FUNCTION 'POPUP_WITH_TABLE_DISPLAY'
EXPORTING
Endpos_col = 21
Endpos_row = 35
Startpos_col = 12
Startpos_row = 1
Title text = text-012
IMPORTING
Choise = P_ebeln
TABLES
Valuetab = it_ebeln
EXCEPTIONS
break off = 1
OTHERS = 2.
ABAP
Interview Questions
1. How data is stored in cluster table? Each field of cluster table behaves as tables which contains the no. of entries.
2. What are client dependant objects in abap/sap?
SAP Script layout, text element, and some DDIC objects.
3. On which even we can validate the input fields in module progams?
In PAI (Write field statement on field you want to validate, if you want to validate group of fields put in chain and End chain statement.)
4. In selection screen I have three fields, plant mat no and material group. If I input plant how do I get the mat no and material group based on plant dynamically?
AT SELECTION-SCREEN ON VALUE-REQUEST FOR MATERIAL.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST' to get material and material group for the plant.
5. How do you get output from IDOC?
Data in IDOc is stored in segments; the output from Idoc is obtained by reading the data stored in its respective segments.
6. When top of the page event is triggered?
After excuteing first write statement in start-of-selection event.
7. Can we create field without data element and how?
In SE11 one option is available above the fields strip. Data element/ direct type.
8. How do we debug sap script?
Go to SE71 give lay set name; go to utilities select debugger mode on.
9. Which transaction code can I used to analyze the performance of ABAP program?
TCode AL21.
10. How can I copy a standard table to make my own z_table?
Go to transaction SE11. Then there is one option to copy table. Press that button. Enter the name of the standard table and in the Target table enter Z table name and press enter.
Following are some of the answers, which I gave upto my knowledge.
1. What is the use of ‘outerjoin’
Ans: With the use of outer join you can join the tables even there is no entry in all the tables used in the view.
In case of inner join there should be an entry in al the tables use in the view.
2. When to use logical database?
Ans. Advantage of Logical databases:
less coding s required to retrieve data compared to normal internel tables.
Tables used LDB are in hierarchical structure.
3. What is the use of 'table index'?
Ans .Index is used for faster access of data base tables.
4. What is the use of 'FOR ALL ENTRIES'?
Ans. To avoid nested select statements we use SELECT FOR ALL ENTRIES statement.
If there r more than 10000 records SELECT FOR ALL ENTRIES is used.
Performance wise SELECT FOR ALL ENTRIES is better to use.
5. Can you set up background processing using CALL TRANSACTION?
Yes, Using No Screen Mode.
6. What are table buffers?
Table buffers reside locally on each application server in the system. The data of buffered tables can thus be accessed
directly from the buffer of the application server. This avoids the time-consuming process of accessing the database.
Buffering is useful if table needs to be accessed more no. of times in a program.
With Compliments from: Pavan
1. How do I set a flag for a field in any table?
Create a char field of length 1. for example field STAS-LKENZ is Deletion Indicator. It means that if the value in the field is 'X' then that record has been deleted.
2. Can I execute user exits? If yes, how?
Yes you can. after finding the user exit, you need to use, goto CMOD add ur user-exit to your project. Then activate the FM which you require. Now go into that function module there will be a Include program wit name ZX* . Double click on it, it will ask to create an object, answer it Yes and then write your code in it.
3. How do I find the output type of a table or a program?
Table TNAPR / NAST
More than
100 ABAP Interview Faq's
Content Author : Prbabu Author email : prbabu9@yahoo.co.in
Feel free to contribute to those questions without answers or add-in additional tips for those answers which you think can be further improve by Submitting a ABAP Tips or ABAP Programs.
1. What is the typical structure of an ABAP/4 program?
ANS:-
HEADER ,BODY,FOOTER.
2. What are field symbols and field groups.?
Have you used "component idx of structure" clause with field groups?
ANS:-
Field symbols:-
Field groups :-
3. What should be the approach for writing a BDC program?
ANS:-
STEP 1: CONVERTING THE LEGACY SYSTEM DATA TO A FLAT FILE to internal table CALLED "CONVERSION".
STEP 2: TRANSFERING THE FLAT FILE INTO SAP SYSTEM CALLED "SAP DATA TRANSFER".
STEP 3: DEPENDING UPON THE BDC TYPE i)call transaction(Write the program explicity)
ii) create sessions (sessions are created and processed.if success data will transfer).
4. What is a batch input session?
ANS:-
BATCH INPUT SESSION is an intermediate step between internal table and database table.
Data along with the action is stored in session ie data for screen fields, to which screen it is passed,program name behind it, and how next screen is processed.
5. What is the alternative to batch input session?
ANS:-
Call transaction.
6. A situation: An ABAP program creates a batch input session.
We need to submit the program and the batch session in back ground. How to do it?
ANS:-
go to SM36 and create background job by giving
job name,job class and job steps (JOB SCHEDULING)
8. What are the problems in processing batch input sessions?
How is batch input process different from processing online?
ANS:-
PROBLEMS:-
i) If the user forgets to opt for keep session then the session will be automatically removed from the session queue(log remains). However if session is processed we may delete it manually.
ii)if session processing fails data will not be transferred to SAP database table.
10. What are the different types of data dictionary objects?
ans:-
tables, structures, views, domains, data elements, lock objects, Matchcode objects.
11. How many types of tables exists and what are they in data dictionary?
ans :-
4 types of tables
i)Transparent tables - Exists with the same structure both in dictionary as well as in database exactly with the same data and fields. Both Opensql and Nativesql can be used.
ii)Pool tables & iii)Cluster tables -
These are logical tables that are arranged as records of transparent tables.one cannot use native sql on these tables
(only opensql).They are not managable directly using database system tools.
iv)Internal tables - .
12. What is the step by step process to create a table in data dictionary?
ans:-
step 1: creating domains(data type,field length,range).
step 2: creating data elements(properties and type for a table
field).
step 3: creating tables(SE11).
13. Can a transparent table exist in data dictionary but not in the data base physically?
ANS:- NO.
TRANSPARENT TABLE DO EXIST WITH THE SAME STRUCTURE BOTH IN THE DICTIONARY AS WELL AS IN THE DATABASE,EXACTLY WITH THE SAME DATA AND FIELDS.
14. What are the domains and data elements?
ANS:-
DOMAINS : FORMAL DEFINITION OF THE DATA TYPES.THEY SET ATTRIBUTES SUCH AS DATA TYPE,LENGTH,RANGE.
DATA ELEMENT : A FIELD IN R/3 SYSTEM IS A DATA ELEMENT.
15. Can you create a table with fields not referring to data elements?
ANS:-
YES. eg:- ITAB LIKE SPFLI.here we are referening to a data object(SPFLI) not data element.
16. What is the advantage of structures? How do you use them in the ABAP programs?
ANS:-
Adv:- GLOBAL EXISTANCE(these could be used by any other program without creating it again).
17. What does an extract statement do in the ABAP program?
ANS:-
Once you have declared the possible record types as field groups and defined their structure, you can fill the extract dataset using the following statements:
EXTRACT <fg>.
When the first EXTRACT statement occurs in a program, the system creates the extract dataset and adds the first extract record to it. In each subsequent EXTRACT statement, the new extract record is added to the dataset
EXTRACT HEADER.
When you extract the data, the record is filled with the current values of the corresponding fields.
As soon as the system has processed the first EXTRACT statement for a field group <fg>, the structure of the corresponding extract record in the extract dataset is fixed. You can no longer insert new fields into the field groups <fg> and HEADER. If you try to modify one of the field groups afterwards and use it in another EXTRACT statement, a runtime error occurs.
By processing EXTRACT statements several times using different field groups, you fill the extract dataset with records of different length and structure. Since you can modify field groups dynamically up to their first usage in an EXTRACT statement, extract datasets provide the advantage that you need not determine the structure at the beginning of the program.
18. What is a collect statement? How is it different from append?
ANS:-
If an entry with the same key already exists, the COLLECT statement does not append a new line, but adds the contents of the numeric fields in the work area to the contents of the numeric fields in the existing entry.
19. What is open sql vs native sql?
ANS:- by Madhukar
Open SQL , native SQL are the interfaces to create the database applicatons.
Open SQL is consistant across different types of existing Databases.
Native SQL is the database language specific to database.Its API is specific to the databse.
Open SQL API is consistent across all vendors
20. What does an EXEC SQL stmt do in ABAP? What is the disadvantage of using it?
ANS:-
21. What is the meaning of ABAP/4 editor integrated with ABAP/4 data dictionary?
ANS:-
22. What are the events in ABAP/4 language?
ANS:-
Initialization, At selection-screen,Start-of-selection,end-of-selection,top-of-page,end-of-page, At line-selection,At user-command,At PF,Get,At New,At LAST,AT END, AT FIRST.
23. What is an interactive report?
What is the obvious diff of such report compared with classical type reports?
ANS:-
An Interactive report is a dynamic drill down report that produces the list on users choice.
diff:-
a) THE LIST PRODUCED BY CLASSICAL REPORT DOESN'T allow user to interact with the system
the list produced by interactive report allows the user to interact with the system.
b) ONCE A CLASSICAL REPORT EXECUTED USER LOOSES CONTROL.IR USER HAS CONTROL.
c) IN CLASSICAL REPORT DRILLING IS NOT POSSIBLE.IN INTERACTIVE DRILLING IS POSSIBLE.
24. What is a drill down report?
ANS:-
Its an Interactive report where in the user can get more relavent data by selecting explicitly.
25. How do you write a function module in SAP? describe.
ANS:-
creating function module:-
called program - se37-creating funcgrp,funcmodule by assigning attributes,importing,exporting,tables,exceptions.
calling program - SE38-in pgm click pattern and write function name- provide export,import,tables,exception values.
26. What are the exceptions in function module?
ANS:-
COMMUNICATION_FAILURE
SYSTEM_FAILURE
27. What is a function group?
ANS:-
GROUP OF ALL RELATED FUNCTIONS.
28. How are the date and time field values stored in SAP?
ANS:-
DD.MM.YYYY. HH:MM:SS
30. Name a few data dictionary objects? //rep//
ANS:-
TABLES,VIEWS,STRUCTURES,LOCK OBJECTS,MATCHCODE OBJECTS.
31. What happens when a table is activated in DD?
ANS:-
It is available for any insertion,modification and updation of records by any user.
32. What is a check table and what is a value table?
Check table will be at field level checking.
Value table will be at domain level checking ex: scarr table is check table for carrid.
33. What are match codes? describe?
ans:-
It is a similar to table index that gives list of possible values for either primary keys or non-primary keys.
34. What transactions do you use for data analysis?
ANS:-
35. What is table maintenance generator?
ANS:-
36. What are ranges? What are number ranges?
ANS:-
max,min values provided in selection screens.
37. What are select options and what is the diff from parameters?
ANS:-
select options provide ranges where as parameters do not.
SELECT-OPTIONS declares an internal table which is automatically filled with values or ranges
of values entered by the end user. For each SELECT-OPTIONS , the system creates a selection table.
SELECT-OPTIONS <SEL> FOR <field>.
A selection table is an internal table with fields SIGN, OPTION, LOW and HIGH.
The type of LOW and HIGH is the same as that of <field>.
The SIGN field can take the following values: I Inclusive (should apply) E Exclusive (should not apply)
The OPTION field can take the following values: EQ Equal GT Greater than NE Not equal BT Between LE Less
than or equal NB Not between LT Less than CP Contains pattern GE Greater than or equal NP No pattern.
diff:-
PARAMETERS allow users to enter a single value into an internal field within a report.
SELECT-OPTIONS allow users to fill an internal table with a range of values.
For each PARAMETERS or SELECT-OPTIONS statement you should define text elements by choosing
Goto - Text elements - Selection texts - Change.
Eg:- Parameters name(30).
when the user executes the ABAP/4 program,an input field for 'name' will appear on the selection screen.You can change the comments on the left side of the input fields by using text elements as described in Selection Texts.
38. How do you validate the selection criteria of a report?
And how do you display initial values in a selection screen?
ANS:-
validate :- by using match code objects.
display :- Parameters <name> default 'xxx'.
select-options <name> for spfli-carrid.
39. What are selection texts?
ANS:-
40. What is CTS and what do you know about it?
ANS:-
The Change and Transport System (CTS) is a tool that helps you to organize development projects in the ABAP Workbench and in Customizing, and then transport the changes between the SAP Systems and clients in your system landscape.
This documentation provides you with an overview of how to manage changes with the CTS and essential information on setting up your system and client landscape and deciding on a transport strategy. Read and follow this documentation when planning your development project.
For practical information on working with the Change and Transport System, see Change and Transport Organizer and Transport Management System.
41. When a program is created and need to be transported to prodn does selection texts always go with it? if not how do you make sure? Can you change the CTS entries? How do you do it?
ANS:-
42. What is the client concept in SAP? What is the meaning of client independent?
ANS:-
43. Are programs client dependent?
ANS:-
Yes.Group of users can access these programs with a client no.
44. Name a few system global variables you can use in ABAP programs?
ANS:-
SY-SUBRC,SY-DBCNT,SY-LILLI,SY-DATUM,SY-UZEIT,SY-UCOMM,SY-TABIX.....
SY-LILLI IS ABSOLUTE NO OF LINES FROM WHICH THE EVENT WAS TRIGGERED.
45. What are internal tables? How do you get the number of lines in an internal table?
How to use a specific number occurs statement?
ANS:-
i)It is a standard data type object which exists only during the runtime of the program.
They are used to perform table calculations on subsets of database tables and for re-organising the contents of database tables according to users need.
ii)using SY-DBCNT.
iii)The number of memory allocations the system need to allocate for the next record population.
46. How do you take care of performance issues in your ABAP programs?
Performance of ABAPs can be improved by minimizing the amount of data to be transferred.
The data set must be transferred through the network to the applications, so reducing the amount OF time and also reduces the network traffic.
Some measures that can be taken are:
- Use views defined in the ABAP/4 DDIC (also has the advantage of better reusability).
- Use field list (SELECT clause) rather than SELECT *.
- Range tables should be avoided (IN operator)
- Avoid nested SELECTS.
i)system tools
ii)field symbols and field groups.
ans:-
Field Symbols : Field symbols are placeholders for existing fields. A Field Symbol does not physically reserve space for a field,but points to a field which is not known until runtime of the program.
eg:- FIELD-SYMBOL <FS> [<TYPE>].
Field groups : A field group combines several fields under one name.At runtime,the INSERT command is used to define which data fields are assigned to which field group.
There should always be a HEADER field group that defines how the extracted data will be sorted,the data is sorted by the fields grouped under the HEADER field group.
47. What are datasets?
ANS:-
The sequential files(ON APPLICATION SERVER) are called datasets. They are used for file handling in SAP.
48. How to find the return code of a statement in ABAP programs?
ANS:-
Using function modules.
49. What are interface/conversion programs in SAP?
ANS :
CONVERSION : LEGACY SYSTEM TO FLAT FILE.
INTERFACE : FLAT FILE TO SAP SYSTEM.
50. Have you used SAP supplied programs to load master data?
51. What are the techniques involved in using SAP supplied programs?
Do you prefer to write your own programs to load master data? Why?
52. What are logical databases? What are the advantages/disadvantages of logical databases?
ANS:-
To read data from a database tables we use logical database.
A logical database provides read-only access to a group of related tables to an ABAP/4 program.
adv:-
The programmer need not worry about the primary key for each table.Because Logical database knows how the different tables relate to each other,and can issue the SELECT command with proper where clause to retrieve the data.
i)An easy-to-use standard user interface.
ii)check functions which check that user input is complete,correct,and plausible.
iii)meaningful data selection.
iv)central authorization checks for database accesses.
v)good read access performance while retaining the hierarchical data view determined by the application logic.
disadv:-
i)If you donot specify a logical database in the program attributes,the GET events never occur.
ii)There is no ENDGET command,so the code block associated with an event ends with the next event
statement (such as another GET or an END-OF-SELECTION).
53. What specific statements do you using when writing a drill down report?
ans:-
AT LINE-SELECTION,AT USER-COMMAND,AT PF.
54. What are different tools to report data in SAP? What all have you used?
ans:-
55. What are the advantages and disadvantages of ABAP/4 query tool?
56. What are the functional areas? User groups? and how does ABAP/4 query work in relation to these?
57. Is a logical database a requirement/must to write an ABAP/4 query?
59. What are Change header/detail tables? Have you used them?
60. What do you do when the system crashes in the middle of a BDC batch session?
ans:-
we will look into the error log file (SM35).
61. What do you do with errors in BDC batch sessions?
ANS:-
We look into the list of incorrect session and process it again. To correct incorrect session we analyize the session to determine which screen and value produced the error.For small errors in data we correct them interactively otherwise
modify batch input program that has generated the session or many times even the datafile.
62. How do you set up background jobs in SAP? What are the steps? What are the event driven batch jobs?
ans:-
go to SM36 and create background job by giving job name,job class and job steps(JOB SCHEDULING)
63. Is it possible to run host command from SAP environment? How do you run?
64. What kind of financial periods exist in SAP? What is the relavent table for that?
65. Does SAP handle multiple currencies? Multiple languages?
ans:-
Yes.
66. What is a currency factoring technique?
67. How do you document ABAP/4 programs? Do you use program documentation menu option?
68. What is SAPscript and layout set?
ans:-
The tool which is used to create layout set is called SAPscript. Layout set is a design document.
69. What are the ABAP/4 commands that link to a layout set?
ans:-
control commands,system commands,
70. What is output determination?
71. What are IDOCs?
ans:-
IDOCs are intermediate documents to hold the messages as a container.
72. What are screen painter? menu painter? Gui status? ..etc.
ans:-
dynpro - flow logic + screens.
menu painter -
GUI Status - It is subset of the interface elements(title bar,menu bar,standard tool bar,push buttons) used for a certain screen.
The status comprises those elements that are currently needed by the transaction.
73. What is screen flow logic? What are the sections in it? Explain PAI and PBO.
ans:-
The control statements that control the screen flow.
PBO - This event is triggered before the screen is displayed.
PAI - This event is responsible for processing of screen after the user enters the data and clicks the pushbutton.
74. Overall how do you write transaction programs in SAP?
ans:-
Create program-SE93-create transcode-Run it from command field.
75. Does SAP has a GUI screen painter or not? If yes what operating systems is it available on? What is the other type of screen painter called?
76. What are step loops? How do you program pagedown pageup in step loops?
ans:-
step loops are repeated blocks of field in a screen.
77. Is ABAP a GUI language?
ANS:-
Yes.
ABAP IS AN EVENT DRIVEN LANGUAGE.
78. Normally how many and what files get created when a transaction program is written?
What is the XXXXXTOP program?
ans:-
ABAP/4 program.
DYNPRO
79. What are the include programs?
ANS:-
When the same sequence of statements in several programs are to be written repeadly they are coded in include programs (External programs) and are included in ABAP/4 programs.
80. Can you call a subroutine of one program from another program?
ans:- Yes- only external subroutines Using 'SUBMIT' statement.
81. What are user exits? What is involved in writing them? What precations are needed?
82. What are RFCs? How do you write RFCs on SAP side?
83. What are the general naming conventions of ABAP programs?
ANS:-
Should start with Y or Z.
84. How do you find if a logical database exists for your program requrements?
ans:-
SLDB-F4.
85. How do you find the tables to report from when the user just tell you the transaction he uses? And all the underlying data is from SAP structures?
ans:-
Transcode is entered in command field to open the table.Utilities-Table contents-display.
86. How do you find the menu path for a given transaction in SAP?
ans:-
87. What are the different modules of SAP?
ans:-
FI,CO,SD,MM,PP,HR.
89. How do you get help in ABAP?
ans:-
HELP-SAP LIBRARY,by pressing F1 on a keyword.
90. What are different ABAP/4 editors? What are the differences?
ans:-
91. What are the different elements in layout sets?
ans:-
PAGES,Page windows,Header,Paragraph,Character String,Windows.
92. Can you use if then else, perform ..etc statements in sap script?
ans:-
yes.
93. What type of variables normally used in sap script to output data?
94. How do you number pages in sapscript layout outputs?
95. What takes most time in SAP script programming?
ANS:-
LAYOUT DESIGN AND LOGO INSERTION.
96. How do you use tab sets in layout sets?
97. How do you backup sapscript layout sets? Can you download and upload? How?
98. What are presentation and application servers in SAP?
ANS:-
The application layer of an R/3 System is made up of the application servers and the message server. Application programs in an R/3 System are run on application servers. The application servers communicate with the presentation components, the database, and also with each other, using the message server.
99. In an ABAP/4 program how do you access data that exists on a presentation server vs on an application server?
ans:-
i)using loop statements.
ii)flat
100. What are different data types in ABAP/4?
ans:-
Elementary -
predefined C,D,F,I,N,P,T,X.
userdefined TYPES.
ex: see in intel book page no 35/65
Structured -
predefined TABLES.
userdefined Field Strings and internal tables.
101. What is difference between session method and Call Transaction?
ans:-
102. Setting up a BDC program where you find information from?
ans:-
103. What has to be done to the packed fields before submitting to a BDC session.
ans:-
fields converted into character type.
104. What is the structure of a BDC sessions.
ans:-
BDCDATA (standard structure).
105. What are the fields in a BDC_Tab Table.
ans:-
program,dynpro,dynbegin,fnam,fval.
106. What do you define in the domain and data element.
Technical details like
107. What is the difference between a pool table and a transparent table and how they are stored at the database level.
ans:-
ii)Pool tables is a logical representation of transparent tables .Hence no existence at database level. Where as transparent tables are physical tables and exist at database level.
108. What is cardinality?
For cardinality one out of two (domain or data element) should be the same for Ztest1 and Ztest2 tables. M:N
Cardinality specifies the number of dependent(Target) and independent (source) entities which can be in a relationship.
No comments:
Post a Comment
Note: only a member of this blog may post a comment.