SAP dialog Program
-
Step 1: create a program: zzw_dialog_form_luw
Step 2: Data define section.
There you must define:
Data OK _code type sy-ucomm.
Step 3: Call screen screen_number.
E. g: Call screen 100.
Setp 4: Double Click screen_number.
E.G: Double Click 100.
-Screen painter
1) element list.
Name type
OK _code OK
-Flow logic
Write PbO/PAI Process Section.
In flow logic are all module define.
E. g:
Process before output.
Module init.
Process after input.
Module exit at exit-command.
...
Module select.
At there, you can double click module and go to the program to write module.
Module implementation.
E. g:
Module exit input.
Leave program.
Endmodule.
2) screen painter-Design Screen.
Click-layout or point go to-> layout.
Step 5: Implementation PbO module section.
E. g:
Module init output.
Set PF-STATS 'basic '.
Sflight-carrid = 'lh '.
Sflight-connid = '000000 '.
Sflight-fldate = sy-datum.
Endmodule.
Set pf-Stats is initialization screen menu.
E. g: set pf-Stats 'basic '.
'Basic 'is screen menu name. inclue [menu bar], [Application
Toolbar], [function keys]
------
Dialog from complete program: zzw_dialog_form_luw
*-----------------------------------------------------------------------
*
* Company ASAT Company Limited
*
* Programename: zzw_dialog_form_luw
*
* Author: bajie_zhu
*
* Date: 11/03/2008 *
* Description: Study sap dialog program and luw (SAP lock Databse
* Objec .)
*
*-----------------------------------------------------------------------
Report zzw_dialog_form_luw message-ID sabapdocu ..
Tables sflight.
Data Text (8) type C.
Data OK _code type sy-ucomm.
Call screen 100.
*&---------------------------------------------------------------------*
* & Module init output
*&---------------------------------------------------------------------*
* Text
*----------------------------------------------------------------------*
Module init output.
Set PF-STATUS 'basic '.
Sflight-carrid = 'lh '.
Sflight-connid = '000000 '.
* Sflight-fldate = sy-datum.
Endmodule. "init output
*&---------------------------------------------------------------------*
* & Module exit Input
*&---------------------------------------------------------------------*
* Text
*----------------------------------------------------------------------*
Module exit input.
Leave program.
Endmodule. "Exit Input
*&---------------------------------------------------------------------*
* & Module enqueue Input
*&---------------------------------------------------------------------*
* Text
*----------------------------------------------------------------------*
Module enqueue input.
Case OK _code.
When 'enqueue '.
Call function 'enqueue _ edemoflht'
Exporting
Mode_sflight = 'X'
Carrid = sflight-carrid
Connid = sflight-connid
Fldate = sflight-fldate
Exceptions
Foreign_lock = 1
System_failure = 2
Others = 3.
Case sy-subrc.
When 0.
Message i888 with 'enqueue successful '(001 ).
When 1.
TEXT = sy-msgv1.
Message e888 with 'record already' (002) 'locked by' (003)
Text.
Call transaction 'sm12 '.
When 2 or 3.
Message e888 with 'error in enqueue! '(004)
'Sy-subrc: 'sy-subrc.
Endcase.
When 'dequeue '.
Call function 'dequeue _ edemoflht'
Exporting
Mode_sflight = 'X'
Carrid = sflight-carrid
Connid = sflight-connid
Fldate = sflight-fldate
Exceptions
Others = 1.
Case sy-subrc.
When 0.
Message i888 with 'destue successful '(005 ).
When 1.
Message e888 with 'error in dequeue! '(006 ).
Endcase.
When 'sm12 '.
Call transaction 'sm12 '.
When 'select '.
Message i888 with 'sy-subrc: 'sy-subrc.
Endcase.
Endmodule. "enqueue Input
*&---------------------------------------------------------------------*
* & Module select input
*&---------------------------------------------------------------------*
* Text
*----------------------------------------------------------------------*
Module select input.
* Case OK _code.
* When 'select '.
* Select * From sflight where carrid = sflight-carrid
* And connid = sflight-connid
* And fldate = sflight-fldate.
* Endselect.
Message i888 with 'xxxxxxx '.
* Endcase.
Endmodule. "select input