본문 바로가기
ERP-SAP/ABAP

<ABAP> 월 팝업창 만드는 방법(F4 Help 년월 띄우는 법)

by 행복한워니의 기록 2011. 6. 9.
728x90
반응형

 



*----------------------------------------------------------------------*
* INITIALIZATION
*----------------------------------------------------------------------*
INITIALIZATION.
  PERFORM set_init.


*----------------------------------------------------------------------*
* AT SELECTION-SCREEN
*----------------------------------------------------------------------*
AT SELECTION-SCREEN OUTPUT.
  PERFORM modify_screen.


*----------------------------------------------------------------------*
* AT SELECTION-SCREEN
*----------------------------------------------------------------------*
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_month.
  PERFORM f4_popup_to_select_month.    <-스크린에 있는 p_month의 help를 달 예정이다.


*----------------------------------------------------------------------*
* START-OF-SELECTION
*----------------------------------------------------------------------*
START-OF-SELECTION.
  PERFORM get_purchase_ledger.
  PERFORM get_description.
  PERFORM assign_descritpion.


*----------------------------------------------------------------------*
* END-OF-SELECTION
*----------------------------------------------------------------------*
END-OF-SELECTION.
  PERFORM save_data.




저 부분의 소스는..

  *&---------------------------------------------------------------------*
*&      Form  f4_popup_to_select_month
*&---------------------------------------------------------------------*
*       Search help - Popup to choose a month
*----------------------------------------------------------------------*
FORM f4_popup_to_select_month .

  DATA:
    lt_dynpfields TYPE STANDARD TABLE OF dynpread,
    ls_dynpfields TYPE dynpread,

    l_subrc       TYPE sy-subrc,
    l_month       TYPE isellist-month,
    l_dyname      TYPE sy-cprog.

  FIELD-SYMBOLS:
    <month> TYPE ANY.

* Value of screen reading
  GET CURSOR FIELD ls_dynpfields-fieldname.   <-해당 찍은 필드 이름 p_month
  APPEND ls_dynpfields TO lt_dynpfieldsCLEAR ls_dynpfields.
  l_dyname sy-cprog.

  DO TIMES.
    CALL FUNCTION 'DYNP_VALUES_READ'
      EXPORTING
        dyname               l_dyname
        dynumb               sy-dynnr
      TABLES
        dynpfields           lt_dynpfields
      EXCEPTIONS
        invalid_abapworkarea 01
        invalid_dynprofield  02
        invalid_dynproname   03
        invalid_dynpronummer 04
        invalid_request      05
        no_fielddescription  06
        undefind_error       07.
    IF sy-subrc 3.
*     Current screen image is set of values
      l_dyname 'SAPLALDB'.
    ELSE.
      READ TABLE lt_dynpfields INTO ls_dynpfields INDEX 1.
*     Underscores replaced with blanks
      TRANSLATE ls_dynpfields-fieldvalue USING '_ '.
      EXIT.
    ENDIF.
  ENDDO.

  IF sy-subrc 0.
*   Conversion to internal format
    CALL FUNCTION 'CONVERSION_EXIT_PERI_INPUT'
      EXPORTING
        input  ls_dynpfields-fieldvalue
      IMPORTING
        output l_month.

    IF l_month IS INITIAL.
*     Month, initial => default value from Act. Date derived
      l_month sy-datlo+0(6).
    ENDIF.

    CALL FUNCTION 'POPUP_TO_SELECT_MONTH'  <- 여기서 팝업을 띄워준다..
      EXPORTING
        actual_month               l_month
      IMPORTING
        selected_month             l_month
        return_code                l_subrc
      EXCEPTIONS
        factory_calendar_not_found 1
        holiday_calendar_not_found 2
        month_not_found            3
        OTHERS                     4.
    IF sy-subrc AND l_subrc 0.
      ASSIGN (ls_dynpfields-fieldnameTO <month>.
      <month> l_month.
    ENDIF.
  ENDIF.

ENDFORM.                    " f4_popup_to_select_month



728x90
반응형