본문 바로가기

SAP ABAP

프로그램 기본 템플릿

간단한 ABAP 프로그램을 작성하는 기본 템플릿

***********************************************************************
* Report            : ZPROGRAM                                        *
* Module/Sub-Module : <Module>                                        *
* Description       : <Simple Desc>                                   *
***********************************************************************
*                          MODIFICATION LOG                           *
*                                                                     *
* DATE       AUTHORS            DESCRIPTION                           *
* ---------- ------------------ ------------------------------------- *
*  <Date>     <Auth>            Initial Release                       *
***********************************************************************

REPORT ZPROGRAM.

*----------------------------------------------------------------------*
* TYPE-POOLS
*----------------------------------------------------------------------*
* TYPE-POOLS: SLIS, ICON.


*----------------------------------------------------------------------*
* TABLES
*----------------------------------------------------------------------*
* TABLES: SSCRFIELDS.


*----------------------------------------------------------------------*
* DATA
*----------------------------------------------------------------------*

* DATA: GT_DATA LIKE TABLE OF A WITH HEADER LINE.

DATA: FUNCTXT      TYPE SMP_DYNTXT.


*----------------------------------------------------------------------*
* SELECTION-SCREEN
*----------------------------------------------------------------------*
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE t001.
  
  SELECTION-SCREEN SKIP 1.
  
  SELECT-OPTIONS: S_SID   FOR SY-SYSID,
                  S_DATE  FOR SY-DATUM NO-EXTENSION.

  PARAMETERS: P_TEMP1(2)  TYPE N DEFAULT '0'.
  PARAMETERS: P_TEMP2(2)  TYPE N DEFAULT '0'.
  PARAMETERS: C_TEMP1 AS CHECKBOX DEFAULT 'X'.
  
  SELECTION-SCREEN COMMENT (60) t002.
                  

SELECTION-SCREEN END OF BLOCK b1.

SELECTION-SCREEN: FUNCTION KEY 1.

AT SELECTION-SCREEN.
  PERFORM MENU_SELECT.

AT SELECTION-SCREEN OUTPUT.
  PERFORM MODIFY_SCREEN.

*----------------------------------------------------------------------*
* INITIALIZATION                                                       *
*----------------------------------------------------------------------*
INITIALIZATION.

  PERFORM MENU_BAR.

  MOVE 'Program1' TO t001.
  MOVE 'Comment' TO t002.


*----------------------------------------------------------------------*
* START-OF-SELECTION.
*----------------------------------------------------------------------*
START-OF-SELECTION.

  "### 백그라운드 수행
  IF SY-BATCH = 'X'.
  

  "### 프론트 수행
  ELSE.


  ENDIF.
  
*----------------------------------------------------------------------*
* END-OF-SELECTION.
*----------------------------------------------------------------------*
END-OF-SELECTION.


*&---------------------------------------------------------------------*
*& ZPROGRAM_F01
*&---------------------------------------------------------------------*

*&---------------------------------------------------------------------*
*&      Form  MODIFY_SCREEN
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM MODIFY_SCREEN .

  %_S_SID_%_APP_%-TEXT   = 'SID'.

  LOOP AT SCREEN.
    IF SCREEN-NAME CP 'P_TEMP2*'.
      SCREEN-INPUT = '0'.
    ENDIF.
    MODIFY SCREEN.
  ENDLOOP.

ENDFORM.

*&---------------------------------------------------------------------*
*&      Form  MENU_SELECT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM MENU_SELECT .

  CASE SY-UCOMM.
  
    WHEN 'FC01'.
      ...
      
  ENDCASE.

ENDFORM.

*&---------------------------------------------------------------------*
*&      Form  MENU_BAR
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM MENU_BAR .

  FUNCTXT-ICON_ID = ICON_DISPLAY_TEXT.
  FUNCTXT-QUICKINFO = 'MBAR1'.
  FUNCTXT-ICON_TEXT = 'MBAR1'.
  SSCRFIELDS-FUNCTXT_01 = FUNCTXT.

ENDFORM.