Alv report scenarios for PP?

anyone let me know the ALV report scenarios for Production planning?
Also, let me know the exits in PP? thanku.

hi,
these are the exits related to production order.
Exit name
CCOWB001
COIB0001
COZF0001
COZF0002
PPCO0001
PPCO0002
PPCO0003
PPCO0004
PPCO0005
PPCO0006
PPCO0007
PPCO0008
PPCO0009
PPCO0010
PPCO0012
PPCO0013
PPCO0015
PPCO0016
PPCO0017
PPCO0018
PPCO0019
PPCO0021
PPCO0022
PPCO0023
STATTEXT
just go through the TCODE COOIS for the alv report scenarios
reward if helpful.
Regards.
Praveen

Similar Messages

  • Sample ALV report required for FI module

    Hello friends,
    I am develoing ALV report for FI module for that i need some sample ALV report. If someone have than please send it to me.
    Thanx & Regards,
    Rahul Talele

    HI,
    SEE THE SAMPLE REPORT
                 Fringe Benefit Tax Report
    Program Name            :
    Object ID               :
    Functional Analyst      :
    Programmer              :
    Start date              :
    Initial CTS             :
    Description             : FRINGE Benefit Tax
    Includes                :
    Function Modules        :
    Logical database        :
    Transaction Code        :
    External references     :
                       Modification Log
    Date      | Modified by    | CTS number   | Comments
              |                |              | Initial Version          *
    REPORT  ZFI_FBT NO STANDARD PAGE HEADING LINE-SIZE 255.
    TYPE-POOLS: SLIS.
    TYPES : BEGIN OF
      T_BSIS,
              BUKRS TYPE BUKRS,         " Company Code
              HKONT TYPE HKONT,         " General Ledger Account
              GJAHR TYPE GJAHR,
              BELNR TYPE BELNR_D,       " Accounting Document Number
              BUDAT TYPE BUDAT,         " Posting Date in the Document
              BLDAT TYPE BLDAT,         " Document Date in Document
              XBLNR TYPE XBLNR1,        " Reference Document Number
              BSCHL TYPE BSCHL,         " Posting Key
              DMBTR TYPE DMBTR,         " Amount in Local Currency
              AUFNR TYPE AUFNR_NEU,     " Order Number
              NONFBT TYPE DMBTR,        " non fbt amount
              SUBFBT TYPE DMBTR,        " subject to fbt amount
              ZFI_FBT TYPE ZFI_FBT,     " Qualifying amount.
              AMOUNT TYPE DMBTR,
              FBTPAY TYPE DMBTR,
              ZFI_PAY TYPE ZFI_PAY,
            END OF T_BSIS,
            T_IT_BSIS TYPE STANDARD TABLE OF T_BSIS.
    TYPES : BEGIN OF T_FRINGE,
               ZFI_HKONT TYPE HKONT,
               ZFI_FBT TYPE ZFI_FBT,
               ZFI_PAY TYPE ZFI_PAY,
            END OF T_FRINGE,
            T_IT_FRINGE TYPE STANDARD TABLE OF T_FRINGE.
    DATA  : GIT_FRINGE TYPE T_IT_FRINGE,
            GWA_FRINGE TYPE T_FRINGE.
    DATA  : GIT_BSIS TYPE T_IT_BSIS,
            GWA_BSIS TYPE T_BSIS.
    DATA  : G_HKONT TYPE HKONT,
            G_BUDAT TYPE BUDAT,
            G_AUFNR TYPE AUFNR_NEU.
    FIELD-SYMBOLS : <BSIS> TYPE T_BSIS.
    DATA : G_REPID TYPE SY-REPID,
           GIT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
           GWA_FIELDCAT TYPE SLIS_FIELDCAT_ALV,
           GT_SORT TYPE SLIS_T_SORTINFO_ALV,
           GT_EVENTS TYPE SLIS_T_EVENT,
           GT_LIST_TOP_OF_PAGE TYPE SLIS_T_LISTHEADER,
           GS_LAYOUT TYPE SLIS_LAYOUT_ALV.
    GS_LAYOUT-ZEBRA = 'X'.
    GS_LAYOUT-COLWIDTH_OPTIMIZE = 'X'.
    CONSTANTS : C_50(2) TYPE C VALUE '50'.
      SELECTION SCREEN DEFINITIONS
    SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
    PARAMETERS     : P_BUKRS TYPE BUKRS DEFAULT 'H901' OBLIGATORY.
    SELECT-OPTIONS : S_HKONT FOR G_HKONT,
                     S_BUDAT FOR G_BUDAT.
    *PARAMETERS     : P_AUFNR TYPE AUFNR_NEU DEFAULT '000000100001' OBLIGATORY.
    SELECTION-SCREEN END OF BLOCK B1.
      EVENTS
      INITIALIZATION.
    INITIALIZATION.
      G_REPID = SY-REPID.
      AT SELECTION-SCREEN
    AT SELECTION-SCREEN.
      PERFORM GET_ZTABLE.         " get data from ZFII_FRINGE table
      START-OF-SELECTION.
    START-OF-SELECTION.
      PERFORM GET_DATA.           "  get data from BSIS table
      IF NOT GIT_BSIS IS INITIAL.
        PERFORM GET_PERCENTAGE.   " to get the percentages from table ZFII_FRINGE
        PERFORM CHK4_INTERNAL.    " checking for the posting key wheather th document is reversed
        " and checking wheather internal order is FBT or non-FBT
      ENDIF.
      END-OF-SELECTION.
    END-OF-SELECTION.
      IF NOT GIT_BSIS IS INITIAL.
        PERFORM DISPLAY.        " display ALV GRID display
      ENDIF.
    *&      Form  get_data
          text
    -->  p1        text
    <--  p2        text
    FORM GET_DATA .
      SELECT
             BUKRS
             HKONT
             GJAHR
             BELNR
             BUDAT
             BLDAT
             XBLNR
             BSCHL
             DMBTR
             AUFNR FROM BSIS
                   INTO TABLE GIT_BSIS
                   WHERE BUKRS EQ P_BUKRS AND
                         HKONT IN S_HKONT AND
                         BUDAT IN S_BUDAT.
      IF SY-SUBRC NE 0.
        MESSAGE I000(ZFI) WITH 'No data exist'.
        EXIT.
      ENDIF.
    ENDFORM.                    " get_data
    *&      Form  display
    FORM DISPLAY .
      PERFORM BUILD_FIELD_CATALOUGE.
      PERFORM GET_EVENTS.
      PERFORM DETERMINE_SORT_SEQUENCE.
      PERFORM SUB_COMMENTERY_BUILD.
      PERFORM ALV_DISPLAY.
    ENDFORM.                    " display
    *&      Form  build_field_catalouge
    FORM BUILD_FIELD_CATALOUGE.
      DATA : L_POS TYPE I.
      L_POS = 1 .
      PERFORM INIT_FIELD_CATALOG USING GIT_FIELDCAT[]  " Field Catalog
                                        L_POS          " Column Position
                                       'HKONT'         " InTab Field Name
                                       'GIT_BSIS'      " InTab Name
                                       '10'            " Output Length
                                       'GL Account'  " Column Name Text
                                       ' '             " Datatype
                                       'X'             " Key?
                                       '1'             " Row Position
                                       ' '             " Hotspot
                                       ' '             " Emphasize
                                       ' '             " key_sel
                                       ' '             " justification
                                       ' '.            " Sum field?
      L_POS = L_POS + 1 .
      PERFORM INIT_FIELD_CATALOG USING GIT_FIELDCAT[]  " Field Catalog
                                        L_POS          " Column Position
                                       'BELNR'         " InTab Field Name
                                       'GIT_BSIS'      " InTab Name
                                       '10'            " Output Length
                                       'Document No.'  " Column Name Text
                                       ' '             " Datatype
                                       'X'             " Key?
                                       '1'             " Row Position
                                       'X'             " Hotspot
                                       ' '             " Emphasize
                                       ' '             " key_sel
                                       ' '             " justification
                                       ' '.            " Sum field?
      L_POS = L_POS + 1 .
      PERFORM INIT_FIELD_CATALOG USING GIT_FIELDCAT[]  " Field Catalog
                                        L_POS          " Column Position
                                       'BUDAT'         " InTab Field Name
                                       'GIT_BSIS'      " InTab Name
                                       '10'             " Output Length
                                       'Posting Date'             " Column Name Text
                                       ' '             " Datatype
                                       ' '             " Key?
                                       '1'             " Row Position
                                       ' '             " Hotspot
                                       ' '             " Emphasize
                                       ' '             " key_sel
                                       ' '             " justification
                                       ' '.            " Sum field?
      L_POS = L_POS + 1 .
      PERFORM INIT_FIELD_CATALOG USING GIT_FIELDCAT[]  " Field Catalog
                                        L_POS          " Column Position
                                       'BLDAT'         " InTab Field Name
                                       'GIT_BSIS'      " InTab Name
                                       '10'             " Output Length
                                       'Docu. Date'             " Column Name Text
                                       ' '             " Datatype
                                       ' '             " Key?
                                       '1'             " Row Position
                                       ' '             " Hotspot
                                       ' '             " Emphasize
                                       ' '             " key_sel
                                       ' '             " justification
                                       ' '.            " Sum field?
      L_POS = L_POS + 1 .
      PERFORM INIT_FIELD_CATALOG USING GIT_FIELDCAT[]  " Field Catalog
                                        L_POS          " Column Position
                                       'XBLNR'         " InTab Field Name
                                       'GIT_BSIS'      " InTab Name
                                       '16'             " Output Length
                                       'Ref. Doc. Number'             " Column Name Text
                                       ' '             " Datatype
                                       ' '             " Key?
                                       '1'             " Row Position
                                       ' '             " Hotspot
                                       ' '             " Emphasize
                                       ' '             " key_sel
                                       ' '             " justification
                                       'X'.            " Sum field?
      L_POS = L_POS + 1 .
      PERFORM INIT_FIELD_CATALOG USING GIT_FIELDCAT[]  " Field Catalog
                                        L_POS          " Column Position
                                       'DMBTR'         " InTab Field Name
                                       'GIT_BSIS'      " InTab Name
                                       '16'             " Output Length
                                       'Gross Amount'             " Column Name Text
                                       ' '             " Datatype
                                       ' '             " Key?
                                       '1'             " Row Position
                                       ' '             " Hotspot
                                       ' '             " Emphasize
                                       ' '             " key_sel
                                       ' '             " justification
                                       'X'.            " Sum field?
      L_POS = L_POS + 1 .
      PERFORM INIT_FIELD_CATALOG USING GIT_FIELDCAT[]  " Field Catalog
                                        L_POS          " Column Position
                                       'SUBFBT'         " InTab Field Name
                                       'GIT_BSIS'      " InTab Name
                                       '16'             " Output Length
                                       'FBT Amount'             " Column Name Text
                                       ' '             " Datatype
                                       ' '             " Key?
                                       '1'             " Row Position
                                       ' '             " Hotspot
                                       ' '             " Emphasize
                                       ' '             " key_sel
                                       ' '             " justification
                                       'X'.            " Sum field?
      L_POS = L_POS + 1 .
      PERFORM INIT_FIELD_CATALOG USING GIT_FIELDCAT[]  " Field Catalog
                                        L_POS          " Column Position
                                       'NONFBT'         " InTab Field Name
                                       'GIT_BSIS'      " InTab Name
                                       '16'             " Output Length
                                       'Non FBT Amount'             " Column Name Text
                                       ' '             " Datatype
                                       ' '             " Key?
                                       '1'             " Row Position
                                       ' '             " Hotspot
                                       ' '             " Emphasize
                                       ' '             " key_sel
                                       ' '             " justification
                                       'X'.            " Sum field?
      L_POS = L_POS + 1 .
      PERFORM INIT_FIELD_CATALOG USING GIT_FIELDCAT[]  " Field Catalog
                                        L_POS          " Column Position
                                       'ZFI_FBT'         " InTab Field Name
                                       'GIT_BSIS'      " InTab Name
                                       '12'            " Output Length
                                       'Percentage'    " Column Name Text
                                       ' '              " Datatype
                                       ' '             " Key?
                                       '1'             " Row Position
                                       ' '             " Hotspot
                                       ' '             " Emphasize
                                       ' '             " key_sel
                                       ' '             " justification
                                       ' '.            " Sum field?
      L_POS = L_POS + 1 .
      PERFORM INIT_FIELD_CATALOG USING GIT_FIELDCAT[]  " Field Catalog
                                        L_POS          " Column Position
                                       'AMOUNT'        " InTab Field Name
                                       'GIT_BSIS'      " InTab Name
                                       '16'            " Output Length
                                       'Qualifying Amount'  " Column Name Text
                                       ' '             " Datatype
                                       ' '             " Key?
                                       '1'             " Row Position
                                       ' '             " Hotspot
                                       ' '             " Emphasize
                                       ' '             " key_sel
                                       ' '             " justification
                                       'X'.            " Sum field?
      L_POS = L_POS + 1 .
      PERFORM INIT_FIELD_CATALOG USING GIT_FIELDCAT[]  " Field Catalog
                                        L_POS          " Column Position
                                       'FBTPAY'         " InTab Field Name
                                       'GIT_BSIS'      " InTab Name
                                       '12'            " Output Length
                                       'FBT payable'   " Column Name Text
                                       ' '             " Datatype
                                       ' '             " Key?
                                       '1'             " Row Position
                                       ' '             " Hotspot
                                       ' '             " Emphasize
                                       ' '             " key_sel
                                       ' '             " justification
                                       'X'.            " Sum field?
    ENDFORM.                    " build_field_catalouge
    *&      Form  init_field_catalog
          text
    FORM INIT_FIELD_CATALOG  USING    P_GIT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV
                                      PV_POS       LIKE GWA_FIELDCAT-COL_POS
                                      PV_FIELDNAME LIKE GWA_FIELDCAT-FIELDNAME
                                      PV_TABNAME   LIKE GWA_FIELDCAT-TABNAME
                                      PV_OUTPUT    LIKE GWA_FIELDCAT-OUTPUTLEN
                                      PV_SELTEXT   LIKE GWA_FIELDCAT-SELTEXT_M
                                      PV_DATATYPE  LIKE GWA_FIELDCAT-DATATYPE
                                      PV_KEY       LIKE GWA_FIELDCAT-KEY
                                      PV_ROW       LIKE GWA_FIELDCAT-ROW_POS
                                      PV_HOTSPOT   LIKE GWA_FIELDCAT-HOTSPOT
                                      PV_EMPHASIZE LIKE GWA_FIELDCAT-EMPHASIZE
                                      PV_KEY_SEL   LIKE GWA_FIELDCAT-KEY_SEL
                                      PV_JUST      LIKE GWA_FIELDCAT-JUST
                                      PV_SUM       LIKE GWA_FIELDCAT-DO_SUM.
      DATA:  LT_FIELDCAT TYPE SLIS_FIELDCAT_ALV.
      LT_FIELDCAT-OUTPUTLEN     = PV_OUTPUT.
      LT_FIELDCAT-COL_POS       = PV_POS.
      LT_FIELDCAT-FIELDNAME     = PV_FIELDNAME.
      LT_FIELDCAT-TABNAME       = PV_TABNAME.
      LT_FIELDCAT-SELTEXT_M     = PV_SELTEXT.
      LT_FIELDCAT-KEY           = PV_KEY.
      LT_FIELDCAT-ROW_POS       = PV_ROW.
      LT_FIELDCAT-HOTSPOT       = PV_HOTSPOT.
      LT_FIELDCAT-EMPHASIZE     = PV_EMPHASIZE.
      LT_FIELDCAT-KEY_SEL       = PV_KEY_SEL.
      LT_FIELDCAT-DO_SUM        = PV_SUM.
      LT_FIELDCAT-JUST          = PV_JUST.
      LT_FIELDCAT-DATATYPE      = PV_DATATYPE.
      APPEND LT_FIELDCAT TO  P_GIT_FIELDCAT.
      CLEAR  LT_FIELDCAT.
    ENDFORM.                    " init_field_catalog
    *&      Form  alv_display
          text
    -->  p1        text
    <--  p2        text
    FORM ALV_DISPLAY .
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
       EXPORTING
        I_INTERFACE_CHECK                 = ' '
        I_BYPASSING_BUFFER                = ' '
        I_BUFFER_ACTIVE                   = ' '
          I_CALLBACK_PROGRAM                = G_REPID
         I_CALLBACK_PF_STATUS_SET          = 'SET_PF_STATUS'
         I_CALLBACK_USER_COMMAND           = 'USER_COMMAND'
        I_CALLBACK_TOP_OF_PAGE            = ' '
        I_CALLBACK_HTML_TOP_OF_PAGE       = ' '
        I_CALLBACK_HTML_END_OF_LIST       = ' '
        I_STRUCTURE_NAME                  =
        I_BACKGROUND_ID                   = ' '
        i_grid_title                      = 'Fringe Benefit Tax'
        I_GRID_SETTINGS                   =
         IS_LAYOUT                         = GS_LAYOUT
          IT_FIELDCAT                       = GIT_FIELDCAT
        IT_EXCLUDING                      =
        IT_SPECIAL_GROUPS                 =
         IT_SORT                           = GT_SORT
        IT_FILTER                         =
        IS_SEL_HIDE                       =
        I_DEFAULT                         = 'X'
        I_SAVE                            = ' '
        IS_VARIANT                        =
         IT_EVENTS                         = GT_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                          = GIT_BSIS
       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.
    ENDFORM.                    " alv_display
    *&      Form  chk4_internal
          text
    -->  p1        text
    <--  p2        text
    FORM CHK4_INTERNAL .
      LOOP AT GIT_BSIS ASSIGNING <BSIS>.
        IF <BSIS> IS ASSIGNED.
          IF  <BSIS>-BSCHL = C_50.
            <BSIS>-DMBTR = <BSIS>-DMBTR * -1.
          ENDIF.
       IF NOT <bsis>-aufnr IS INITIAL.
          IF <BSIS>-AUFNR = '000000100000'.         "    P_AUFNR.
            <BSIS>-SUBFBT = <BSIS>-DMBTR.
            <BSIS>-AMOUNT = ( <BSIS>-SUBFBT * <BSIS>-ZFI_FBT ) / 100.
          ELSE.
           IF <bsis>-aufnr = '000000100020'.
            <BSIS>-NONFBT = <BSIS>-DMBTR.
          ENDIF.
       ENDIF.
          <BSIS>-FBTPAY = ( <BSIS>-AMOUNT * <BSIS>-ZFI_PAY ) / 100.
        ENDIF.
      ENDLOOP.
      UNASSIGN <BSIS>.
    ENDFORM.                    " chk4_internal
    *&      Form  get_ztable
          text
    -->  p1        text
    <--  p2        text
    FORM GET_ZTABLE .
      REFRESH : GIT_FRINGE.
      SELECT   HKONT
               ZFI_FBT
               ZFI_PAY
                       FROM ZFI_FBT_DETL
                       INTO TABLE GIT_FRINGE
                     FOR ALL ENTRIES IN s_hkont
                       WHERE HKONT IN S_HKONT.
      CHECK SY-SUBRC EQ 0.
      SORT GIT_FRINGE BY ZFI_HKONT.
    ENDFORM.                    " get_ztable
    *&      Form  get_percentage
          text
    -->  p1        text
    <--  p2        text
    FORM GET_PERCENTAGE .
      CLEAR : GWA_FRINGE.
      LOOP AT GIT_BSIS ASSIGNING <BSIS>.
        IF <BSIS> IS ASSIGNED.
          READ TABLE GIT_FRINGE INTO GWA_FRINGE WITH KEY
                                                       ZFI_HKONT = <BSIS>-HKONT
                                                       BINARY SEARCH.
          CHECK SY-SUBRC EQ 0.
          <BSIS>-ZFI_FBT = GWA_FRINGE-ZFI_FBT.
          <BSIS>-ZFI_PAY = GWA_FRINGE-ZFI_PAY.
        ENDIF.
      ENDLOOP.
      UNASSIGN <BSIS>.
    ENDFORM.                    " get_percentage
    *&      Form  determine_sort_sequence
          text
    -->  p1        text
    <--  p2        text
    FORM DETERMINE_SORT_SEQUENCE .
      DATA : LS_SORT TYPE SLIS_SORTINFO_ALV.
      LS_SORT-SPOS = 1.                           " Sort order
      LS_SORT-FIELDNAME = 'HKONT'.
      LS_SORT-TABNAME = 'GIT_BSIS'.
      LS_SORT-UP = 'X'.
      LS_SORT-SUBTOT = 'X'.                      " Sub total allowed
      APPEND LS_SORT TO GT_SORT.
      CLEAR LS_SORT.
    ENDFORM.                    " determine_sort_sequence
    *&      Form  get_events
          text
    -->  p1        text
    <--  p2        text
    FORM GET_EVENTS .
      CONSTANTS:
      GC_FORMNAME_TOP_OF_PAGE TYPE SLIS_FORMNAME VALUE 'TOP_OF_PAGE',
      GC_FORMNAME_USER_COMMAND TYPE SLIS_FORMNAME VALUE 'USER_COMMAND'.
      DATA: LS_EVENT TYPE SLIS_ALV_EVENT.
      CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
        EXPORTING
          I_LIST_TYPE = 0
        IMPORTING
          ET_EVENTS   = GT_EVENTS.
      READ TABLE GT_EVENTS WITH KEY NAME =  SLIS_EV_TOP_OF_PAGE
                               INTO LS_EVENT.
      IF SY-SUBRC = 0.
        MOVE GC_FORMNAME_TOP_OF_PAGE TO LS_EVENT-FORM.
        APPEND LS_EVENT TO GT_EVENTS.
      ENDIF.
      READ TABLE GT_EVENTS WITH KEY NAME = SLIS_EV_USER_COMMAND
                               INTO LS_EVENT.
      IF SY-SUBRC = 0.
        MOVE GC_FORMNAME_USER_COMMAND TO LS_EVENT-FORM.
        APPEND LS_EVENT TO GT_EVENTS.
      ENDIF.
    ENDFORM.                    " get_events
    *&      Form  sub_commentery_build
          text
    -->  p1        text
    <--  p2        text
    FORM SUB_COMMENTERY_BUILD .
      DATA: LS_LINE TYPE SLIS_LISTHEADER.
      DATA : L_LOW  TYPE CHAR10,
            L_HIGH TYPE CHAR10,
            L_DATE TYPE CHAR25.
      CONCATENATE S_BUDAT-LOW6(2) '.' S_BUDAT-LOW4(2) '.' S_BUDAT-LOW+0(4) INTO  L_LOW.
      CONCATENATE S_BUDAT-HIGH6(2) '.' S_BUDAT-HIGH4(2) '.' S_BUDAT-HIGH+0(4) INTO  L_HIGH.
      CONCATENATE L_LOW  ' - ' L_HIGH INTO L_DATE.
    ***header
      CLEAR LS_LINE.
      LS_LINE-TYP  = 'H'.
    LS_LINE-KEY: not used for this type
      LS_LINE-INFO = 'Fringe Benefit Tax'.
      APPEND LS_LINE TO GT_LIST_TOP_OF_PAGE.
    ***Selection
      CLEAR LS_LINE.
      LS_LINE-TYP  = 'S'.
      LS_LINE-KEY  = 'Company Code'.
      LS_LINE-INFO = P_BUKRS.
      APPEND LS_LINE TO GT_LIST_TOP_OF_PAGE.
      CLEAR LS_LINE.
      LS_LINE-TYP  = 'S'.
      LS_LINE-KEY  = 'Posting Date'.
      LS_LINE-INFO = L_DATE.
      APPEND LS_LINE TO GT_LIST_TOP_OF_PAGE.
    ENDFORM.                    " sub_commentery_build
          FORM TOP_OF_PAGE                                              *
    When TOP-OF-PAGE will be fired , this event will be called and it
    will use the contents of i_list_top_of_page for output in the header
    FORM TOP_OF_PAGE.
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
           EXPORTING
               i_logo             = 'ENJOYSAP_LOGO'
                 IT_LIST_COMMENTARY = GT_LIST_TOP_OF_PAGE.
    ENDFORM.                    "top_of_page
    *&      Form  USER_COMMAND
    Called from within the ALV processes. Currently, '&IC1' is used to
    process the hotspot and display the document 'picked' by the user.
    FORM USER_COMMAND USING PV_UCOMM LIKE SY-UCOMM
                            SELFIELD TYPE SLIS_SELFIELD.
      CLEAR : GWA_BSIS.
      CASE PV_UCOMM.
        WHEN '&IC1'.
          READ TABLE GIT_BSIS INTO GWA_BSIS INDEX SELFIELD-TABINDEX.
          CASE SELFIELD-SEL_TAB_FIELD.
            WHEN 'GIT_BSIS-BELNR'.
              IF NOT GWA_BSIS-BELNR IS INITIAL.
                SET PARAMETER ID: 'BUK' FIELD GWA_BSIS-BUKRS,
                                  'BLN' FIELD GWA_BSIS-BELNR,
                                  'GJR' FIELD GWA_BSIS-GJAHR.
                CALL TRANSACTION 'FB03' AND SKIP FIRST SCREEN.
              ENDIF.
            WHEN OTHERS.
          ENDCASE.
        WHEN OTHERS.
      ENDCASE.
      CLEAR : GWA_BSIS.
    ENDFORM.                    "user_command
    *&      Form  SET_PF_STATUS
          text
    FORM SET_PF_STATUS USING EXTAB TYPE SLIS_T_EXTAB.
      SET PF-STATUS 'STANDARD_FULLSCREEN' OF PROGRAM 'SAPLKKBL'.
    ENDFORM.                    "SET_PF_STATUSENDFORM.                    "SET_PF_STATUS
    AWARD POINTS IF USEFUL....

  • ALV report requirement for peculiar SUBTOTAL

    The following table is required for ALV report for inventory calculation.
    The last column is the physical balance.
           No......A.......... B.......     C......D     (D=A+B-C)
            1......50........8........     2.......56     
            2...... 20.........3.........1......22     
            3.......56.........10.......6......     60     
         ........50........21......     9......     60  (SUBTOTAL ROW)     
    Requirement for the subtotal row:
    The subtotal for column A should be 50, It should take the first value 50 in the opening column in 1st row.
    The subtotal for D column should be 60, It should be same as the value 60, in the LAST row that is 60
    all other column subtotals are mathemetical totals as usual.
    thanx
    gaut
    Edited by: gautam gautam on May 6, 2009 1:31 AM

    Hi,
    Try this
    In side the loop
    at new matnr.
    capture the column1 (A)value into one variable
    at end of matnr
    capture the column 4 (D) value into one variable
    and print it in subtotal row
    Regards
    Krishna

  • Validation of data in editable ALV report output for particular field

    Hi Experts,
    I have one input enabled field in ALV output. How to validate the data once user enters  in that field and press enter? Is it possible to capture the value, hit the enter after user enters the data?
    Thanks,
    Surya Prakash

    Halo Prakash,
    1 First you should registeer the ENTER Event.
    call method g_grid->register_edit_event
                   exporting
                      i_event_id = cl_gui_alv_grid=>mc_evt_enter.
    2 Declare event handler method for Event data_changed of cl_gui_alv_grid.
    handle_data_changed
             for event data_changed of cl_gui_alv_grid
                 importing er_data_changed.
    3 Inside the Event handler method , you get the event parameter er_data_changed type ref to CL_ALV_CHANGED_DATA_PROTOCOL.
    loop at er_data_changed->mt_good_cells into ls_good.
          case ls_good-fieldname.
            when 'FIELD1'.
              call method check_FIELD1.
            when 'FIELD2 '.
              call method check_FIELD2
          endcase.
        endloop.
    4 Inside the Method check_FIELD1 and check_FIELD2 you can do the validation check .
    call method er_data_changed->get_cell_value( Passing the row no and field name).
    if the check  fails you can use add_protocol_entry to write the error.
    5 Finally call
    er_data_changed->display_protocol.
    Regards
    Arshad

  • In ALV report how to do this..

    Hi,
         I worte one zreport,  it displays the output in the Grid format.
         Goto tr code : coois-> give some material number u will get output in the grid format..->above the grid u will look the bar on that u will see  ENDUSER DOC, DISPLAY GRAPHIC, LAYOUT SETTINGS....
    My requirement is :  I have to add this bar to my grid report, please explain to me.
    Thanks and Regards,
    Surya

    Hi Jai.
    We can not display barcode in ALV but in Smartform  and Script is possible becuase we can set font "BARCODE" or any fonts to our variable.
    What you should do is create general ALV report ,Smatform for printing barcode and botton for call
    Smartform  in ALV program.When a line is selected and click botton then take data in that line and call
    Smartform for printing barcode that what I have done.
    Hope it help .
    SayC.

  • Issue in ALV Report

    Hi,
    I have a issue in ALV Report for displaying one field's data into output.
    I am getting data into all other fields in ALV Report except for this field.
    This field & related fields are declared as below: in final internal table.
    sta_no     TYPE z3status,
    status(10) TYPE c,
    Here z3status is of type Char(1).
    In Report
    I have put a condition :
    IF i_tab-sta_no EQ 1.
       i_tab-status = 'Created'.
    ELSE.
       i_tab-status = 'Closed'.
    ENDIF.
    and to field catalog also i am passing right information as for every other field in ALV Report.
    Till the point use of REUSE_ALV_LIST_DISPLAY F.M also final internal table is having status field filled.
    But in output nothing gets displayed for Status field.
    Can anybody tell me what can be the issue!
    Thanks in advance.
    Thanks,
    Deep.

    Hi,
    I have no problem in data fetching into final internal table.
    Everything is coming well to REUSE_ALV_DISPLAY F.M.
    But still Status field data is not getting displayed.
    I have posted some code for reference:
            LOOP AT t_z3manboxid INTO wa_z3manboxid.
              wa_result-manifest_no     = wa_z3manboxid-zmanno.
              wa_result-item_no         = wa_z3manboxid-item_no.
              IF l_item_no NE wa_z3manboxid-item_no.
                wa_result-piece_quantity  = wa_z3manboxid-vemng.
                wa_result-unit            = wa_z3manboxid-vemeh.
                wa_result-manifester      = wa_z3manboxid-usnam.
                wa_result-manifest_sta_no = wa_z3manboxid-z3status.
                IF wa_result-manifest_sta_no EQ 1.
                  wa_result-manifest_status = c_created.
                ELSEIF wa_result-manifest_sta_no EQ 2.
                  wa_result-manifest_status = c_in_transit.
                ELSEIF wa_result-manifest_sta_no EQ 3.
                  wa_result-manifest_status = c_arrived.
                ELSEIF wa_result-manifest_sta_no EQ 4.
                  wa_result-manifest_status = c_closed.
                ENDIF.
              ENDIF.
              l_item_no  = wa_z3manboxid-item_no.
              APPEND wa_result TO t_result.
              CLEAR: wa_result, wa_z3manboxid.
            ENDLOOP.
    Building field catalog following code is added:
    For status call is as below:
      PERFORM f_build_fieldcat  USING c_tab
                                      c_manifest_status
                                      c_space
                                      c_space
                                      c_mannf_status
                                      c_space1
                                      15.
    FORM f_build_fieldcat USING p_tabname p_fldname
                                p_rtabname p_rfldname
                                p_fldhdg p_check
                                p_length.
      CLEAR t_fieldcat_ln1.
      ADD 1 TO g_col_pos.
      t_fieldcat_ln1-tabname       = p_tabname.
      t_fieldcat_ln1-fieldname     = p_fldname.
      t_fieldcat_ln1-ref_tabname   = p_rtabname.
      t_fieldcat_ln1-ref_fieldname = p_rfldname.
      t_fieldcat_ln1-ddictxt       = c_l.
      t_fieldcat_ln1-seltext_l     = p_fldhdg.
      t_fieldcat_ln1-no_zero       = space.
      t_fieldcat_ln1-do_sum        = space.
      t_fieldcat_ln1-col_pos       = g_col_pos.
      t_fieldcat_ln1-no_out        = space.
      t_fieldcat_ln1-just          = c_c.
      t_fieldcat_ln1-qfieldname    = space.
      t_fieldcat_ln1-checkbox      = p_check.
      t_fieldcat_ln1-input         = p_check.
      t_fieldcat_ln1-reptext_ddic  = p_fldhdg.
      IF p_fldname EQ c_manno.
        t_fieldcat_ln1-key     = c_x.
        t_fieldcat_ln1-hotspot = c_x.
      ELSE.
        t_fieldcat_ln1-key     = space.
        t_fieldcat_ln1-hotspot = p_check.
      ENDIF.
      t_fieldcat_ln1-outputlen      = p_length.
      t_fieldcat_ln1-intlen         = p_length.
      t_fieldcat_ln1-ddic_outputlen = p_length.
      APPEND t_fieldcat_ln1 TO t_fieldcat1.
    ENDFORM.                    " f_build_fieldcat
    FORM f_build_sortcat USING p_fldname.
      CLEAR t_sortcat_ln1.
      ADD 1 TO g_col_pos.
      t_sortcat_ln1-spos      = g_col_pos.
      t_sortcat_ln1-fieldname = p_fldname.
      t_sortcat_ln1-up        = c_x.
      t_sortcat_ln1-down      = space.
      t_sortcat_ln1-subtot    = c_x.
      APPEND t_sortcat_ln1 TO t_sortcat1.
    ENDFORM.                    " f_build_sortcat
    FORM f_build_layout.
      t_layout1-zebra           = c_x.
      t_layout1-no_vline        = c_space1.
      t_layout1-reprep          = c_x.
      t_layout1-detail_popup    = c_x.
      t_layout1-window_titlebar = text-005.
      t_layout1-no_scrolling    = c_space1.
      t_layout1-detail_titlebar = text-005.
      t_layout1-numc_sum        = c_x.
      t_layout1-get_selinfos    = c_x.
      t_layout1-min_linesize    = 132.
    ENDFORM.                    " f_build_layout
      DATA: l_pgm TYPE syrepid,
            l_exit(1) TYPE c.
      CLEAR: l_pgm,
             l_exit.
      l_pgm = sy-repid.
      CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
           EXPORTING
                i_callback_program      = l_pgm
                i_callback_user_command = c_user_command
                is_layout               = t_layout1
                it_fieldcat             = t_fieldcat1
                i_save                  = c_a
                it_events               = t_eventcat1
           IMPORTING
                e_exit_caused_by_caller = l_exit
           TABLES
                t_outtab                = t_result
           EXCEPTIONS
                program_error           = 1
                OTHERS                  = 2.
      IF sy-subrc NE 0.
        l_exit = l_exit.
      ENDIF.
    To ALV F.M t_result table is updated with correct data.
    But it is not getting displayed.
    What can be the reason!
    Can anybody give the solution!
    Thanks for your replies.
    Thanks,
    Deep.

  • Average of the column in ALV report

    Hi,
      I am working on an ALV report and for one of the column, i am calculating the average with fieldcatalog property do_sum = 'C'.
    I am sorting the output table for 2 fields and whenever I am expanding/compressing the sorted fields the average of the column is changing. Please let me know how do I get this average calculated constant. It should not change when the user collapses/expands on the sorted field.
    Regards
    Rashmi

    The same question has been asked in this thread:
    Compute average of a report column
    I have offered a solution but as I've said it's not great but it may meet your needs.
    Or another forum user may review and be able to suggest a better solution.
    Does the average need to be part of the report?
    Could you calculate it and display it within a page item below the report instead?

  • Doubt in Alv Report Coloumn Heading

    Hi Gurus
    I want to print 2 coloumn headings in ALv Report.
    For eg: 1st line coloumn heading contains
                  Name   Number        Date      status
                2nd line coloumn heading contains under status
                              Active      Incative            
    Then if my list size is not enough to show the full details. so i can cut it in 2 lines
        if my list contains 20 coloumns
        i have to put 10 coloumns in first line
        then remaning 10 coloums in second line.
    i want the solution for both the questions.
    Help me.
    Regards.
    Bhuvana.

    For the first issue
    Use Top of Page Event to write a simple list which will act as a header for the alv list.
    Second issue:
    In the fieldcat,
    Position all the first 10 coloums row_pos = 1
    Position all the next 10 coloums row_pos = 2
    Regards,
    Lijo Joseph
    <REMOVED BY MODERATOR>
    Edited by: Alvaro Tejada Galindo on Feb 14, 2008 12:35 PM

  • Events in Alv Report

    Hi experts,
    Can anyone brief me about events which appears in an ALV report.
    I want the events only for Alv report not for any report program.
    Thanks
    Sanket sethi.

    Hi Sanket,
    <b>ALV is Application List viewer.</b>
    Sap provides a set of ALV (ABAP LIST VIEWER) function modules which can be put into use to embellish the output of a report. This set of ALV functions is used to enhance the readability and functionality of any report output. Cases arise in sap when the output of a report contains columns extending more than 255 characters in length.
    In such cases, this set of ALV functions can help choose selected columns and arrange the different columns from a report output and also save different variants for report display. This is a very efficient tool for dynamically sorting and arranging the columns from a report output.
    The report output can contain up to 90 columns in the display with the wide array of display options.
    The commonly used ALV functions used for this purpose are;
    <b>1. REUSE_ALV_VARIANT_DEFAULT_GET
    2. REUSE_ALV_VARIANT_F4
    3. REUSE_ALV_VARIANT_EXISTENCE
    4. REUSE_ALV_EVENTS_GET
    5. REUSE_ALV_COMMENTARY_WRITE
    6. REUSE_ALV_FIELDCATALOG_MERGE
    7. REUSE_ALV_LIST_DISPLAY
    8. REUSE_ALV_GRID_DISPLAY
    9. REUSE_ALV_POPUP_TO_SELECT</b>
    Purpose of the above Functions are differ not all the functions are required in all the ALV Report.
    But either no.7 or No.8 is there in the Program.
    How you call this function in your report?
    After completion of all the data fetching from the database and append this data into an Internal Table. say I_ITAB.
    Then use follwing function module.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
           EXPORTING
                I_CALLBACK_PROGRAM       = 'Prog.name'
                I_STRUCTURE_NAME         = 'I_ITAB'
                I_DEFAULT                = 'X'
                I_SAVE                   = 'A'
           TABLES
                T_OUTTAB                 = I_ITAB.
      IF SY-SUBRC <> 0.
        WRITE: 'SY-SUBRC: ', SY-SUBRC .
      ENDIF.
    ENDFORM.                    " GET_FINAL_DATA
    Sample ALV1:
    REPORT Z_ALV_SIMPLE_EXAMPLE_WITH_ITAB .
    *Simple example to use ALV and to define the ALV data in an internal
    *table
    Martin Schlegel, BearingPoint, December 2004
    Thanks to Madhusudhan Sonee and Rama Krishna Kommineni for testing
    and feedback
    *For a very long time, people gave me the feeling that ALV is a
    *complicated tool that is difficult to understand and to use.
    *Lately I had to use it and I discovered that ALV is easy to use and
    *saves a lot of work:
    *ALV will generate the column headings on its own, so one does not need
    *to work on headlines and transalation.
    *ALV allows the user to select the columns he wants to see, so the user
    *does not need to contact a developer for every change he likes to have.
    *ALV allows the user to create his own sums, so …
    *ALV has a simple way to work with internal tables.
    *If you really want to save time, use ALV instead of write!
    *Please take 30 minutes to explore the following example and see how
    *easy it is to use ALV!
    *data definition
    tables:
    marav. "Table MARA and table MAKT
    Data to be displayed in ALV
    Using the following syntax, REUSE_ALV_FIELDCATALOG_MERGE can auto-
    matically determine the fieldstructure from this source program
    Data:
    begin of imat occurs 100,
    matnr like marav-matnr, "Material number
    maktx like marav-maktx, "Material short text
    matkl like marav-matkl, "Material group (so you can test to make
                            " intermediate sums)
    ntgew like marav-ntgew, "Net weight, numeric field (so you can test to
                            "make sums)
    gewei like marav-gewei, "weight unit (just to be complete)
    end of imat.
    Other data needed
    field to store report name
    data i_repid like sy-repid.
    field to check table length
    data i_lines like sy-tabix.
    Data for ALV display
    TYPE-POOLS: SLIS.
    data int_fcat type SLIS_T_FIELDCAT_ALV.
    select-options:
    s_matnr for marav-matnr matchcode object MAT1.
    start-of-selection.
    read data into table imat
      select * from marav
      into corresponding fields of table imat
      where
      matnr in s_matnr.
    Check if material was found
      clear i_lines.
      describe table imat lines i_lines.
      if i_lines lt 1.
      Using hardcoded write here for easy upload
        write: /
        'No materials found.'.
        exit.
      endif.
    end-of-selection.
    Now, we start with ALV
    To use ALV, we need a DDIC-structure or a thing called Fieldcatalogue.
    The fieldcatalouge can be generated by FUNCTION
    'REUSE_ALV_FIELDCATALOG_MERGE' from an internal table from any
    report source, including this report.
    The only problem one might have is that the report and table names
    need to be in capital letters. (I had it )
    Store report name
      i_repid = sy-repid.
    Create Fieldcatalogue from internal table
      CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
           EXPORTING
                I_PROGRAM_NAME         = i_repid
                I_INTERNAL_TABNAME     = 'IMAT'  "capital letters!
                I_INCLNAME             = i_repid
           CHANGING
                CT_FIELDCAT            = int_fcat
           EXCEPTIONS
                INCONSISTENT_INTERFACE = 1
                PROGRAM_ERROR          = 2
                OTHERS                 = 3.
    *explanations:
       I_PROGRAM_NAME is the program which calls this function
       I_INTERNAL_TABNAME is the name of the internal table which you want
                          to display in ALV
       I_INCLNAME is the ABAP-source where the internal table is defined
                  (DATA....)
         CT_FIELDCAT contains the Fieldcatalouge that we need later for
         ALV display
      IF SY-SUBRC <> 0.
        write: /
        'Returncode',
        sy-subrc,
        'from FUNCTION REUSE_ALV_FIELDCATALOG_MERGE'.
      ENDIF.
    *This was the fieldcatlogue
    And now, we are ready to display our list
    Call for ALV list display
      CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
           EXPORTING
               I_CALLBACK_PROGRAM = 'Z_ALV_SIMPLE_EXAMPLE_WITH_ITAB'
                I_CALLBACK_PROGRAM = i_repid
                IT_FIELDCAT        = int_fcat
                I_SAVE             = 'A'
           TABLES
                T_OUTTAB           = imat
           EXCEPTIONS
                PROGRAM_ERROR      = 1
                OTHERS             = 2.
    *explanations:
       I_CALLBACK_PROGRAM is the program which calls this function
       IT_FIELDCAT (just made by REUSE_ALV_FIELDCATALOG_MERGE) contains
                    now the data definition needed for display
       I_SAVE allows the user to save his own layouts
         T_OUTTAB contains the data to be displayed in ALV
      IF SY-SUBRC <> 0.
        write: /
        'Returncode',
        sy-subrc,
        'from FUNCTION REUSE_ALV_LIST_DISPLAY'.
      ENDIF.
    Samle ALV2:
    *& Report  ZZ_22038_22098_002                                          *
    *& This is an Interactive ALV report, where on line slection we can see
    *&  the secondry list
    REPORT  ZZ_22038_22098_002 NO STANDARD PAGE HEADING LINE-SIZE 650
    MESSAGE-ID ZZ_9838                      .
    TYPE-POOLS: SLIS.
    *type declaration for values from ekko
    TYPES: BEGIN OF I_EKKO,
           EBELN LIKE EKKO-EBELN,
           AEDAT LIKE EKKO-AEDAT,
           BUKRS LIKE EKKO-BUKRS,
           BSART LIKE EKKO-BSART,
           LIFNR LIKE EKKO-LIFNR,
           END OF I_EKKO.
    DATA: IT_EKKO TYPE STANDARD TABLE OF I_EKKO INITIAL SIZE 0,
          WA_EKKO TYPE I_EKKO.
    *type declaration for values from ekpo
    TYPES: BEGIN OF I_EKPO,
           EBELN LIKE EKPO-EBELN,
           EBELP LIKE EKPO-EBELP,
           MATNR LIKE EKPO-MATNR,
           MENGE LIKE EKPO-MENGE,
           MEINS LIKE EKPO-MEINS,
           NETPR LIKE EKPO-NETPR,
           END OF I_EKPO.
    DATA: IT_EKPO TYPE STANDARD TABLE OF I_EKPO INITIAL SIZE 0,
          WA_EKPO TYPE I_EKPO .
    *variable for Report ID
    DATA: V_REPID LIKE SY-REPID .
    *declaration for fieldcatalog
    DATA: I_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
          WA_FIELDCAT TYPE SLIS_FIELDCAT_ALV.
    DATA: IT_LISTHEADER TYPE SLIS_T_LISTHEADER.
    declaration for events table where user comand or set PF status will
    be defined
    DATA: V_EVENTS TYPE SLIS_T_EVENT,
          WA_EVENT TYPE SLIS_ALV_EVENT.
    declartion for layout
    DATA: ALV_LAYOUT TYPE SLIS_LAYOUT_ALV.
    declaration for variant(type of display we want)
    DATA: I_VARIANT TYPE DISVARIANT,
          I_VARIANT1 TYPE DISVARIANT,
          I_SAVE(1) TYPE C.
    *PARAMETERS : p_var TYPE disvariant-variant.
    *Title displayed when the alv list is displayed
    DATA:  I_TITLE_EKKO TYPE LVC_TITLE VALUE 'FIRST LIST DISPLAYED'.
    DATA:  I_TITLE_EKPO TYPE LVC_TITLE VALUE 'SECONDRY LIST DISPLAYED'.
    INITIALIZATION.
      V_REPID = SY-REPID.
      PERFORM BUILD_FIELDCATLOG.
      PERFORM EVENT_CALL.
      PERFORM POPULATE_EVENT.
    START-OF-SELECTION.
      PERFORM DATA_RETRIEVAL.
      PERFORM BUILD_LISTHEADER USING IT_LISTHEADER.
      PERFORM DISPLAY_ALV_REPORT.
    *&      Form  BUILD_FIELDCATLOG
          Fieldcatalog has all the field details from ekko
    FORM BUILD_FIELDCATLOG.
      WA_FIELDCAT-TABNAME = 'IT_EKKO'.
      WA_FIELDCAT-FIELDNAME = 'EBELN'.
      WA_FIELDCAT-SELTEXT_M = 'PO NO.'.
      APPEND WA_FIELDCAT TO I_FIELDCAT.
      CLEAR WA_FIELDCAT.
      WA_FIELDCAT-TABNAME = 'IT_EKKO'.
      WA_FIELDCAT-FIELDNAME = 'AEDAT'.
      WA_FIELDCAT-SELTEXT_M = 'DATE.'.
      APPEND WA_FIELDCAT TO I_FIELDCAT.
      CLEAR WA_FIELDCAT.
      WA_FIELDCAT-TABNAME = 'IT_EKKO'.
      WA_FIELDCAT-FIELDNAME = 'BUKRS'.
      WA_FIELDCAT-SELTEXT_M = 'COMPANY CODE'.
      APPEND WA_FIELDCAT TO I_FIELDCAT.
      CLEAR WA_FIELDCAT.
    WA_FIELDCAT-TABNAME = 'IT_EKKO'.
      WA_FIELDCAT-FIELDNAME = 'BUKRS'.
      WA_FIELDCAT-SELTEXT_M = 'DOCMENT TYPE'.
      APPEND WA_FIELDCAT TO I_FIELDCAT.
      CLEAR WA_FIELDCAT.
    WA_FIELDCAT-TABNAME = 'IT_EKKO'.
      WA_FIELDCAT-FIELDNAME = 'LIFNR'.
      WA_FIELDCAT-NO_OUT    = 'X'.
      WA_FIELDCAT-SELTEXT_M = 'VENDOR CODE'.
      APPEND WA_FIELDCAT TO I_FIELDCAT.
      CLEAR WA_FIELDCAT.
    ENDFORM.                    "BUILD_FIELDCATLOG
    *&      Form  EVENT_CALL
      we get all events - TOP OF PAGE or USER COMMAND in table v_events
    FORM EVENT_CALL.
      CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
       EXPORTING
         I_LIST_TYPE           = 0
       IMPORTING
         ET_EVENTS             = V_EVENTS
    EXCEPTIONS
       LIST_TYPE_WRONG       = 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.
    ENDFORM.                    "EVENT_CALL
    *&      Form  POPULATE_EVENT
         Events populated for TOP OF PAGE & USER COMAND
    FORM POPULATE_EVENT.
      READ TABLE V_EVENTS INTO WA_EVENT WITH KEY NAME = 'TOP_OF_PAGE'.
      IF SY-SUBRC EQ 0.
        WA_EVENT-FORM = 'TOP_OF_PAGE'.
        MODIFY V_EVENTS FROM WA_EVENT TRANSPORTING FORM WHERE NAME =
    WA_EVENT-FORM.
      ENDIF.
      READ TABLE V_EVENTS INTO WA_EVENT WITH KEY NAME = 'USER_COMMAND'.
      IF SY-SUBRC EQ 0.
        WA_EVENT-FORM = 'USER_COMMAND'.
        MODIFY V_EVENTS FROM WA_EVENT TRANSPORTING FORM WHERE NAME =
    WA_EVENT-NAME.
      ENDIF.
    ENDFORM.                    "POPULATE_EVENT
    *&      Form  data_retrieval
      retreiving values from the database table ekko
    FORM DATA_RETRIEVAL.
      SELECT EBELN AEDAT BUKRS BSART LIFNR FROM EKKO INTO TABLE IT_EKKO.
    ENDFORM.                    "data_retrieval
    *&      Form  bUild_listheader
          text
         -->I_LISTHEADEtext
    FORM BUILD_LISTHEADER USING I_LISTHEADER TYPE SLIS_T_LISTHEADER.
      DATA HLINE TYPE SLIS_LISTHEADER.
      HLINE-INFO = 'this is my first alv pgm'.
      HLINE-TYP = 'H'.
    ENDFORM.                    "build_listheader
    *&      Form  display_alv_report
          text
    FORM DISPLAY_ALV_REPORT.
      V_REPID = SY-REPID.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
       EXPORTING
         I_CALLBACK_PROGRAM                = V_REPID
      I_CALLBACK_PF_STATUS_SET          = ' '
         I_CALLBACK_USER_COMMAND           = 'USER_COMMAND'
         I_CALLBACK_TOP_OF_PAGE            = 'TOP_OF_PAGE'
         I_GRID_TITLE                      = I_TITLE_EKKO
      I_GRID_SETTINGS                   =
      IS_LAYOUT                         = ALV_LAYOUT
         IT_FIELDCAT                       = I_FIELDCAT[]
      IT_EXCLUDING                      =
      IT_SPECIAL_GROUPS                 =
      IT_SORT                           =
      IT_FILTER                         =
      IS_SEL_HIDE                       =
        i_default                         = 'ZLAY1'
         I_SAVE                            = 'A'
        is_variant                        = i_variant
         IT_EVENTS                         = V_EVENTS
        TABLES
          T_OUTTAB                          = IT_EKKO
    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.
    ENDFORM.                    "display_alv_report
    *&      Form  TOP_OF_PAGE
          text
    FORM TOP_OF_PAGE.
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
        EXPORTING
          IT_LIST_COMMENTARY       = IT_LISTHEADER
       i_logo                   =
       I_END_OF_LIST_GRID       =
    ENDFORM.                    "TOP_OF_PAGE
    *&      Form  USER_COMMAND
          text
         -->R_UCOMM    text
         -->,          text
         -->RS_SLEFIELDtext
    FORM USER_COMMAND USING R_UCOMM LIKE SY-UCOMM
    RS_SELFIELD TYPE SLIS_SELFIELD.
      CASE R_UCOMM.
        WHEN '&IC1'.
          READ TABLE IT_EKKO INTO WA_EKKO INDEX RS_SELFIELD-TABINDEX.
          PERFORM BUILD_FIELDCATLOG_EKPO.
          PERFORM EVENT_CALL_EKPO.
          PERFORM POPULATE_EVENT_EKPO.
          PERFORM DATA_RETRIEVAL_EKPO.
          PERFORM BUILD_LISTHEADER_EKPO USING IT_LISTHEADER.
          PERFORM DISPLAY_ALV_EKPO.
      ENDCASE.
    ENDFORM.                    "user_command
    *&      Form  BUILD_FIELDCATLOG_EKPO
          text
    FORM BUILD_FIELDCATLOG_EKPO.
      WA_FIELDCAT-TABNAME = 'IT_EKPO'.
      WA_FIELDCAT-FIELDNAME = 'EBELN'.
      WA_FIELDCAT-SELTEXT_M = 'PO NO.'.
      APPEND WA_FIELDCAT TO I_FIELDCAT.
      CLEAR WA_FIELDCAT.
      WA_FIELDCAT-TABNAME = 'IT_EKPO'.
      WA_FIELDCAT-FIELDNAME = 'EBELP'.
      WA_FIELDCAT-SELTEXT_M = 'LINE NO'.
      APPEND WA_FIELDCAT TO I_FIELDCAT.
      CLEAR WA_FIELDCAT.
      WA_FIELDCAT-TABNAME = 'I_EKPO'.
      WA_FIELDCAT-FIELDNAME = 'MATNR'.
      WA_FIELDCAT-SELTEXT_M = 'MATERIAL NO.'.
      APPEND WA_FIELDCAT TO I_FIELDCAT.
      CLEAR WA_FIELDCAT.
    WA_FIELDCAT-TABNAME = 'I_EKPO'.
      WA_FIELDCAT-FIELDNAME = 'MENGE'.
      WA_FIELDCAT-SELTEXT_M = 'QUANTITY'.
      APPEND WA_FIELDCAT TO I_FIELDCAT.
      CLEAR WA_FIELDCAT.
    WA_FIELDCAT-TABNAME = 'I_EKPO'.
      WA_FIELDCAT-FIELDNAME = 'MEINS'.
      WA_FIELDCAT-SELTEXT_M = 'UOM'.
      APPEND WA_FIELDCAT TO I_FIELDCAT.
      CLEAR WA_FIELDCAT.
    WA_FIELDCAT-TABNAME = 'I_EKPO'.
      WA_FIELDCAT-FIELDNAME = 'NETPR'.
      WA_FIELDCAT-SELTEXT_M = 'PRICE'.
      APPEND WA_FIELDCAT TO I_FIELDCAT.
      CLEAR WA_FIELDCAT.
    ENDFORM.                    "BUILD_FIELDCATLOG_EKPO
    *&      Form  event_call_ekpo
      we get all events - TOP OF PAGE or USER COMMAND in table v_events
    FORM EVENT_CALL_EKPO.
      CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
       EXPORTING
         I_LIST_TYPE           = 0
       IMPORTING
         ET_EVENTS             = V_EVENTS
    EXCEPTIONS
      LIST_TYPE_WRONG       = 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.
    ENDFORM.                    "event_call_ekpo
    *&      Form  POPULATE_EVENT
           Events populated for TOP OF PAGE & USER COMAND
    FORM POPULATE_EVENT_EKPO.
      READ TABLE V_EVENTS INTO WA_EVENT WITH KEY NAME = 'TOP_OF_PAGE'.
      IF SY-SUBRC EQ 0.
        WA_EVENT-FORM = 'TOP_OF_PAGE'.
        MODIFY V_EVENTS FROM WA_EVENT TRANSPORTING FORM WHERE NAME =
    WA_EVENT-FORM.
      ENDIF.
      ENDFORM.                    "POPULATE_EVENT
    *&      Form  TOP_OF_PAGE
          text
    FORM F_TOP_OF_PAGE.
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
        EXPORTING
          IT_LIST_COMMENTARY       = IT_LISTHEADER
       i_logo                   =
       I_END_OF_LIST_GRID       =
    ENDFORM.                    "TOP_OF_PAGE
    *&      Form  USER_COMMAND
          text
         -->R_UCOMM    text
         -->,          text
         -->RS_SLEFIELDtext
    *retreiving values from the database table ekko
    FORM DATA_RETRIEVAL_EKPO.
    SELECT EBELN EBELP MATNR MENGE MEINS NETPR FROM EKPO INTO TABLE IT_EKPO.
    ENDFORM.
    FORM BUILD_LISTHEADER_EKPO USING I_LISTHEADER TYPE SLIS_T_LISTHEADER.
    DATA: HLINE1 TYPE SLIS_LISTHEADER.
    HLINE1-TYP = 'H'.
    HLINE1-INFO = 'CHECKING PGM'.
    ENDFORM.
    FORM DISPLAY_ALV_EKPO.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
      I_INTERFACE_CHECK                 = ' '
      I_BYPASSING_BUFFER                = ' '
      I_BUFFER_ACTIVE                   = ' '
       I_CALLBACK_PROGRAM                = V_REPID
      I_CALLBACK_PF_STATUS_SET          = ' '
      I_CALLBACK_USER_COMMAND           = 'F_USER_COMMAND'
       I_CALLBACK_TOP_OF_PAGE            = 'TOP_OF_PAGE'
      I_CALLBACK_HTML_TOP_OF_PAGE       = ' '
      I_CALLBACK_HTML_END_OF_LIST       = ' '
      I_STRUCTURE_NAME                  =
      I_BACKGROUND_ID                   = ' '
       I_GRID_TITLE                      = I_TITLE_EKPO
      I_GRID_SETTINGS                   =
      IS_LAYOUT                         =
       IT_FIELDCAT                       = I_FIELDCAT[]
      IT_EXCLUDING                      =
      IT_SPECIAL_GROUPS                 =
      IT_SORT                           =
      IT_FILTER                         =
      IS_SEL_HIDE                       =
      I_DEFAULT                         =
       I_SAVE                            = 'A'
      IS_VARIANT                        =
       IT_EVENTS                         = V_EVENTS
      TABLES
        T_OUTTAB                          = IT_EKPO
    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.
    ENDFORM.
    <b>Reward Points if Useful</b>
    Regards
    Gokul

  • Sub heading in ALV report

    Hi All,
                 is there any way for subheading in ALV report.
          For Example:                           staff                               worker
                                             L1 L2 R1 R2 R3 R4         w1 w2 w3 w4  w5 w6
    thks
    shailesh

    hi,
    try this REUSE_ALV_HIERSEQ_LIST_DISPLAY
    hope this will help u...
    Regards
    Shishir Deshmukh

  • Problem when I call a perfor using ALV report

    Hello my dear expert.
    I showed an ALV report when the user do double clic in any colunm  of this ALV I needo to the program show a other ALV report whit five columns. so In this case I made a internal table and put my option on it.
    El problem is that When i do double click in the first ALV report the program shows a dump.
    i do not know what is the problem, there is something sure is the dump is showed when I do double on the firts ALV report.
    thanks for helping me.
    the source code is the nextÑ
    Moderator message - Please respect the 2,500 character maximum when posting. Post only the relevant portions of code
    thanks alot
    Edited by: Rob Burbank on Apr 19, 2010 5:49 PM

    Thanks I have found my porblem
    this was:
    i_callback_user_command = 'process_click'
    proces_click is in lower_letterr instead of capitals so the program di not find the permorf.
    thanks anyway

  • How to create an interactive alv report in which some parameters

    hi all,
    i want to create an interactive alv report in which some parameters in selection screen
    & when fill those & press f8 then an alv list display will show & when user double click on
    any row then those contents get shown in header details of module pool program  which call by
      tcode mentioned in same alv .And same an interactive alv report used for change & display.
    please help me give me some code same as  required above.
    ketan
    abap consultant.
    Edited by: ketan pande on Feb 14, 2009 6:09 AM

    Hi Ketan,
    Please find Sample Code.
    TYPE-POOLS:slis.
    DATA:
      w_carrid TYPE scarr-carrid,
      it_fieldcat TYPE slis_t_fieldcat_alv,
      fs_fieldcat LIKE LINE OF it_fieldcat,
      it_eventcat TYPE slis_t_event,
      fs_eventcat LIKE LINE OF it_fieldcat.
    DATA:
      t_spfli LIKE STANDARD TABLE OF spfli,
      fs_spfli LIKE LINE OF t_spfli,
      t_sflight LIKE STANDARD TABLE OF sflight,
      fs_sflight LIKE LINE OF t_sflight.
    SELECT-OPTIONS:
      s_carrid FOR w_carrid.
    START-OF-SELECTION.
      SELECT * FROM spfli INTO TABLE t_spfli WHERE carrid IN s_carrid.
      CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
        EXPORTING
          i_callback_program      = sy-repid
          i_callback_user_command = 'PICK'
          i_structure_name        = 'SPFLI'
        TABLES
          t_outtab                = t_spfli
        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  PICK
    FORM pick USING command LIKE sy-ucomm
                    selfield TYPE slis_selfield.
      READ TABLE t_spfli INTO fs_spfli INDEX selfield-tabindex.
      CASE command.
        WHEN '&IC1'.
          SELECT * FROM sflight
          INTO TABLE t_sflight
         WHERE carrid = fs_spfli-carrid
           and connid = fs_spfli-connid.
          CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
           EXPORTING
             i_program_name               = sy-repid
           I_INTERNAL_TABNAME           =
             i_structure_name             = 'SFLIGHT'
           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_LIST_DISPLAY'
           EXPORTING
           I_INTERFACE_CHECK              = ' '
           I_BYPASSING_BUFFER             =
           I_BUFFER_ACTIVE                = ' '
             i_callback_program             = sy-repid
           I_CALLBACK_PF_STATUS_SET       = ' '
           I_CALLBACK_USER_COMMAND        = ' '
           I_STRUCTURE_NAME               =
           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_eventcat
           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
           IR_SALV_LIST_ADAPTER           =
           IT_EXCEPT_QINFO                =
           I_SUPPRESS_EMPTY_DATA          = ABAP_FALSE
         IMPORTING
           E_EXIT_CAUSED_BY_CALLER        =
           ES_EXIT_CAUSED_BY_USER         =
            TABLES
              t_outtab                       = t_sflight
          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.
      ENDCASE.
    ENDFORM.                    "pick
    Hope this will Be Helpful
    Thanks
    Kalyan

  • Interactive ALV Report

    Hi Experts,
    I am new to ALV Reports, can any one provide some inputs on how to create an Interactive ALV Reports using OOPS Concept.
    I am getting the data from SFLIGHT on first ALV and i want that when i single click any cell or row or any check box associated with the row i should get the corresponding booking details from table SBOOK.
    Thanks
    Ravi

    Hi dude,
    Go through this Link: [http://www.sap-img.com/abap/an-interactive-alv-report.htm]
    for more information search in SDN only..
    Re: Interactive ALV  Report Using Function...?

  • Variants on tabbed selection screen for ALV reports

    Scenario: We use a tabbed selection screen for an ALV report. We create a variant, make a selection field on the second tab mandatory & save it without a value. When we run the report with the saved variant it does not check that the required field on the second tab is populated before it executes.
    Question: How can I code such a check?
    Edited by: Alridge Tom on Jul 4, 2008 3:43 PM

    Hi,
    try inserting this code apropietly in you program. (1 parameter + Initialization + At-selection-screen + 2 forms)
    START HERE
    PARAMETERS: pa_vari TYPE disvariant-variant.
    INITIALIZATION.
      g_repid = sy-repid.
      CLEAR e_variant.
      e_variant-report   = sy-cprog.
      e_variant-username = sy-uname.
      CALL FUNCTION 'REUSE_ALV_VARIANT_DEFAULT_GET'
        EXPORTING
          i_save     = 'A'
        CHANGING
          cs_variant = e_variant
        EXCEPTIONS
          not_found  = 2.
      IF sy-subrc = 0.
        pa_vari = e_variant-variant.
      ENDIF.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR pa_vari.
      PERFORM alv_variant_f4 CHANGING pa_vari.
    *&      Form  ALV_VARIANT_F4
    FORM alv_variant_f4 CHANGING pa_vari.
      DATA: l_exit(1) TYPE c.
      CALL FUNCTION 'REUSE_ALV_VARIANT_F4'
        EXPORTING
          is_variant       = e_variant
          i_tabname_header = 'ANYTHING'
          i_save           = 'A'
        IMPORTING
          e_exit           = l_exit
          es_variant       = e_variant
        EXCEPTIONS
          not_found        = 2.
      IF sy-subrc = 2.
        MESSAGE ID sy-msgid TYPE 'S'  NUMBER sy-msgno
                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ELSE.
        IF l_exit = space.
          pa_vari = e_variant-variant.
        ENDIF.
      ENDIF.
    ENDFORM.                               " ALV_VARIANT_F4
    END
    Hope iy helps!
    Alfonso

  • Alv Report for invoice details

    Dear All,
                 I need to develop one alv report for following details. i developed coding for this requirment but i am getting some error.kindley help me to how to move data from different internal table to final internal table. I used LOOP AT and READ Statement even i didn't get any output.
    kindley help me out.
    TYPES: BEGIN OF XT_TAB,
             LIFNR  LIKE LFA1-LIFNR,
             NAME1  LIKE LFA1-NAME1,
             STCD1  LIKE LFA1-STCD1,
             STCD2  LIKE LFA1-STCD2,
             STCD3  LIKE LFA1-STCD3,
             STCD4  LIKE LFA1-STCD4,
           END OF XT_TAB.
    TYPES: BEGIN OF YT_TAB,
            BUKRS LIKE BSEG-BUKRS,
            BELNR LIKE BSEG-BELNR,
            BUZEI LIKE BSEG-BUZEI,
            LIFNR LIKE BSEG-LIFNR,
            GJAHR LIKE BSEG-GJAHR,
           END OF YT_TAB.
    TYPES: BEGIN OF ZT_TAB,
            LIFNR  LIKE LFA1-LIFNR,
            NAME1  LIKE LFA1-NAME1,
            STCD2  LIKE LFA1-STCD2,
            BELNR  LIKE BSEG-BELNR,
            BUZEI  LIKE BSEG-BUZEI,
            GJAHR  LIKE BSEG-GJAHR,
           END OF ZT_TAB.
           I N T E R N A L   T A B L E   D E C L A R A T I O N S         *
    *-----Internal table to store data
    DATA: ITAB1   TYPE STANDARD TABLE OF XT_TAB INITIAL SIZE 0,
          WA_TAB1 TYPE XT_TAB.
    DATA: ITAB2   TYPE STANDARD TABLE OF YT_TAB INITIAL SIZE 0,
          WA_TAB2 TYPE YT_TAB.
    DATA:   ITAB  TYPE STANDARD TABLE OF  ZT_TAB  WITH HEADER LINE,
            WA_ITAB TYPE ZT_TAB,
            ITAB_FINAL2 TYPE STANDARD TABLE OF ZT_TAB.
    DATA: ITAB_TEMP1 TYPE STANDARD TABLE OF ZT_TAB  WITH HEADER LINE.
                    Selection Screen Declarations                        *
    SELECTION-SCREEN BEGIN OF BLOCK bk1 WITH FRAME TITLE text-001.
    SELECTION-SCREEN SKIP.
    SELECTION-SCREEN begin OF LINE.
    SELECTION-SCREEN COMMENT (23) text-003 FOR FIELD P_LIFNR.
    PARAMETERS P_LIFNR LIKE LFA1-LIFNR OBLIGATORY.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN SKIP.
    SELECTION-SCREEN END OF BLOCK bk1.
    START-OF-SELECTION.
          PERFORM XTRACT_DATA.
    END-OF-SELECTION.
    *-----Filling the Output table
      PERFORM populate_main_table.
          PERFORM BUILD_FIELDCATALOG.
         PERFORM SORTING.
          PERFORM BUILD_LAYOUT.
          PERFORM BUILD_ALV_GRID_DISPLAY.
         Form  XTRACT_DATA
    FORM XTRACT_DATA .
    *SELECT
          a~LIFNR
          a~NAME1
          a~STCD2
          b~BELNR
          b~BUZEI
          b~GJAHR
    INTO TABLE ITAB
    FROM LFA1 as a INNER JOIN BSEG as b
      ON  aLIFNR = bLIFNR
    WHERE  a~LIFNR = P_LIFNR.
    SELECT LIFNR
           NAME1
           STCD1
           STCD2
           STCD3
           STCD4
      FROM LFA1
      INTO TABLE ITAB1
      WHERE LIFNR = P_LIFNR.
    IF NOT ITAB1[] IS INITIAL.
        SORT ITAB1 BY LIFNR.
        SELECT BELNR
               BUZEI
               LIFNR
               GJAHR
    INTO TABLE ITAB2
          FROM BSEG
    FOR ALL ENTRIES IN ITAB1
    WHERE LIFNR = ITAB1-LIFNR.
    ENDIF.
    ENDFORM.                    " XTRACT_DATA
    *&      Form  POPULATE_MAIN_TABLE
          text
    -->  p1        text
    <--  p2        text
    FORM POPULATE_MAIN_TABLE .
       LOOP AT ITAB1 INTO WA_TAB1.
               ITAB-LIFNR = ITAB1-LIFNR.
               ITAB-NAME1 = ITAB1-NAME1.
               ITAB-STCD2 = ITAB1-STCD2.
       READ TABLE ITAB2 INTO WA_TAB2 WITH KEY LIFNR = WA_TAB1-LIFNR.
               IF sy-subrc = 0.
               ITAB-BELNR = ITAB1-BELNR.
               ITAB-BUZEI = ITAB1-BUZEI.
               ITAB-GJAHR = ITAB1-GJAHR.
               ENDIF.
      ENDLOOP.
      ENDFORM.                    " POPULATE_MAIN_TABLE
         Form  BUILD_FIELDCATALOG
    FORM BUILD_FIELDCATALOG .
      REFRESH t_fcat.
      CLEAR t_fcat.
      wa_fcat-col_pos = 1.
      wa_fcat-row_pos = 1.
      wa_fcat-seltext_s = 'Vendor Number'.
      wa_fcat-seltext_m = 'Vendor Number'.
      wa_fcat-seltext_l = 'Vendor Number'.
      wa_fcat-fieldname = 'LIFNR'.
      wa_fcat-tabname = 'ITAB'.
      APPEND wa_fcat TO t_fcat.
      CLEAR t_fcat.
      wa_fcat-col_pos = 2.
      wa_fcat-row_pos = 1.
      wa_fcat-seltext_s = 'Vendor Name'.
      wa_fcat-seltext_m = 'Vendor Name'.
      wa_fcat-seltext_l = 'Vendor Name'.
      wa_fcat-fieldname = 'NAME1'.
      wa_fcat-tabname = 'ITAB'.
      APPEND wa_fcat TO t_fcat.
      CLEAR t_fcat.
      wa_fcat-col_pos = 3.
      wa_fcat-row_pos = 1.
      wa_fcat-seltext_s = 'Vendor TIN Number'.
      wa_fcat-seltext_m = 'Vendor TIN Number'.
      wa_fcat-seltext_l = 'Vendor TIN Number'.
      wa_fcat-fieldname = 'STCD2'.
      wa_fcat-tabname = 'ITAB'.
      APPEND wa_fcat TO t_fcat.
      CLEAR t_fcat.
      wa_fcat-col_pos = 4.
      wa_fcat-row_pos = 1.
      wa_fcat-seltext_s = 'Document No'.
      wa_fcat-seltext_m = 'Document No'.
      wa_fcat-seltext_l = 'Document No'.
      wa_fcat-fieldname = 'BELNR'.
      wa_fcat-tabname = 'ITAB'.
      APPEND wa_fcat TO t_fcat.
      CLEAR t_fcat.
      wa_fcat-col_pos = 5.
      wa_fcat-row_pos = 1.
      wa_fcat-seltext_s = 'Item Number'.
      wa_fcat-seltext_m = 'Item Number'.
      wa_fcat-seltext_l = 'Item Number'.
      wa_fcat-fieldname = 'BUZEI'.
      wa_fcat-tabname = 'ITAB'.
      APPEND wa_fcat TO t_fcat.
      CLEAR t_fcat.
      wa_fcat-col_pos = 6.
      wa_fcat-row_pos = 1.
      wa_fcat-seltext_s = 'Fiscal Year'.
      wa_fcat-seltext_m = 'Fiscal Year'.
      wa_fcat-seltext_l = 'Fiscal Year'.
      wa_fcat-fieldname = 'GJAHR'.
      wa_fcat-tabname = 'ITAB'.
      APPEND wa_fcat TO t_fcat.
      CLEAR t_fcat.
    ENDFORM.                    " BUILD_FIELDCATALOG
         Form  BUILD_LAYOUT
    FORM BUILD_LAYOUT .
    GD_LAYOUT-NO_INPUT = 'X'.
    GD_LAYOUT-COLWIDTH_OPTIMIZE = 'X'.
    GD_LAYOUT-TOTALS_TEXT = 'TOTALS'.
    ENDFORM.                    " BUILD_LAYOUT
         Form  BUILD_ALV_GRID_DISPLAY
    FORM BUILD_ALV_GRID_DISPLAY .
    gd_repid = sy-repid.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
           EXPORTING
                i_callback_program      = gd_repid
                i_callback_top_of_page  = 'TOP-OF-PAGE'  "see FORM
                i_callback_user_command = 'USER_COMMAND'
                is_layout               = gd_layout
                it_fieldcat             = t_fcat[]
                it_events               = gt_events
                is_print                = gd_prntparams
                it_sort                 = it_sortcat[]
                i_save                  = 'X'
           TABLES
                t_outtab                = ITAB
           EXCEPTIONS
                program_error           = 1
                OTHERS                  = 2.
    thanks and regards
    Murugesh

    TYPES: BEGIN OF XT_TAB,
             LIFNR  LIKE LFA1-LIFNR,
             NAME1  LIKE LFA1-NAME1,
             STCD1  LIKE LFA1-STCD1,
             STCD2  LIKE LFA1-STCD2,
             STCD3  LIKE LFA1-STCD3,
             STCD4  LIKE LFA1-STCD4,
           END OF XT_TAB.
    TYPES: BEGIN OF YT_TAB,
            BUKRS LIKE BSEG-BUKRS,
            BELNR LIKE BSEG-BELNR,
            BUZEI LIKE BSEG-BUZEI,
            LIFNR LIKE BSEG-LIFNR,
            GJAHR LIKE BSEG-GJAHR,
           END OF YT_TAB.
    TYPES: BEGIN OF ZT_TAB,
            LIFNR  LIKE LFA1-LIFNR,
            NAME1  LIKE LFA1-NAME1,
            STCD2  LIKE LFA1-STCD2,
            BELNR  LIKE BSEG-BELNR,
            BUZEI  LIKE BSEG-BUZEI,
            GJAHR  LIKE BSEG-GJAHR,
           END OF ZT_TAB.
           I N T E R N A L   T A B L E   D E C L A R A T I O N S         *
    *-----Internal table to store data
    DATA: ITAB1   TYPE STANDARD TABLE OF XT_TAB INITIAL SIZE 0,
          WA_TAB1 TYPE XT_TAB.
    DATA: ITAB2   TYPE STANDARD TABLE OF YT_TAB INITIAL SIZE 0,
          WA_TAB2 TYPE YT_TAB.
    DATA:   ITAB  TYPE STANDARD TABLE OF  ZT_TAB  WITH HEADER LINE,
            WA_ITAB TYPE ZT_TAB,
            ITAB_FINAL2 TYPE STANDARD TABLE OF ZT_TAB.
    DATA: ITAB_TEMP1 TYPE STANDARD TABLE OF ZT_TAB  WITH HEADER LINE.
                    Selection Screen Declarations                        *
    SELECTION-SCREEN BEGIN OF BLOCK bk1 WITH FRAME TITLE text-001.
    SELECTION-SCREEN SKIP.
    SELECTION-SCREEN begin OF LINE.
    SELECTION-SCREEN COMMENT (23) text-003 FOR FIELD P_LIFNR.
    PARAMETERS P_LIFNR LIKE LFA1-LIFNR OBLIGATORY.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN SKIP.
    SELECTION-SCREEN END OF BLOCK bk1.
    START-OF-SELECTION.
          PERFORM XTRACT_DATA.
    END-OF-SELECTION.
    *-----Filling the Output table
      PERFORM populate_main_table.
          PERFORM BUILD_FIELDCATALOG.
         PERFORM SORTING.
          PERFORM BUILD_LAYOUT.
          PERFORM BUILD_ALV_GRID_DISPLAY.
         Form  XTRACT_DATA
    FORM XTRACT_DATA .
    *SELECT
          a~LIFNR
          a~NAME1
          a~STCD2
          b~BELNR
          b~BUZEI
          b~GJAHR
    INTO TABLE ITAB
    FROM LFA1 as a INNER JOIN BSEG as b
      ON  aLIFNR = bLIFNR
    WHERE  a~LIFNR = P_LIFNR.
    SELECT LIFNR
           NAME1
           STCD1
           STCD2
           STCD3
           STCD4
      FROM LFA1
      INTO TABLE ITAB1
      WHERE LIFNR = P_LIFNR.
    IF NOT ITAB1[] IS INITIAL.
        SORT ITAB1 BY LIFNR.
        SELECT BELNR
               BUZEI
               LIFNR
               GJAHR
    INTO TABLE ITAB2
          FROM BSEG
    FOR ALL ENTRIES IN ITAB1
    WHERE LIFNR = itab1-lifnr.
    ENDIF.
    ENDFORM.                    " XTRACT_DATA
    *&      Form  POPULATE_MAIN_TABLE
          text
    -->  p1        text
    <--  p2        text
    FORM POPULATE_MAIN_TABLE .
      LOOP AT ITAB1 INTO WA_TAB1.
              ITAB-LIFNR = ITAB1-LIFNR.
              ITAB-NAME1 = ITAB1-NAME1.
              ITAB-STCD2 = ITAB1-STCD2.
      READ TABLE ITAB2 INTO WA_TAB2 WITH KEY LIFNR = WA_TAB1-LIFNR.
              IF sy-subrc = 0.
              ITAB-BELNR = ITAB1-BELNR.
              ITAB-BUZEI = ITAB1-BUZEI.
              ITAB-GJAHR = ITAB1-GJAHR.
              ENDIF.
    ENDLOOP.
    LOOP AT itab1 INTO wa_tab1.
       MOVE:  wa_tab1-lifnr TO itab-lifnr,
              wa_tab1-name1 TO itab-name1,
              wa_tab1-stcd2 TO itab-stcd2.
          Append itab.
      READ TABLE itab2 TRANSPORTING NO FIELDS WITH KEY lifnr = wa_tab1-lifnr.
      IF sy-subrc eq 0.
        MOVE: wa_tab2-lifnr TO itab-lifnr,
              wa_tab2-belnr TO itab-belnr,
              wa_tab2-buzei TO itab-buzei,
              wa_tab2-gjahr TO itab-gjahr.
      Append itab.
    endif.
    endloop.
    *LOOP AT t_agr_tcodes INTO s_agr_tcodes.
    READ TABLE t_tstc
    TRANSPORTING NO FIELDS
    WITH KEY tcode = s_agr_tcodes-tcode.
    IF sy-subrc eq 0.
       MOVE: s_agr_tcodes-tcode TO it_agr_tcodes-tcode,
             s_agr_tcodes-agr_name to it_agr_tcodes-agr_name,
             t_tstc-pgmna to it_agr_pgmna.
    *Append it_agr_tcodes.
    *endif.
    *endloop.
      ENDFORM.                    " POPULATE_MAIN_TABLE
         Form  BUILD_FIELDCATALOG
    FORM BUILD_FIELDCATALOG .
      REFRESH t_fcat.
      CLEAR t_fcat.
      wa_fcat-col_pos = 1.
      wa_fcat-row_pos = 1.
      wa_fcat-seltext_s = 'Vendor Number'.
      wa_fcat-seltext_m = 'Vendor Number'.
      wa_fcat-seltext_l = 'Vendor Number'.
      wa_fcat-fieldname = 'LIFNR'.
      wa_fcat-tabname = 'ITAB'.
      APPEND wa_fcat TO t_fcat.
      CLEAR t_fcat.
      wa_fcat-col_pos = 2.
      wa_fcat-row_pos = 1.
      wa_fcat-seltext_s = 'Vendor Name'.
      wa_fcat-seltext_m = 'Vendor Name'.
      wa_fcat-seltext_l = 'Vendor Name'.
      wa_fcat-fieldname = 'NAME1'.
      wa_fcat-tabname = 'ITAB'.
      APPEND wa_fcat TO t_fcat.
      CLEAR t_fcat.
      wa_fcat-col_pos = 3.
      wa_fcat-row_pos = 1.
      wa_fcat-seltext_s = 'Vendor TIN Number'.
      wa_fcat-seltext_m = 'Vendor TIN Number'.
      wa_fcat-seltext_l = 'Vendor TIN Number'.
      wa_fcat-fieldname = 'STCD2'.
      wa_fcat-tabname = 'ITAB'.
      APPEND wa_fcat TO t_fcat.
      CLEAR t_fcat.
      wa_fcat-col_pos = 4.
      wa_fcat-row_pos = 1.
      wa_fcat-seltext_s = 'Document No'.
      wa_fcat-seltext_m = 'Document No'.
      wa_fcat-seltext_l = 'Document No'.
      wa_fcat-fieldname = 'BELNR'.
      wa_fcat-tabname = 'ITAB'.
      APPEND wa_fcat TO t_fcat.
      CLEAR t_fcat.
      wa_fcat-col_pos = 5.
      wa_fcat-row_pos = 1.
      wa_fcat-seltext_s = 'Item Number'.
      wa_fcat-seltext_m = 'Item Number'.
      wa_fcat-seltext_l = 'Item Number'.
      wa_fcat-fieldname = 'BUZEI'.
      wa_fcat-tabname = 'ITAB'.
      APPEND wa_fcat TO t_fcat.
      CLEAR t_fcat.
      wa_fcat-col_pos = 6.
      wa_fcat-row_pos = 1.
      wa_fcat-seltext_s = 'Fiscal Year'.
      wa_fcat-seltext_m = 'Fiscal Year'.
      wa_fcat-seltext_l = 'Fiscal Year'.
      wa_fcat-fieldname = 'GJAHR'.
      wa_fcat-tabname = 'ITAB'.
      APPEND wa_fcat TO t_fcat.
      CLEAR t_fcat.
    ENDFORM.                    " BUILD_FIELDCATALOG
         Form  BUILD_LAYOUT
    FORM BUILD_LAYOUT .
    GD_LAYOUT-NO_INPUT = 'X'.
    GD_LAYOUT-COLWIDTH_OPTIMIZE = 'X'.
    GD_LAYOUT-TOTALS_TEXT = 'TOTALS'.
    ENDFORM.                    " BUILD_LAYOUT
         Form  BUILD_ALV_GRID_DISPLAY
    FORM BUILD_ALV_GRID_DISPLAY .
    gd_repid = sy-repid.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
           EXPORTING
                i_callback_program      = gd_repid
                i_callback_top_of_page  = 'TOP-OF-PAGE'  "see FORM
                i_callback_user_command = 'USER_COMMAND'
                is_layout               = gd_layout
                it_fieldcat             = t_fcat[]
                it_events               = gt_events
                is_print                = gd_prntparams
                it_sort                 = it_sortcat[]
                i_save                  = 'X'
           TABLES
                t_outtab                = ITAB
           EXCEPTIONS
                program_error           = 1
                OTHERS                  = 2.
    Edited by: Murugesh P on Apr 6, 2009 10:54 AM
    Edited by: Murugesh P on Apr 6, 2009 10:54 AM

Maybe you are looking for

  • Knowing when an item value has changed

    Hello If you have a item in a form - :P1_fred which is a database columm fred The database table conrtaining fred columm is read and updated by 1) Automated Row Fetch 2) Automatic Row Processing This works fine I need to add a condition based if the

  • Problem in BPM Scenario

    While creating the integration process in which i have one receiver and two senders . Whenever i try to assign anything to message in properties window nothing happens it just gets stuck at that point. Please help me out!

  • Apps is shaking ( loos )

    i have down loaded a game from Mosh ( midnight pool 2 ) its work very good with N78 but each time i exit the game ,I see the some of the other apps i have down loaded are shaking ,Now the Million dollar question , is this game (apps) is corrupted or

  • Outer join With a constant value

    Hi all, In one of query i have found out that the outer join with a constant value like to_currency(+)='USD' to_currency is a column name in a table.can any one please explain this outer join condtn. Thanks in advance Senthil

  • ASA Iphone, Ipad VPN client pre-shared key (PSK) special characters bug

    I ran into this in a deployment of IPSec clients with apple ipad and iphone native vpn client. Here are details: Cisco ASA 8.2.5 OS Ipad, running 5.0.1 Iphone i4S, running OS 5.0.1 Special characters make your pre-shared key more secure, so i used a