SAP ABAP POPUP YARDIM PENCERESİ HAZIRLAMAK


*-- F4 help for Payroll Administrator
AT SELECTION SCREEN ON VALUE REQUEST FOR P_SACHA.
    PERFORM VALUES_SACHA.
*-- F4 help for Pay Scale Group
AT SELECTION SCREEN ON VALUE REQUEST FOR P_TRFGR.
*-- F4 help for Pay Scale Level
AT SELECTION SCREEN ON VALUE REQUEST FOR P_TRFST.
*---------------------------------------------------------------------*
*      FORM  VALUES_SACHA
*---------------------------------------------------------------------*
*       Provide popup help for the Payroll Admin field
*---------------------------------------------------------------------*
FORM VALUES_SACHA.

  REFRESH: LTAB_DYNPSELECT,
           LTAB_DYNPVALUETAB.

  PERFORM READ_VALUE_FROM_SCREEN USING SY-REPID
                   SY-DYNNR
                   'PA0001-WERKS'
          CHANGING LTAB_DYNPSELECT-FLDNAME
                   LTAB_DYNPSELECT-FLDINH.

  APPEND LTAB_DYNPSELECT.

  LTAB_DYNPSELECT-FLDNAME = 'MANDT'.
  APPEND LTAB_DYNPSELECT.

  LTAB_DYNPSELECT-FLDNAME = 'SACHX'.
  APPEND LTAB_DYNPSELECT.

  PERFORM SHOW_HELP TABLES LTAB_DYNPSELECT
       LTAB_DYNPVALUETAB
 USING 'T526'
       'SACHX'
                  CHANGING PA0001-SACHA.

ENDFORM.         " VALUES_SACHA
*---------------------------------------------------------------------*
*       FORM VALUES_TRFGR
*---------------------------------------------------------------------*
*       Provide popup help for Pay Scale Group
*---------------------------------------------------------------------*
FORM VALUES_TRFGR.

  REFRESH: LTAB_DYNPSELECT,
           LTAB_DYNPVALUETAB.

  LTAB_DYNPSELECT-FLDNAME = 'MANDT'.
  APPEND LTAB_DYNPSELECT.

  LTAB_DYNPSELECT-FLDNAME = 'MOLGA'.
  SELECT SINGLE MOLGA FROM T001P
         INTO   LTAB_DYNPSELECT-FLDINH
          WHERE WERKS = *PA0001-WERKS
          AND   BTRTL = *PA0001-BTRTL.
  IF SY-SUBRC NE 0.
    LTAB_DYNPSELECT-FLDINH = SPACE.
  ENDIF.
  APPEND LTAB_DYNPSELECT.

  LTAB_DYNPSELECT-FLDNAME = 'TRFAR'.
  LTAB_DYNPSELECT-FLDINH  = *PA0008-TRFAR.
  APPEND LTAB_DYNPSELECT.

  LTAB_DYNPSELECT-FLDNAME = 'TRFGB'.
  LTAB_DYNPSELECT-FLDINH  = *PA0008-TRFGB.
  APPEND LTAB_DYNPSELECT.

  LTAB_DYNPSELECT-FLDNAME = 'TRFKZ'.
  SELECT SINGLE TRFKZ FROM T503
         INTO  LTAB_DYNPSELECT-FLDINH
         WHERE PERSG = *PA0001-PERSG
         AND   PERSK = *PA0001-PERSK.
  IF SY-SUBRC NE 0.
    LTAB_DYNPSELECT-FLDINH = SPACE.
  ENDIF.
  APPEND LTAB_DYNPSELECT.

  LTAB_DYNPSELECT-FLDNAME = 'TRFGR'.
  LTAB_DYNPSELECT-FLDINH  = SPACE.
  APPEND LTAB_DYNPSELECT.

  PERFORM SHOW_HELP TABLES LTAB_DYNPSELECT
       LTAB_DYNPVALUETAB
 USING 'T510'
       'TRFGR'
                  CHANGING PA0008-TRFGR.

  PERFORM UPDATE_VALUE_ON_SCREEN USING SY-REPID
                   SY-DYNNR
                   'PA0008-TRFGR'
                   PA0008-TRFGR.

ENDFORM.         " VALUES_TRFGR
*---------------------------------------------------------------------*
*      FORM  VALUES_TRFST 
*---------------------------------------------------------------------*
*       Provide popup help for Pay Scale Area
*---------------------------------------------------------------------*
FORM VALUES_TRFST.

  REFRESH: LTAB_DYNPSELECT,
           LTAB_DYNPVALUETAB.

  LTAB_DYNPSELECT-FLDNAME = 'MANDT'.
  APPEND LTAB_DYNPSELECT.

  LTAB_DYNPSELECT-FLDNAME = 'MOLGA'.
  SELECT SINGLE MOLGA FROM T001P
         INTO   LTAB_DYNPSELECT-FLDINH
          WHERE WERKS = *PA0001-WERKS
          AND   BTRTL = *PA0001-BTRTL.
  IF SY-SUBRC NE 0.
    LTAB_DYNPSELECT-FLDINH = SPACE.
  ENDIF.
  APPEND LTAB_DYNPSELECT.

  LTAB_DYNPSELECT-FLDNAME = 'TRFAR'.
  LTAB_DYNPSELECT-FLDINH  = *PA0008-TRFAR.
  APPEND LTAB_DYNPSELECT.

  LTAB_DYNPSELECT-FLDNAME = 'TRFGB'.
  LTAB_DYNPSELECT-FLDINH  = *PA0008-TRFGB.
  APPEND LTAB_DYNPSELECT.

  LTAB_DYNPSELECT-FLDNAME = 'TRFKZ'.
  SELECT SINGLE TRFKZ FROM T503
         INTO  LTAB_DYNPSELECT-FLDINH
         WHERE PERSG = *PA0001-PERSG
         AND   PERSK = *PA0001-PERSK.
  IF SY-SUBRC NE 0.
    LTAB_DYNPSELECT-FLDINH = SPACE.
  ENDIF.
  APPEND LTAB_DYNPSELECT.

  PERFORM READ_VALUE_FROM_SCREEN USING SY-REPID
                   SY-DYNNR
                   'PA0008-TRFGR'
          CHANGING LTAB_DYNPSELECT-FLDNAME
                   LTAB_DYNPSELECT-FLDINH.

  APPEND LTAB_DYNPSELECT.

  LTAB_DYNPSELECT-FLDNAME = 'TRFST'.
  LTAB_DYNPSELECT-FLDINH  = SPACE.
  APPEND LTAB_DYNPSELECT.

  PERFORM SHOW_HELP TABLES LTAB_DYNPSELECT
       LTAB_DYNPVALUETAB
 USING 'T510'
       'TRFST'
                  CHANGING PA0008-TRFST.

  PERFORM UPDATE_VALUE_ON_SCREEN USING SY-REPID
                   SY-DYNNR
                   'PA0008-TRFST'
                   PA0008-TRFST.

ENDFORM.                 " VALUES_TRFST  
*---------------------------------------------------------------------*
*       FORM SHOW_HELP        *
*---------------------------------------------------------------------*
*       ........              *
*---------------------------------------------------------------------*
*  -->  FTAB_DYNPSELECT       *
*  -->  FTAB_DYNPVALUETAB     *
*  -->  FSTR_HELP_INFO        *
*  -->  F_NEWVALUE            *
*---------------------------------------------------------------------*
FORM SHOW_HELP TABLES FTAB_DYNPSELECT   STRUCTURE DSELC
  FTAB_DYNPVALUETAB STRUCTURE DVAL
               USING  F_CHECKTABLE      LIKE HELP_INFO-CHECKTABLE
  F_CHECKFIELD      LIKE HELP_INFO-CHECKFIELD
             CHANGING F_NEWVALUE.

  DATA: LSTR_HELP_INFO LIKE HELP_INFO.
  DATA: LC_SELECTION_VALUE LIKE HELP_INFO-FLDVALUE.
  DATA: LC_SELECTION(1)    TYPE C.

*-- Fill in fields required for help function call
  LSTR_HELP_INFO-CALL       = 'T'.
  LSTR_HELP_INFO-OBJECT     = 'F'.
  LSTR_HELP_INFO-SPRAS      = SY-LANGU.
  LSTR_HELP_INFO-CHECKTABLE = F_CHECKTABLE.
  LSTR_HELP_INFO-CHECKFIELD = F_CHECKFIELD.

  CALL FUNCTION 'HELP_START'
       EXPORTING
            HELP_INFOS   = LSTR_HELP_INFO
       IMPORTING
            SELECTION    = LC_SELECTION
            SELECT_VALUE = LC_SELECTION_VALUE
       TABLES
            DYNPSELECT   = FTAB_DYNPSELECT
            DYNPVALUETAB = FTAB_DYNPVALUETAB
       EXCEPTIONS
            OTHERS       = 1.

  IF LC_SELECTION NE SPACE AND SY-SUBRC = 0.
    F_NEWVALUE = LC_SELECTION_VALUE.
  ENDIF.

ENDFORM.           " SHOW_HELP

*---------------------------------------------------------------------*
*       FORM READ_VALUE_FROM_SCREEN               *
*---------------------------------------------------------------------*
*       ........              *
*---------------------------------------------------------------------*
*  -->  F_REPID               *
*  -->  F_DYNNR               *
*  -->  VALUE(F_FIELDNAME_IN) *
*  -->  F_FIELDNAME_OUT       *
*  -->  F_FIELDVALUE          *
*---------------------------------------------------------------------*
FORM READ_VALUE_FROM_SCREEN USING F_REPID
              F_DYNNR
              VALUE(F_FIELDNAME_IN)
     CHANGING F_FIELDNAME_OUT
              F_FIELDVALUE.

  DATA: LTAB_FIELDS LIKE DYNPREAD OCCURS 0 WITH HEADER LINE.
  DATA: LC_DYNAME LIKE SY-REPID.
  DATA: LC_DYNUMB LIKE SY-DYNNR.
  DATA: LC_DUMMY(1) TYPE C.

*-- Read the screen to see if the user has entered a value for WERKS
  LTAB_FIELDS-FIELDNAME = F_FIELDNAME_IN.
  append ltab_fields.

  LC_DYNAME = F_REPID.
  LC_DYNUMB = F_DYNNR.

  CALL FUNCTION 'DYNP_VALUES_READ'
       EXPORTING
            DYNAME     = LC_DYNAME
            DYNUMB     = LC_DYNUMB
       TABLES
            dynpfields = ltab_fields
       EXCEPTIONS
            OTHERS     = 01.
  read table ltab_fields index 1.
*-- Return the value from the screen
  IF SY-SUBRC EQ 0.
    SPLIT LTAB_FIELDS-FIELDNAME AT '-'
          INTO LC_DUMMY
          F_FIELDNAME_OUT.
    F_FIELDVALUE = LTAB_FIELDS-FIELDVALUE.
  ENDIF.

ENDFORM.           " READ_VALUE_FROM_SCREEN
*---------------------------------------------------------------------*
*       FORM UPDATE_VALUE_ON_SCREEN               *
*---------------------------------------------------------------------*
*       The PROCESS ON VALUE-REQUEST does not always return blanks.   *
*       If a blank value is to be returned, this routine must be      *
*       called.
*---------------------------------------------------------------------*
*  -->  F_REPID               *
*  -->  F_DYNNR               *
*  -->  VALUE(F_FIELDNAME)    *
*  -->  F_FIELDVALUE          *
*---------------------------------------------------------------------*
FORM UPDATE_VALUE_ON_SCREEN USING F_REPID
              F_DYNNR
              VALUE(F_FIELDNAME)
              F_FIELDVALUE.

  DATA: LTAB_FIELDS LIKE DYNPREAD OCCURS 0 WITH HEADER LINE.

  DATA: LC_DYNAME LIKE SY-REPID.
  DATA: LC_DYNUMB LIKE SY-DYNNR.

  LC_DYNAME = SY-REPID.
  LC_DYNUMB = SY-DYNNR.

  LTAB_FIELDS-FIELDNAME  = F_FIELDNAME.
  LTAB_FIELDS-FIELDVALUE = F_FIELDVALUE.
  APPEND LTAB_FIELDS.

  CALL FUNCTION 'DYNP_VALUES_UPDATE'
       EXPORTING
            DYNAME     = LC_DYNAME
            DYNUMB     = LC_DYNUMB
       TABLES
            DYNPFIELDS = LTAB_FIELDS
       EXCEPTIONS
            OTHERS     = 8.

ENDFORM.           " UPDATE_VALUE_ON_SCREEN