Screen Painter is an ABAP Editor tools allowed us to create dialog screen. Dialog screen usually created as a screen to catch user input. It can be accessed by tcode SE51.
Screen Painter Architecture:
1. Screen Attributes
Define screen title, define its type (normal, subscreen).
2. Flow logic
Flow logic control flow of program. The event block is introduced by the corresponding keyword statement, and it concludes either when the next block is introduced, or at the end of the program.
There are four event blocks, each of which is introduced with the screen keyword PROCESS:
PROCESS BEFORE OUTPUT.
...
PROCESS AFTER INPUT.
...
PROCESS ON HELP-REQUEST.
...
PROCESS ON VALUE-REQUEST.
A simple sample of flow logic.
PROCESS BEFORE OUTPUT.
MODULE PBO_module1.
MODULE PBO_module2.
PROCESS AFTER INPUT.
MODULE PAI_module1.
MODULE PAI_module2.
Flow logic structured on event, in above example we can see there are two event involved, "process before output" (PBO) and "process after input" (PAI).
PBO processed before the screen is displayed. It allow us to define toolbar and title, positioning the cursor, showing and hiding fields and changing field attributes dynamically.
PAI processed after user command (double click, push button). It is allow us to validate user input, and determine next process based on user command.
In flow logic, we only define module name to define program flow, to create "real code", double click on module name to create it, then write program in it.
3. Layout Editor
We use layout editor to place screen element in screen layout. There are two modes in editing layout: Graphical and alphanumeric. Both modes offer the same functions but use different interfaces. In graphical mode, you use a drag and drop interface similar to a drawing tool. In alphanumeric mode, you use your keyboard and menus. It is easier to work in graphical mode, to toggle beetween this mode, in SE51 go to: Utilities->Settings: in screen painter tabs check graphical layout editor.
Layout editor containing this tools:
i. Element pallete
On left screen you will find list of element (textbox, label, checkbox) you can use. Drag and drog element to put it on screen.
ii. Name & Text
Aftef put element on screen, write its name and text (in textbox, text will set default value).
iii. Attributes Window
Double click the element to display its attributes, or select it then click :Goto->Secondary window->attributes. For example, in textbox element, we can set its length, read only mode, in this window.
iv. Dictionary/program field.
If we want to create a field refer to field in data dictionay or field already declared in program, use this menu to create text field with the same type compared to its referral.
4. Element list.
Element list shown all element in screen. We rarely use this menu, because it easier to maintain element in layout editor.
Monday, August 27, 2007
Screen Painter
Diposting oleh alionzo di 3:26 AM 32 komentar
Label: ABAP Tutorial
Thursday, August 23, 2007
Find out table source in SAP
Find out where the data is stored in SAP is a very challenging task. In some cases, we can find it easily in few minutes, but in another case it takes more then one day to find it.
I will try to give tips to find it out step by step.
1. Technical Information.
Put cursor in screen field, press F1, it will show description about this field. Then press "Technical Information" button, you can get field name and table / structure / view. If you get a table / view field, check the data in table / view, you may find it there. But, if you get structure field, go to next step.
Example of table field: tcode VA03 (display sales order), screen field order (VBAK-VBELN)
Example of stucture field: tcode IE03 (display equipment), screen field equipment (RM63E-EQUNR).
2. Exploring Search help (display available list to help input value by pressing F4 in screen field).
Sometimes field with search help can be found be displaying field in its search help. Example, tcode XD03 (display customer) field Customer (RF02D-KUNNR). It is a stucture field, to find the table, place cursor in screen field, press F4 (display search help), run search help until it show available list. In this list, place cursor in field customer, then press F1 to display technical info. You will get table/view field for this.
3. SQL Trace
Open your transaction , before type anything in screen, open transaction ST05 (SQL trace) in another session, start SQL trace by pressing "Trace on". SQL trace is a tools to record database request. Make sure you don't run other program beside transaction you want to trace. After starting SQL trace then go back to your transaction, run it until you get field to search shown in screen. Then go to SQL trace session, end SQL trace by pressing "Trace off". Then click "List trace", here you will get all table requested while SQL trace on. Explore table listed there, usually stucture field and table field having same field name.
4. Explore based on SAP module.
Go to SE16. Click F4, then click "SAP Application". Here you got table tree groupped in SAP module.
5. Find it in source code.
Well... you already finished up to step 4, but didn't find the table source yet. It's time to take a harder step. Click F1 then technical information to get program name and field name. Then go to SE38, open the program, then find field name. May be your detective instinct can help out there.
6. Debugging abap program.
Debugging abap could be a sweating task. "Watchpoints" will help you very much in debugging. Considering it could be more than one day to accomplish this task, don't forget to capture and create documentation while debugging when you reached an interesting point. I always do that, when I saw good point, I capture it by "print screen", paste it into Microsoft word, then give a remark on it.
Here is another tips that could help you.
1. Adjacent table will have similar prefix:
sample in sales order, prefik ( V / VB ) : VBAK, VBAP, VBPA...
sample in material management ( M ) : MKPF, MSEG, MARD, MARC,..
2. Almost all SAP Table have a view
To find related table, goto SE11, click where-used list, choose Views.
3. Another tools to find table field:
Goto SE15, Choose: ABAP Dictionary -> Field -> Table Fields.
Diposting oleh alionzo di 9:23 PM 19 komentar
Label: ABAP Tutorial
Thursday, August 16, 2007
BDC (Batch Data Communication) Tutorial for Data Transfer
What is BDC
BDC ( Batch Data Communication ) is used for uploading mass data into SAP system. In SAP system BDC also referred to batch input or data tranfer.
Typical Uses
Typical uses of batch input include the one-time import of data from a legacy system into a newly installed R/3 System. Another typical use is for periodic transfers of data from external systems or legacy systems that are still in use into SAP.
Background of BDC
To ensure data consistency in SAP system, we must not update SAP data directly from ABAP program. We must upload data through similar program flow compared to manual input by user. SAP provide this by BDC. BDC works by simulating the user input from transactional screen via an ABAP program. This means that you do not bypass any of the standard SAP consistency checks, authorisations, update conjunction tables, etc.
How it works
Data input entered by user simulated in BDC by data packet. The transaction then started using this internal table as the input and executed in the background.
Data packet is an internal table has a structure of BDCDATA, it has fields:
1. PROGRAM (program name)
2. DYNPRO (screen number)
3. DYNBEGIN (New screen start) X=new screen
4. FNAM (Field name)
5. FVAL (Field value)
Data packet contain of screen by screen packets. One screen packet contain:
1. Screen no
2. Cursor position
3. User command
4. Input fields
It implemented in internal table in this format:PROGRAM DYNPRO DYNBEGIN FNAM FVAL program1 screen1 X BDC_CURSOR pos1 BDC_OKCODE comm1 fieldname1 fieldvalue1 fieldname2 fieldvalue2 program2 screen2 X BDC_CURSOR pos1 BDC_OKCODE comm1 fieldname1 fieldvalue1 fieldname2 fieldvalue2
For example, we want to create a BDC to change ABAP program title.
Here is what we do manually: Go to screen SE38, enter program, select radiobutton "Attributes", then click "Change". After that, change title then press "Save" button.
In BDC, we simulate this by following internal table:PROGRAM DYNPRO DYNBEGIN FNAM FVAL SAPLWBABAP 100 X BDC_CURSOR RS38M-FUNC_HEAD BDC_OKCODE =CHAP RS38M-PROGRAMM ZAALTESTBDC RS38M-FUNC_EDIT RS38M-FUNC_HEAD X SAPLSEDTATTR 200 X BDC_CURSOR RS38M-REPTI BDC_OKCODE =CONT RS38M-REPTI Test change title BDC TRDIR-SUBC 1 TRDIR-FIXPT X SAPLWBABAP 100 X BDC_CURSOR RS38M-PROGRAMM BDC_OKCODE =BACK RS38M-PROGRAMM ZAALTESTBDC RS38M-FUNC_HEAD X
To accomodate you to build data packet, SAP provide BDC recording in tcode SHDB.
Do following action:
1. Go to tcode SHDB
2. click "New recording", enter recording name to identified your record, and TCode to be recorded.
3. You will enter recording mode of the transaction, simulate action you want to perform in this transaction
4. At the end it will result internal table ready to upload to data transfer methods (Call transaction or BDC sessions).
After internal table created then we pass this to data transfer methods. There are two alternatives of data transfer methods, using Call Transaction or BDC session.
Call transaction performed by calling command ‘Call Transaction’. ABAP program must do the error handling based on returning table from call transaction command. It is used for real-time interfaces and custom error handling & logging features. This is suitable when processing sequential update, it means, next data will depend on previous data.
In BDC Sessions, the ABAP program creates a session with all the transactional data, and this session can be viewed, scheduled and processed (using Transaction SM35) at a later time. The latter technique has a built-in error processing mechanism too.
Other useful article:
BDC Tutorial in SAP-Img
Diposting oleh alionzo di 2:32 AM 69 komentar
Label: ABAP Tutorial
Monday, August 13, 2007
Site Map ABAP Sample Code
ABAP Sample Code:
ALV
Simple ALV
Field Catalog in ALV
Change Layout Format in ALV
FTP
FTP
Business Document
Store Document / File to SAP
Get Document / File Stored in SAP
Selection Screen
Help Value Request (F4)
Add Toolbar Button in Selection Screen
Hide Parameter / Select Option in Selection Screen
Tab Strip in Selection Screen
Miscellaneous
Dynamic Table Maintenance
Diposting oleh alionzo di 10:44 PM 19 komentar
Label: ABAP Sample Code
Site Map ABAP Tutorial
ABAP Tutorial:
Step by Step learning ABAP
New ABAP Trial Software Available
Data Dictionary
My first ABAP Program
Data Declaration
Processing Internal Tables
BDC Tutorial for Data Transfer
Debugging ABAP Program
Event in ABAP Report
Find out table source in SAP
Screen Painter
Diposting oleh alionzo di 10:44 PM 3 komentar
Label: ABAP Tutorial
Friday, August 10, 2007
Event in ABAP Report
Event in ABAP report determine process flow of a program. The events are triggered depended on the way the output is generated. They begin after event keyword and end when the next event reached.
Event keyword:
INITIALIZATION.
Occurs when report initialized.
We can use it to check user authorization or prepare output for selection screen.
AT SELECTION-SCREEN OUTPUT :
Occurs each time selection screen about to generated.
We can use it to modify selection screen, for example hide / unhide parameter.
AT SELECTION-SCREEN.
Occurs each user command in selection screen. we can use it to perform checking on user input.
START-OF-SELECTION
Occurs after the standard selection screen has been processed.,
data is read in this event.
END-OF-SELECTION
Occurs after start-of-selection.
TOP-OF-PAGE
Occurs when a new page starts.
Use it for write report header.
END-OF-PAGE
Occurs when a page ends.
Use it for write report footer.
AT LINE-SELECTION
Occurs when the user double-click on report.
AT USER-COMMAND
Occurs when the user push toolbar button.
This is program to demonstrate how to use event properly.
REPORT ZAALGAL0008
LINE-COUNT 10(1).
*http://abap-gallery.blogspot.com
TABLES: sflight.
DATA: BEGIN OF t_report OCCURS 3,
carrid LIKE sflight-carrid,
connid LIKE sflight-connid,
END OF t_report.
*begin selection screen
PARAMETERS p_datum LIKE sy-datum.
PARAMETERS p_check AS CHECKBOX.
*end selection screen
INITIALIZATION.
*begin initialization
MOVE sy-datum TO p_datum.
*end initialization
AT SELECTION-SCREEN.
*begin at selection-screen
MESSAGE I888(sabapdocu) WITH 'At selection-screen'.
IF p_check = 'X'.
MESSAGE E888(sabapdocu) WITH 'Clear checkbox'.
ENDIF.
*end at selection-screen
AT SELECTION-SCREEN OUTPUT.
*begin at selection-screen output
MESSAGE I888(sabapdocu) WITH 'At selection-screen output'.
*end at selection-screen output
START-OF-SELECTION.
*begin start-of-selection.
MESSAGE I888(sabapdocu) WITH 'start-of-selection'.
SELECT * FROM sflight.
MOVE sflight-carrid TO t_report-carrid.
MOVE sflight-connid TO t_report-connid.
APPEND t_report.
ENDSELECT.
*end start-of-selection.
END-OF-SELECTION.
*begin end-of-selection.
MESSAGE I888(sabapdocu) WITH 'end-of-selection'.
FORMAT COLOR col_normal.
DO 30 TIMES.
LOOP AT t_report.
WRITE / t_report-carrid.
WRITE t_report-connid.
ENDLOOP.
ENDDO.
*end end-of-selection.
TOP-OF-PAGE.
FORMAT COLOR col_heading.
WRITE 'This is header'.
END-OF-PAGE.
FORMAT COLOR col_total.
WRITE 'This is footer'.
AT LINE-SELECTION.
WRITE: / 'Cursor Row:', sy-curow.
WRITE: / 'Cursor Col:', sy-cucol.
Diposting oleh alionzo di 12:10 AM 14 komentar
Label: ABAP Tutorial