Search This Blog

Search This Blog

CONVERSION_EXIT_ALPHA_INPUT

REPORT  ZCLASS_G17.

TABLES VBAK.

SELECT-OPTIONS S_VBELN FOR VBAK-VBELN.

DATA: BEGIN OF IT_VBAK OCCURS 0,
        VBELN LIKE VBAK-VBELN,
        ERDAT LIKE VBAK-ERDAT,
        ERNAM LIKE VBAK-ERNAM,
        KUNNR LIKE VBAK-KUNNR,
        NETWR LIKE VBAK-NETWR,
      END OF IT_VBAK.


DATA IT_VBAP LIKE VBAP OCCURS 0 WITH HEADER LINE.

TYPE-POOLS SLIS.

DATA IT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV.
DATA WA_FIELDCAT TYPE SLIS_FIELDCAT_ALV.

DATA WA_LAYOUT TYPE SLIS_LAYOUT_ALV.

DATA IT_SORT TYPE SLIS_T_SORTINFO_ALV.
DATA WA_SORT TYPE SLIS_SORTINFO_ALV.

START-OF-SELECTION.

  SELECT VBELN
         ERDAT
         ERNAM
         KUNNR
         NETWR INTO TABLE IT_VBAK
               FROM VBAK
               WHERE VBELN IN S_VBELN.

END-OF-SELECTION.

  PERFORM BUILD_FIELDS USING 'VBELN' 'Sales Doc' 'X' 20 ' ' ' ' ' '.

  PERFORM BUILD_FIELDS USING 'ERDAT' 'Date' ' ' 10 '__-__-____' ' ' ' '.

  PERFORM BUILD_FIELDS USING 'ERNAM' 'User' ' ' ' ' ' ' ' ' ' '.

  PERFORM BUILD_FIELDS USING 'KUNNR' 'Customer' ' ' ' ' ' ' 'C710' ' '.

  PERFORM BUILD_FIELDS USING 'NETWR' 'Amount' ' ' ' ' ' ' ' ' 'X'.


*---
  WA_LAYOUT-ZEBRA = 'X'.
  WA_LAYOUT-COLWIDTH_OPTIMIZE = 'X'.

*--
  WA_SORT-FIELDNAME = 'KUNNR'.
  WA_SORT-UP = 'X'.
  WA_SORT-SUBTOT = 'X'.

  APPEND WA_SORT TO IT_SORT.

*--
  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
   EXPORTING
*   I_INTERFACE_CHECK                 = ' '
*   I_BYPASSING_BUFFER                = ' '
*   I_BUFFER_ACTIVE                   = ' '
   I_CALLBACK_PROGRAM                = SY-CPROG
   I_CALLBACK_PF_STATUS_SET          = 'ALV_PF'
   I_CALLBACK_USER_COMMAND           = 'SECOND_LIST'
     I_CALLBACK_TOP_OF_PAGE            = 'TOP_PAGE'
*   I_CALLBACK_HTML_TOP_OF_PAGE       = ' '
*   I_CALLBACK_HTML_END_OF_LIST       = ' '
*   I_STRUCTURE_NAME                  =
*   I_BACKGROUND_ID                   = ' '
*   I_GRID_TITLE                      =
*   I_GRID_SETTINGS                   =
     IS_LAYOUT                         = WA_LAYOUT
     IT_FIELDCAT                       = IT_FIELDCAT
*   IT_EXCLUDING                      =
*   IT_SPECIAL_GROUPS                 =
*   IT_SORT                           = IT_SORT
*   IT_FILTER                         =
*   IS_SEL_HIDE                       =
*   I_DEFAULT                         = 'X'
*   I_SAVE                            = ' '
*   IS_VARIANT                        =
*   IT_EVENTS                         =
*   IT_EVENT_EXIT                     =
*   IS_PRINT                          =
*   IS_REPREP_ID                      =
*   I_SCREEN_START_COLUMN             = 0
*   I_SCREEN_START_LINE               = 0
*   I_SCREEN_END_COLUMN               = 0
*   I_SCREEN_END_LINE                 = 0
*   I_HTML_HEIGHT_TOP                 = 0
*   I_HTML_HEIGHT_END                 = 0
*   IT_ALV_GRAPHICS                   =
*   IT_HYPERLINK                      =
*   IT_ADD_FIELDCAT                   =
*   IT_EXCEPT_QINFO                   =
*   IR_SALV_FULLSCREEN_ADAPTER        =
* IMPORTING
*   E_EXIT_CAUSED_BY_CALLER           =
*   ES_EXIT_CAUSED_BY_USER            =
    TABLES
      T_OUTTAB                          = IT_VBAK
* EXCEPTIONS
*   PROGRAM_ERROR                     = 1
*   OTHERS                            = 2
            .
  IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.


*&---------------------------------------------------------------------*
*&      Form  TOP_PAGE
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
FORM TOP_PAGE.

  DATA IT_HEADER TYPE  SLIS_T_LISTHEADER.
  DATA WA_HEADER TYPE SLIS_LISTHEADER.

  WA_HEADER-TYP = 'H'.
  WA_HEADER-INFO = 'Sales Document Header Details'.

  APPEND WA_HEADER TO IT_HEADER.


  WA_HEADER-TYP = 'S'.
  WA_HEADER-INFO = 'Sales Document Header Details'.

  APPEND WA_HEADER TO IT_HEADER.


  WA_HEADER-TYP = 'A'.
  WA_HEADER-INFO = 'Sales Document Header Details'.

  APPEND WA_HEADER TO IT_HEADER.



  CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
    EXPORTING
      IT_LIST_COMMENTARY       = IT_HEADER
   I_LOGO                   = 'ZG01'
*   I_END_OF_LIST_GRID       =
*   I_ALV_FORM               =
            .

ENDFORM.                    "TOP_PAGE
*&---------------------------------------------------------------------*
*&      Form  BUILD_FIELDS
*&---------------------------------------------------------------------*
FORM BUILD_FIELDS  USING    VALUE(P_0081)
                            VALUE(P_0082)
                            VALUE(P_0083)
                            VALUE(P_20)
                            VALUE(P_0085)
                            VALUE(P_0086)
                            VALUE(P_0087).

  WA_FIELDCAT-FIELDNAME =  P_0081.
  WA_FIELDCAT-SELTEXT_L = P_0082.
  WA_FIELDCAT-KEY = P_0083.
  WA_FIELDCAT-OUTPUTLEN = P_20.
  WA_FIELDCAT-EDIT_MASK = P_0085.
  WA_FIELDCAT-EMPHASIZE = P_0086.
  WA_FIELDCAT-DO_SUM = P_0087.


  APPEND WA_FIELDCAT TO IT_FIELDCAT.
  CLEAR WA_FIELDCAT.

ENDFORM.                    " BUILD_FIELDS

*&---------------------------------------------------------------------*
*&      Form  SECOND_LIST
*&---------------------------------------------------------------------*
FORM SECOND_LIST USING LV_UCOMM TYPE SY-UCOMM
                       LV_FIELD TYPE SLIS_SELFIELD.

*  DATA L_VBELN(10) TYPE N.
*  IF LV_UCOMM EQ '&IC1' OR LV_UCOMM EQ 'VBAP'.
*
*    IF LV_FIELD-FIELDNAME EQ 'VBELN'.
*      L_VBELN = LV_FIELD-VALUE.

*      SELECT * FROM VBAP INTO TABLE IT_VBAP WHERE VBELN EQ L_VBELN.

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
  EXPORTING
    INPUT         = LV_FIELD-VALUE
 IMPORTING
    OUTPUT        = IT_VBAK-VBELN.

 SELECT * FROM VBAP INTO TABLE IT_VBAP
                          WHERE VBELN EQ IT_VBAK-VBELN.

      REFRESH IT_FIELDCAT[].

      CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
       EXPORTING
         I_PROGRAM_NAME               = SY-CPROG
         I_INTERNAL_TABNAME           = 'IT_VBAP'
         I_STRUCTURE_NAME             = 'VBAP'
*   I_CLIENT_NEVER_DISPLAY       = 'X'
*   I_INCLNAME                   =
*   I_BYPASSING_BUFFER           =
*   I_BUFFER_ACTIVE              =
        CHANGING
          CT_FIELDCAT                  = IT_FIELDCAT
* EXCEPTIONS
*   INCONSISTENT_INTERFACE       = 1
*   PROGRAM_ERROR                = 2
*   OTHERS                       = 3
                .
      IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.



      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
       EXPORTING
*   I_INTERFACE_CHECK                 = ' '
*   I_BYPASSING_BUFFER                = ' '
*   I_BUFFER_ACTIVE                   = ' '
   I_CALLBACK_PROGRAM                = SY-CPROG
*   I_CALLBACK_PF_STATUS_SET          = ' '
*   I_CALLBACK_USER_COMMAND           = ' '
   I_CALLBACK_TOP_OF_PAGE            = 'TOP_PAGE'
*   I_CALLBACK_HTML_TOP_OF_PAGE       = ' '
*   I_CALLBACK_HTML_END_OF_LIST       = ' '
*   I_STRUCTURE_NAME                  =
*   I_BACKGROUND_ID                   = ' '
*   I_GRID_TITLE                      =
*   I_GRID_SETTINGS                   =
*   IS_LAYOUT                         =
         IT_FIELDCAT                       = IT_FIELDCAT
*   IT_EXCLUDING                      =
*   IT_SPECIAL_GROUPS                 =
*   IT_SORT                           =
*   IT_FILTER                         =
*   IS_SEL_HIDE                       =
*   I_DEFAULT                         = 'X'
*   I_SAVE                            = ' '
*   IS_VARIANT                        =
*   IT_EVENTS                         =
*   IT_EVENT_EXIT                     =
*   IS_PRINT                          =
*   IS_REPREP_ID                      =
*   I_SCREEN_START_COLUMN             = 0
*   I_SCREEN_START_LINE               = 0
*   I_SCREEN_END_COLUMN               = 0
*   I_SCREEN_END_LINE                 = 0
*   I_HTML_HEIGHT_TOP                 = 0
*   I_HTML_HEIGHT_END                 = 0
*   IT_ALV_GRAPHICS                   =
*   IT_HYPERLINK                      =
*   IT_ADD_FIELDCAT                   =
*   IT_EXCEPT_QINFO                   =
*   IR_SALV_FULLSCREEN_ADAPTER        =
* IMPORTING
*   E_EXIT_CAUSED_BY_CALLER           =
*   ES_EXIT_CAUSED_BY_USER            =
        TABLES
          T_OUTTAB                          = IT_VBAP
* EXCEPTIONS
*   PROGRAM_ERROR                     = 1
*   OTHERS                            = 2
                .
      IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.


*    ENDIF.

*  ENDIF.


ENDFORM.                    "SECOND_LIST

*&---------------------------------------------------------------------*
*&      Form  ALV_PF
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      -->LV_TABLE   text
*----------------------------------------------------------------------*
FORM ALV_PF USING LV_TABLE TYPE SLIS_T_EXTAB.

  SET PF-STATUS 'ZG17'.

ENDFORM.                    "ALV_PF






































CLICK ON