SAP Dialog From Program

SAP Dialog From 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 = '400'.
          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: Wei_Zhu
*
*  Date: 05/12/2006
*
*  Description: Study SAP Dialog Form 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 = '400'.
*  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 '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.                 " 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
          
             

posted on 2007-06-04 09:34  封起De日子  阅读(151)  评论(0编辑  收藏  举报

导航