clh899 发表于 2015-9-18 10:05:54

SAP Dialog Program

  SAP DialogProgram
-
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   orPointGO TO -> Layout.

  Step 5: Implementation PBO Module Section.
   e.g :
Module Init OutPut.
   Set PF-STATS 'BASIC'.
          Sflight-Carrid = 'LH'.
          Sflight-Connid = '400'.
          Sflight-fldate = Sy-datum.
EndModule.
  Set PF-Statsis Initialization Screen Menu.
       e.g: Set PF-Stats 'BASIC'.
            'BASIC' is Screen Menu Name. Inclue [ Menu Bar ] , [Application
  Toolbar],

  
------
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.)
*
*-----------------------------------------------------------------------
REPORTZZW_DIALOG_FORM_LUWMESSAGE-ID sabapdocu.               .
  TABLESsflight.
  DATAtext(8) TYPE c.
  DATAok_code TYPE sy-ucomm.
  CALL SCREEN 100.
  *&---------------------------------------------------------------------*
*&      ModuleinitOUTPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
module init output.
SET PF-STATUS 'BASIC'.
sflight-carrid = 'LH'.
Sflight-connid = '400'.
*sflight-fldate = sy-datum.
endmodule.               " initOUTPUT
*&---------------------------------------------------------------------*
*&      ModuleexitINPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
module exit input.
LEAVE PROGRAM.
endmodule.               " exitINPUT
*&---------------------------------------------------------------------*
*&      ModuleEnqueueINPUT
*&---------------------------------------------------------------------*
*       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 'Dequeue 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.               " EnqueueINPUT
*&---------------------------------------------------------------------*
*&      ModuleselectINPUT
*&---------------------------------------------------------------------*
*       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.               " selectINPUT
页: [1]
查看完整版本: SAP Dialog Program