ALV-Header colour display

hi i  need to display my header of alv in colour format...
can u tell me function module what is used for this requirement.....
advance thanks ........................urgent

Hi Dasr,
  What do you mean by header of ALV? Do you mean column header or a box where we can write our own text?
Regards,
kiran i

Similar Messages

  • Alv heading to display in excel

    Hi
    i have a problem ,
    i want 2 take print of body of alv with ALV header.
    while printing , only body is comin for print-out, not a header.
    guide me.
    points vil be rewarded

    write the header under the event top-fo-page and use listheader structure and also use FM ALV_commentary _write
    see following code for example
    http://sapprograms.blogspot.com/2008/04/alv-grid-display-report.html

  • Regarding ALV Header to display at Right side of Header

    Hi dudes..
    How to handle ALV header to print content at right side of the report out-put.
    If we use ALV_list dispaly line size ends to 80 and Other than
    using OOP's is there any way to do this..
    Could You please let me know.How to handle this issue??
    Regards,
    Sg

    Hi,
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
    i_callback_program = 'ZALV_PRDS'
    i_callback_user_command = 'USER_COMMAND'
    i_callback_html_top_of_page = 'HTML_TOP_OF_PAGE' "for header alignment
    it_fieldcat = t_fcat
    i_save = 'A'
    it_events = t_eve
    TABLES
    t_outtab = itab
    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 html_top_of_page USING document TYPE REF TO cl_dd_document.
    DATA: text TYPE sdydo_text_element.
    CALL METHOD document->add_gap
    EXPORTING
    width = 200.
    text = 'Material Information'.
    CALL METHOD document->add_text
    EXPORTING
    text = text
    sap_style = 'HEADING'.
    CALL METHOD document->new_line.
    CALL METHOD document->new_line.
    CALL METHOD document->new_line.
    ENDFORM. "HTML_TOP_OF_PAGE
    For more details, refer to the methods of the class cl_dd_document
    Also check the below link.
    https://www.sdn.sap.com/irj/sdn/wiki?path=/pages/viewpage.action&pageid=37566
    Also this link
    Report header using ALV Grid(oops)
    Please reward points if it helps
    Thanks
    Vikranth

  • Alv report colour display

    hi
    i have a requirment in my alv report ,i need to show values of material description i.e  only gsm values in different colour i. 296 GSM and corresponding below values 285 GSM,.below show is sample output onf my alv report.
    materialno                              material deccription
                              GB CPB HWC 296 GSM 055.000 X 092.000
                              GB CPB HWC 296 GSM 082.000 X 117.000
                              GB CPB HWC 285 GSM 045.200 X 070.500
                              GB CPB HWC 285 GSM 045.200 X 070.500
                              GBCPB HWC 285 GSM 045.200 X 070.500
                              GB CPB HWC 285 GSM 045.200 X 070.500

    Hi
    i am sending you a code where i had colored one field
    you can refer this program and you can understand very well where exactly what we have to do for colors
    reward if usefull
    REPORT zalv_with_colored_fields  .
    TYPE-POOLS : slis.
    DATA : BEGIN OF it_final1 OCCURS 0,
             carrid TYPE spfli-carrid,
             connid TYPE spfli-connid,
             cityfrom TYPE spfli-cityfrom,
             cityto TYPE spfli-cityto,
             cellcolors TYPE lvc_t_scol,
             END OF it_final1 .
    DATA : BEGIN OF it_final OCCURS 0,
             carrid TYPE spfli-carrid,
             connid TYPE spfli-connid,
             cityfrom TYPE spfli-cityfrom,
             cityto TYPE spfli-cityto,
             END OF it_final .
    DATA : git_cellcolors TYPE TABLE OF lvc_s_scol,
           gwa_color    TYPE lvc_s_scol,
           layout       TYPE slis_layout_alv.
    DATA : it_fieldcat TYPE slis_t_fieldcat_alv,
           wa_fieldcat LIKE LINE OF it_fieldcat.
    START-OF-SELECTION .
      SELECT carrid connid cityfrom cityto FROM spfli INTO TABLE it_final .
      wa_fieldcat-col_pos   = '0'.
      wa_fieldcat-tabname   = 'IT_FINAL' .
      wa_fieldcat-fieldname = 'CARRID' .
      wa_fieldcat-seltext_m = 'Carrier ID'(001) .
      APPEND wa_fieldcat TO it_fieldcat .
      wa_fieldcat-col_pos   = '1'.
      wa_fieldcat-tabname   = 'IT_FINAL' .
      wa_fieldcat-fieldname = 'CONNID' .
      wa_fieldcat-seltext_m = 'Flight Connection Number'(002) .
      APPEND wa_fieldcat TO it_fieldcat .
      wa_fieldcat-col_pos   = '2'.
      wa_fieldcat-tabname   = 'IT_FINAL' .
      wa_fieldcat-fieldname = 'CITYFROM' .
      wa_fieldcat-seltext_m = 'City from'(003) .
      APPEND wa_fieldcat TO it_fieldcat .
      wa_fieldcat-col_pos   = '3'.
      wa_fieldcat-tabname   = 'IT_FINAL' .
      wa_fieldcat-fieldname = 'CITYTO' .
      wa_fieldcat-seltext_m = 'City to'(004) .
      APPEND wa_fieldcat TO it_fieldcat .
      LOOP AT it_final .
        it_final1-carrid   = it_final-carrid.
        it_final1-connid   = it_final-connid.
        it_final1-cityfrom = it_final-cityfrom.
        it_final1-cityto   = it_final-cityto.
        CLEAR gwa_color.
      <b>  IF it_final-carrid    = 'AA' .
          gwa_color-fname     = 'CARRID'.
          gwa_color-nokeycol  = '1'.
         gwa_color-color-col = '6'.
          gwa_color-color-int = '1'.</b>
          APPEND gwa_color TO git_cellcolors.
          it_final1-cellcolors = git_cellcolors.
        ENDIF.
        IF it_final-carrid    = 'AZ' .
          gwa_color-fname     = 'CARRID'.
         gwa_color-nokeycol  = '1'.
          gwa_color-color-col = '5'.
          gwa_color-color-int = '1'.
          APPEND gwa_color TO git_cellcolors.
          it_final1-cellcolors = git_cellcolors.
        ENDIF.</b>
        REFRESH git_cellcolors.
        APPEND it_final1.
        CLEAR : it_final , it_final1 .
      ENDLOOP.
      layout-coltab_fieldname = 'CELLCOLORS'.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          is_layout   = layout
          it_fieldcat = it_fieldcat
        TABLES
          t_outtab    = it_final1.

  • ALV header cannot display fully as assigned in fieldcatolog

    Hi,
      my ALV output has nearly 100 columns. i assign the fieldcatlog as below.
      CLEAR ls_fcat.
      ls_fcat-fieldname = 'ANSWER01' .
      ls_fcat-scrtext_l = text-011 .
      APPEND ls_fcat TO gt_fieldcat.
      in sap the field 'ls_fcat-scrtext_l' is 40 char length. and some text-XXX has length less than 40 char but still not display fully in the ALV output screen .
    i also assign the layout as '    gs_layout-cwidth_opt = 'X'    '.
    how to resolve the bug ?

    give this also...
    fieldcat-ddictxt = 'L' "<---- L for Long, S for SHort , M for Medium
    fieldcat-seltext_l = text-002.
    and check .

  • Displaying blank line in ALV header

    How do I display a blank line in ALV header
    For eg i want if i want the ALV header to display as follows
    Document Datewise Report  as of 31/10/2009 
                                                     <-- BLANK LINE
    Run On : 01/12/2009

    Hi,
      Are you using 'REUSE_ALV_COMMENTARY_WRITE' for displaying the header?
    If yes, then I think it is not possible. Instead, use the events table to achieve it.
    Use the 'REUSE_ALV_EVENTS_GET' FM to get all possible events and then modify
    the events internal table to specify the form name to handle top-of-page event.
    eg.
    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.
    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.
    FORM TOP_OF_PAGE.
    * Use write statements to display the header data.
    ENDFORM.
    In write statement use '/' to go to new line. So to insert an empty line you can use something like
    write : 'some text' / / 'some text' .
    Hope this helps.
    Regards,
    Bhavesh.

  • How to display total in ALV Header

    How to display total in ALV Header?

    Hi Venkey,
    As far as your issue is concerned I would like to quote my perception.
    Create a header internal table with title and number of records.
    At the later part of your program you should have found the total number of records ,now assign it to the header internal table and print it.
    For further clarification you can go check this link:
    http://wiki.sdn.sap.com/wiki/display/ABAP/AddHeadertoALVreport
    Thanks
    P.Srikanth

  • Displaying selection screen details in Alv Report  output display as Header

    Hi all,
    May be somebody knows how I can show selected values with select-options in top_of_page using REUSE_ALV_GRID_DISPLAY.
    This shoud work for all the reports and diff selection screens .
    I need one dynamic process which will for display any report selection screen selected details.(Basically varient information of report).
    Small example if possible, please.
    Thanks in advance,
    Rimas

    Hi Thiru,
    Thanks for the input.
    This is my exact requirement.
    Hi Experts,
    I would like to Display / Print  Select-options selected details in ALV Header.
    Ex: Say suppose here i enter kunnr as 1000
                                            lifnr as    2000 to 4000
                                            p_langu as  'EN'.
                                           p_dir  as 'C:\TEMP,
                                           p_upda as 'X'
    for selection screen below.                    
    SELECTION-SCREEN :BEGIN OF BLOCK blk1 WITH FRAME TITLE text-000.
    SELECT-OPTIONS : s_kunnr FOR kna1-kunnr.
    SELECT-OPTIONS : s_lifnr FOR lfa1-lifnr.
    PARAMETER      : p_lanuge LIKE t002-spras DEFAULT sy-langu.
    PARAMETER: p_dir  LIKE rlgrap-filename
               DEFAULT text-003 LOWER CASE.
    PARAMETERS: p_upd AS CHECKBOX DEFAULT 'X'.
    I dont want to Hard code selection screen values like
    DATA: header TYPE slis_t_listheader,
    wa TYPE slis_listheader,
    wa-typ = 'S'(093).
      wa-key = s_lifnr .
      wa-info = 'Vendor no".
      APPEND wa TO header.
    I want dynamic process for all of my selection screen values selected
    hard code may be it will be fine small selection screen it will work.
    Fur that i got one process to get dynamically through fm
    Ex: DATA: irsparams TYPE rsparams OCCURS 0 WITH HEADER LINE.
    CALL FUNCTION 'RS_REFRESH_FROM_SELECTOPTIONS'
    EXPORTING
    curr_report = program
    TABLES
    selection_table = irsparams
    EXCEPTIONS
    not_found = 1
    no_report = 2
    OTHERS = 3.
    loop at irsparams.
    write : / irsparams-SELNAME.
    write : / irsparams-SIGN.
    write : / irsparams-OPTION.
    write : / irsparams-LOW.
    write : / irsparams-HIGH.
    endloop.
    I have done my requirement partially but i am failed to achive my full  requirement.
    Because
    rsparams  strcture is diff from  slis_t_listheader.
    Can any one help me for further assistence to display irsparams strcture data in alv header.
    Thanks
    Nag

  • How to Display Logo in ALV Header?

    Hi
    I want to display/ print my company logo image in ALV Header. Please help me how can I do this?
    Thanks
    Iftikhar Ali
    Islamabad.

    Hi,
    If you are already   having a logo say ZLOGO .
    You can use it this way .
    Give TOP-OF-PAGE
    call function 'REUSE_ALV_GRID_DISPLAY'
           exporting
                i_callback_program      = gd_repid
                i_callback_top_of_page   = 'TOP-OF-PAGE'  "see FORM
                is_layout               = gd_layout
                it_fieldcat             = fieldcatalog[]
                i_save                  = 'X'
           tables
                t_outtab                = it_ekko
           exceptions
                program_error           = 1
                others                  = 2.
    And in top of page do this .
    FORM top-of-page.
    CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRIT
      EXPORTING
       IT_LIST_COMMENTARY       = IT_LISTHE
       i_logo                   = 'ZLOGO'
      I_END_OF_LIST_GRID       =
    endform.
    Hope this will work .
    Reward if found useful.
    Regards
    SureshP.

  • Displaying selection screen data on alv header in multiple rows and columns

    Hi
    Presently in my requirement , whatever  the data entered in  selection screen  should display  on alv header  and item details on alv grid display.
    for eg...
    on alv header
      customer no :  1000 to 2000         sales order no: 111
      name :    gff to ff                                 sales org:
      city:                                         country:
      item details below this   
      plz guide me how to solve this issue.
    Thanks & Regards,
    Pradeep

    Hi,
    Check this code this may help you.
    <code>
    TYPE-POOLS : SLIS.
    TABLES VBRK.
    TYPES : BEGIN OF TY_VBRK,
            VBELN TYPE VBRK-VBELN,
            VKORG TYPE VBRK-VKORG,
            VTWEG TYPE VBRK-VTWEG,
            SPART TYPE VBRK-SPART,
            FKDAT TYPE VBRK-FKDAT,
            END OF TY_VBRK,
            BEGIN OF TY_VBRP,
            VBELN TYPE VBRP-VBELN,
            POSNR TYPE VBRP-POSNR,
            MATNR TYPE VBRP-MATNR,
            ARKTX TYPE VBRP-ARKTX,
            FKIMG TYPE VBRP-FKIMG,
            NETWR TYPE VBRP-NETWR,
            END OF TY_VBRP,
            BEGIN OF TY_TARGET,
            VBELN TYPE VBRK-VBELN,
            VKORG TYPE VBRK-VKORG,
            VTWEG TYPE VBRK-VTWEG,
            SPART TYPE VBRK-SPART,
            FKDAT TYPE VBRK-FKDAT,
            POSNR TYPE VBRP-POSNR,
            MATNR TYPE VBRP-MATNR,
            ARKTX TYPE VBRP-ARKTX,
            FKIMG TYPE VBRP-FKIMG,
            NETWR TYPE VBRP-NETWR,
            END OF TY_TARGET.
    DATA : T_VBRK TYPE TABLE OF TY_VBRK,
           W_VBRK TYPE TY_VBRK,
            T_VBRP TYPE TABLE OF TY_VBRP,
            W_VBRP TYPE TY_VBRP,
            T_TARGET TYPE TABLE OF TY_TARGET,
            W_TARGET TYPE TY_TARGET,
    FIELD CATALOG ******************
            T_FCAT TYPE SLIS_T_FIELDCAT_ALV,
            W_FCAT TYPE SLIS_FIELDCAT_ALV,
    *************************************SUB TOTALS AND SORTING***********
            T_SORT TYPE SLIS_T_SORTINFO_ALV,
            W_SORT TYPE SLIS_SORTINFO_ALV,
    *************************************FOR LIST HEADER******************
            T_LIST_HEAD TYPE SLIS_T_LISTHEADER,
            W_LIST_HEAD TYPE SLIS_LISTHEADER,
            T_LIST_HEAD1 TYPE SLIS_T_LISTHEADER,
            W_LIST_HEAD1 TYPE SLIS_LISTHEADER,
    *************************************FOR LIST HEADER******************
            W_LAYOUT TYPE SLIS_LAYOUT_ALV,
    ************************************FOR EVENTS************************
            T_EVENT TYPE SLIS_T_EVENT,
            W_EVENT TYPE SLIS_ALV_EVENT.
    *********************************SELECT OPTIONS***********************
    SELECT-OPTIONS : S_VBELN FOR VBRK-VBELN DEFAULT 90005316 TO 90005330.
    **RETRIVING DATA************************
    PERFORM DATA_RETRIVE.
    **BUILDING THE FIELD CATALOG************
    PERFORM BUILD_FCAT.
    **BUILDING THE TABLE FOR LIST HEADER****
    PERFORM BUILD_LIST_HEAD.
    *******************************CALLING THE FUNCTION MODULE************
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
      EXPORTING
        I_CALLBACK_PROGRAM     = SY-REPID
        I_CALLBACK_TOP_OF_PAGE = 'LIST_TOP_OF_PAGE'
        IT_FIELDCAT            = T_FCAT
        IT_SORT                = T_SORT
      TABLES
        T_OUTTAB               = T_TARGET.
    *&      Form  DATA_RETRIVE
    FORM DATA_RETRIVE .
    SELECT VBELN VKORG VTWEG SPART FKDAT FROM VBRK INTO CORRESPONDING FIELDS
    OF TABLE T_VBRK WHERE VBELN IN S_VBELN.
      IF SY-SUBRC EQ 0.
        SORT T_VBRK BY VBELN.
        SELECT VBELN POSNR MATNR ARKTX FKIMG NETWR FROM VBRP INTO TABLE
         T_VBRP FOR ALL ENTRIES IN T_VBRK WHERE VBELN = T_VBRK-VBELN.
      ENDIF.
      LOOP AT T_VBRP INTO W_VBRP.
        LOOP AT T_VBRK INTO W_VBRK WHERE VBELN = W_VBRP-VBELN.
          W_TARGET-VBELN = W_VBRK-VBELN.
          W_TARGET-VKORG = W_VBRK-VKORG.
          W_TARGET-VTWEG = W_VBRK-VTWEG.
          W_TARGET-SPART = W_VBRK-SPART.
          W_TARGET-FKDAT = W_VBRK-FKDAT.
          W_TARGET-POSNR = W_VBRP-POSNR.
          W_TARGET-MATNR = W_VBRP-MATNR.
          W_TARGET-ARKTX = W_VBRP-ARKTX.
          W_TARGET-FKIMG = W_VBRP-FKIMG.
          W_TARGET-NETWR = W_VBRP-NETWR.
          APPEND W_TARGET TO T_TARGET.
        ENDLOOP.
      ENDLOOP.
      SORT T_TARGET BY VBELN.
    ENDFORM.                    " DATA_RETRIVE
    *&      Form  BUILD_FCAT
    FORM BUILD_FCAT .
      W_FCAT-COL_POS = 1.
      W_FCAT-FIELDNAME = 'VBELN'.
      W_FCAT-SELTEXT_M = 'BILLING NO'.
      APPEND W_FCAT TO T_FCAT.
      W_FCAT-COL_POS = 2.
      W_FCAT-FIELDNAME = 'VKORG'.
      W_FCAT-SELTEXT_M = 'SALES ORGANIZATION'.
      APPEND W_FCAT TO T_FCAT.
      W_FCAT-COL_POS = 3.
      W_FCAT-FIELDNAME = 'VTWEG'.
      W_FCAT-SELTEXT_M = 'DISTRIBUTION CHANNEL'.
      APPEND W_FCAT TO T_FCAT.
      W_FCAT-COL_POS = 4.
      W_FCAT-FIELDNAME = 'SPART'.
      W_FCAT-SELTEXT_M = 'DIVISION'.
      APPEND W_FCAT TO T_FCAT.
      W_FCAT-COL_POS = 5.
      W_FCAT-FIELDNAME = 'FKDAT'.
      W_FCAT-SELTEXT_M = 'CREATION DATE'.
      APPEND W_FCAT TO T_FCAT.
      W_FCAT-COL_POS = 6.
      W_FCAT-FIELDNAME = 'POSNR'.
      W_FCAT-SELTEXT_M = 'BILLING ITEM'.
      APPEND W_FCAT TO T_FCAT.
      W_FCAT-COL_POS = 7.
      W_FCAT-FIELDNAME = 'MATNR'.
      W_FCAT-SELTEXT_M = 'MATERIAL NUM'.
      APPEND W_FCAT TO T_FCAT.
      W_FCAT-COL_POS = 8.
      W_FCAT-FIELDNAME = 'ARKTX'.
      W_FCAT-SELTEXT_M = 'DESCRIPTION'.
      APPEND W_FCAT TO T_FCAT.
      W_FCAT-COL_POS = 9.
      W_FCAT-FIELDNAME = 'FKIMG'.
      W_FCAT-SELTEXT_M = 'QUANTITY'.
      APPEND W_FCAT TO T_FCAT.
      W_FCAT-COL_POS = 10.
      W_FCAT-FIELDNAME = 'NETWR'.
      W_FCAT-SELTEXT_M = 'NET VALUE'.
      W_FCAT-DO_SUM = 'X'.
      APPEND W_FCAT TO T_FCAT.
    ENDFORM.                    " BUILD_FCAT
    *&      Form  BUILD_LIST_HEAD
    FORM BUILD_LIST_HEAD .
      DATA : L_DATE(10),
             L_TIME(8).
      W_LIST_HEAD-TYP = 'S'.
      W_LIST_HEAD-KEY = 'Sales org :'.
      W_LIST_HEAD-INFO = S_VBELN-LOW .
      APPEND W_LIST_HEAD TO T_LIST_HEAD.
      CLEAR W_LIST_HEAD.
      W_LIST_HEAD-TYP = 'S'.
      W_LIST_HEAD-KEY = 'TO '.
      W_LIST_HEAD-INFO =  S_VBELN-HIGH.
      APPEND W_LIST_HEAD TO T_LIST_HEAD.
      CLEAR W_LIST_HEAD.
    ENDFORM.                    " BUILD_LIST_HEAD
    *&      Form  LIST_TOP_OF_PAGE
    FORM LIST_TOP_OF_PAGE .
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
        EXPORTING
          IT_LIST_COMMENTARY = T_LIST_HEAD.
    ENDFORM.                    " LIST_TOP_OF_PAGE
    <code>
    Regards

  • ALV  HEADER DISPLAY IN VERTICAL

    HI,
    IT IS POSSIBLE TO DISPLAY THE  ALV HEADING IN VERTICAL .
    PLZ GIVE ME THE DETAILS.
    THANKS,
    S.RANI

    Hi,
    You can refer the Link:
    < link to blocked site removed by moderator>
    Hope, this helps you,
    Regards,
    Kris
    Edited by: Thomas Zloch on Oct 27, 2011 9:12 AM

  • Values from alv hierarchical list display

    hi all,
    i need to display sme values from vbak and vbap tables in ALV hierarchical list display.if i click on the sales order of the header, it should directly go to the second screen of transaction VA03 with the sales details displayed..
       i got the parameter id, how can i assign the selected sales order value to this parameter id?...
    regards,
    Hamsa Priya

    Hi,
    Check this example..Marked in bold..
    TYPE-POOLS: slis.
    DATA: BEGIN OF itab OCCURS 0,
            vbeln TYPE vbeln,
            expand,
          END OF itab.
    DATA: BEGIN OF itab1 OCCURS 0,
            vbeln TYPE vbeln,
            posnr TYPE posnr,
            matnr TYPE matnr,
            netpr TYPE netpr,
          END OF itab1.
    DATA: t_fieldcatalog TYPE slis_t_fieldcat_alv.
    DATA: s_fieldcatalog TYPE slis_fieldcat_alv.
    s_fieldcatalog-col_pos = '1'.
    s_fieldcatalog-fieldname = 'VBELN'.
    s_fieldcatalog-tabname   = 'ITAB'.
    s_fieldcatalog-rollname  = 'VBELN'.
    s_fieldcatalog-outputlen = '12'.
    APPEND s_fieldcatalog TO t_fieldcatalog.
    CLEAR: s_fieldcatalog.
    s_fieldcatalog-col_pos = '1'.
    s_fieldcatalog-fieldname = 'VBELN'.
    s_fieldcatalog-tabname   = 'ITAB1'.
    s_fieldcatalog-rollname  = 'VBELN'.
    s_fieldcatalog-outputlen = '12'.
    APPEND s_fieldcatalog TO t_fieldcatalog.
    CLEAR: s_fieldcatalog.
    s_fieldcatalog-col_pos = '2'.
    s_fieldcatalog-fieldname = 'POSNR'.
    s_fieldcatalog-tabname   = 'ITAB1'.
    s_fieldcatalog-rollname  = 'POSNR'.
    APPEND s_fieldcatalog TO t_fieldcatalog.
    CLEAR: s_fieldcatalog.
    s_fieldcatalog-col_pos = '3'.
    s_fieldcatalog-fieldname = 'MATNR'.
    s_fieldcatalog-tabname   = 'ITAB1'.
    s_fieldcatalog-rollname  = 'MATNR'.
    APPEND s_fieldcatalog TO t_fieldcatalog.
    CLEAR: s_fieldcatalog.
    s_fieldcatalog-col_pos = '4'.
    s_fieldcatalog-fieldname = 'NETPR'.
    s_fieldcatalog-tabname   = 'ITAB1'.
    s_fieldcatalog-rollname  = 'NETPR'.
    s_fieldcatalog-do_sum    = 'X'.
    APPEND s_fieldcatalog TO t_fieldcatalog.
    CLEAR: s_fieldcatalog.
    DATA: s_layout TYPE slis_layout_alv.
    s_layout-subtotals_text            = 'SUBTOTAL TEXT'.
    s_layout-key_hotspot = 'X'.
    s_layout-expand_fieldname = 'EXPAND'.
    SELECT vbeln UP TO 100 ROWS
           FROM
           vbak
           INTO TABLE itab
           WHERE vbeln > '0060000040'.
    IF NOT itab[] IS INITIAL.
      SELECT vbeln posnr matnr netpr
             FROM vbap
             INTO TABLE itab1
             FOR ALL ENTRIES IN itab
             WHERE vbeln = itab-vbeln.
    ENDIF.
    DATA: v_repid TYPE syrepid.
    v_repid = sy-repid.
    DATA: s_keyinfo TYPE slis_keyinfo_alv.
    s_keyinfo-header01 = 'VBELN'.
    s_keyinfo-item01   = 'VBELN'.
    CALL FUNCTION 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'
         EXPORTING
              i_callback_program      = v_repid
    <b>          i_callback_user_command = 'USER_COMMAND'</b>
              is_layout               = s_layout
              it_fieldcat             = t_fieldcatalog
              i_tabname_header        = 'ITAB'
              i_tabname_item          = 'ITAB1'
              is_keyinfo              = s_keyinfo
         TABLES
              t_outtab_header         = itab
              t_outtab_item           = itab1
         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.
    <b>FORM user_command USING ucomm LIKE sy-ucomm
    selfield TYPE slis_selfield.
      IF ucomm = '&IC1' AND selfield-fieldname = 'VBELN'.
        READ TABLE itab INDEX selfield-tabindex.
        IF sy-subrc = 0.
    document
          SET PARAMETER ID 'AUN' FIELD itab-vbeln.
          CALL TRANSACTION 'VA03' AND SKIP FIRST SCREEN.
        ENDIF.
      ENDIF.
    ENDFORM.</b>
    Thanks,
    Naren

  • FIELD VALUE IN ALV HEADER

    Hi friends,
    I make one header alv ok I want and take one variable count in my program so I want to display its value in ALV HEADER
    Total Target Qty:
    Total EMP. Efficiency 
    Total Machine Effi. 
    I take may header like this and pass thre text here.ok Now I want to display value of this three.
    Total Trget Qty: 2.23 like that.
    CLEAR st_line.
      st_line-typ = 'S'.
      CONCATENATE 'Total Target Qty: '  count     ' ' INTO st_line-info.
      APPEND st_line TO t_list_top_of_page.
    So I took like this in header count is my variable in which I take value.
    So how can we pass the value in ALV Header please tell me.
    its urgent so.
    Thnaks in Advance.
    Prashant.

    HI DHWANI,
    *& Report  ZPP_RE_EMP_DETAILS
    *& This Report is used to check the Employee Performance And Used Machine Quantity
    *& Rqueirement By Santhosh
    *& Developed By Prashant On Date 01.02.2008
    *&  Created By: Prashant Brahmbhatt
    *&  Creation Date: 20080201
    *&  Module: PP (Production & Plannig)
    *&  Changed By         Changed Date        Reason
    REPORT  zpp_re_emp_details.
    TABLES:zpplan.
    TYPE-POOLS:slis.
    DATA:BEGIN OF itab OCCURS 0,
         zdate LIKE zpplan-zdate,
         werks LIKE zpplan-werks,
         mname LIKE zpplan-mname,
         shftin LIKE zpplan-shftin,
         iserh LIKE zpplan-iserh,
         quaty LIKE zpplan-quaty,
         plan_qty LIKE zpplan-plan_qty,
         act_prod LIKE zpplan-act_prod,
         temp TYPE c,
         tar_qty(10) TYPE c,
         ach_qty(10) TYPE c,
         mch_eff(10) TYPE c,
        a(10) TYPE c,
         END OF itab.
    DATA:BEGIN OF temp OCCURS 0,
         zdate LIKE zpplan-zdate,
         werks LIKE zpplan-werks,
         mname LIKE zpplan-mname,
         shftin LIKE zpplan-shftin,
         iserh LIKE zpplan-iserh,
         quaty LIKE zpplan-quaty,
         plan_qty LIKE zpplan-plan_qty,
         act_prod LIKE zpplan-act_prod,
         temp TYPE c,
         tar_qty(10) TYPE c,
         ach_qty(10) TYPE c,
         mch_eff(10) TYPE c,
        a(10) TYPE c,
         END OF temp.
    DATA:BEGIN OF itab_t OCCURS 0,
         zdate LIKE zpplan-zdate,
         werks LIKE zpplan-werks,
         mname LIKE zpplan-mname,
         shftin LIKE zpplan-shftin,
         iserh LIKE zpplan-iserh,
         quaty LIKE zpplan-quaty,
         plan_qty LIKE zpplan-plan_qty,
         act_prod LIKE zpplan-act_prod,
         temp TYPE c,
         tar_qty(10) TYPE c,
         ach_qty(10) TYPE c,
         mch_eff(10) TYPE c,
        a(10) TYPE c,
         END OF itab_t.
    DATA:BEGIN OF itab1 OCCURS 0,
         zdate LIKE zpplan-zdate,
         werks LIKE zpplan-werks,
         mname LIKE zpplan-mname,
         shftin LIKE zpplan-shftin,
         act_prod LIKE zpplan-act_prod,
         quaty LIKE zpplan-quaty,
         planned LIKE zpplan-planned,
         iserh LIKE zpplan-iserh,
         temp TYPE c,
         tar_qty TYPE p DECIMALS 2,
         ach_qty TYPE p DECIMALS 2,
         mch_eff TYPE p DECIMALS 2,
         END OF itab1.
    DATA: wa LIKE  itab1.
    DATA:BEGIN OF itab2 OCCURS 0,
         zdate LIKE zpplan-zdate,
         werks LIKE zpplan-werks,
         mname LIKE zpplan-mname,
         shftin LIKE zpplan-shftin,
         act_prod LIKE zpplan-act_prod,
         quaty LIKE zpplan-quaty,
         planned LIKE zpplan-planned,
         iserh LIKE zpplan-iserh,
         temp TYPE c,
         tar_qty(10) TYPE p DECIMALS 2,
         ach_qty(10) TYPE p DECIMALS 2,
         mch_eff(10) TYPE p DECIMALS 2,
         count(10) TYPE c,
         END OF itab2.
    DATA: a(10) TYPE c,
          b(10) TYPE c,
          count(10) TYPE c,
          count1(10) TYPE c.
         c(2) TYPE p DECIMALS 2.
    DATA:t_fcat TYPE slis_t_fieldcat_alv,
         t_events TYPE slis_t_event,
         t_list_top_of_page TYPE slis_t_listheader,
         t_list_end_of_page TYPE slis_t_listheader.
    CONSTANTS:c_formname_top_of_page TYPE slis_formname VALUE 'TOP_OF_PAGE'.
    CONSTANTS:c_formname_end_of_page TYPE slis_formname VALUE 'END_OF_PAGE'.
    DATA: st_line TYPE slis_listheader.
                  SELECTION-SCREEN
    SELECTION-SCREEN:BEGIN OF BLOCK blk1 WITH FRAME TITLE text-001.
    *PARAMETERS:shftin LIKE zpplan-shftin.
    SELECT-OPTIONS:date FOR zpplan-zdate,
                   shftin FOR zpplan-shftin,
                   werks FOR zpplan-werks.
    SELECTION-SCREEN:END OF BLOCK blk1.
                   ALV CALL
    INITIALIZATION.
      PERFORM build_fieldcatalog USING t_fcat .
      PERFORM event_call.
      PERFORM head_built USING t_events.
    START-OF-SELECTION.
      PERFORM data_retrieval.
      PERFORM display_alv.
    *&      Form  build_fieldcatalog
          text
         -->P_T_FCAT  text
    FORM build_fieldcatalog  USING temp_fcat TYPE slis_t_fieldcat_alv.
      DATA:w_fcat TYPE slis_fieldcat_alv.
      w_fcat-tabname = 'ITAB2'.
      w_fcat-fieldname = 'MNAME'.
      w_fcat-seltext_m = 'Machine Name'.
      APPEND w_fcat TO temp_fcat.
      CLEAR w_fcat.
      w_fcat-tabname = 'ITAB2'.
      w_fcat-fieldname = 'SHFTIN'.
      w_fcat-seltext_m = 'Emp No'.
      APPEND w_fcat TO temp_fcat.
      CLEAR w_fcat.
      w_fcat-tabname = 'ITAB2'.
      w_fcat-fieldname = 'ZDATE'.
      w_fcat-seltext_m = 'Pos Date'.
      APPEND w_fcat TO temp_fcat.
      CLEAR w_fcat.
    w_fcat-tabname = 'ITAB2'.
    w_fcat-fieldname = 'QUATY'.
    w_fcat-seltext_m = 'Quantity'.
    APPEND w_fcat TO temp_fcat.
    CLEAR w_fcat.
      w_fcat-tabname = 'ITAB2'.
      w_fcat-fieldname = 'ACT_PROD'.
      w_fcat-seltext_m = 'Actual Quantity'.
      APPEND w_fcat TO temp_fcat.
      CLEAR w_fcat.
      w_fcat-tabname = 'ITAB2'.
      w_fcat-fieldname = 'ISERH'.
      w_fcat-seltext_m = 'Down Time'.
      APPEND w_fcat TO temp_fcat.
      CLEAR w_fcat.
      w_fcat-tabname = 'ITAB2'.
      w_fcat-fieldname = 'TAR_QTY'.
      w_fcat-seltext_m = 'Target Qty.'.
      APPEND w_fcat TO temp_fcat.
      CLEAR w_fcat.
      w_fcat-tabname = 'ITAB2'.
      w_fcat-fieldname = 'ACH_QTY'.
      w_fcat-seltext_m = 'EMP Effec.'.
      APPEND w_fcat TO temp_fcat.
      CLEAR w_fcat.
      w_fcat-tabname = 'ITAB2'.
      w_fcat-fieldname = 'MCH_EFF'.
      w_fcat-seltext_m = 'Machine Effec.'.
      APPEND w_fcat TO temp_fcat.
      CLEAR w_fcat.
    w_fcat-tabname = 'ITAB2'.
    w_fcat-fieldname = 'COUNT'.
    w_fcat-seltext_m = 'Machine Effec.'.
    APPEND w_fcat TO temp_fcat.
    CLEAR w_fcat.
    ENDFORM.                    " build_fieldcatalog
    *&      Form  event_call
          text
    -->  p1        text
    <--  p2        text
    FORM event_call .
      CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
       EXPORTING
         i_list_type           = 0
       IMPORTING
         et_events             = t_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  data_retrieval
          text
    -->  p1        text
    <--  p2        text
    FORM data_retrieval .
      IF shftin <> ''.
        SELECT zdate werks mname shftin  INTO CORRESPONDING FIELDS OF TABLE
         temp FROM zpplan
         WHERE shftin IN shftin
         AND zdate IN date
         AND werks IN werks.
      ELSE.
        SELECT zdate werks mname INTO CORRESPONDING FIELDS OF TABLE
           temp FROM zpplan
           WHERE  zdate IN date
           AND werks IN werks.
      ENDIF.
      SORT temp BY mname zdate shftin.
      DELETE ADJACENT DUPLICATES FROM temp.
      SORT temp BY mname shftin zdate.
      DELETE ADJACENT DUPLICATES FROM temp.
      APPEND temp.
      LOOP AT temp.
        SELECT zdate werks mname shftin act_prod quaty iserh   FROM zpplan INTO CORRESPONDING FIELDS OF TABLE itab_t
        WHERE mname = temp-mname
        AND zdate = temp-zdate
        AND werks = temp-werks.
        LOOP AT itab_t.
          MOVE-CORRESPONDING itab_t TO itab.
          APPEND itab.
        ENDLOOP.
      ENDLOOP.
      *******************************************8
    SELECT zdate werks mname shftin act_prod quaty iserh   FROM zpplan INTO CORRESPONDING FIELDS OF TABLE itab
         FOR ALL ENTRIES IN temp
         WHERE zdate = temp-zdate AND
               werks = temp-werks
              AND mname = temp-mname.
    SELECT zdate werks mname shftin act_prod quaty iserh   FROM zpplan INTO CORRESPONDING FIELDS OF TABLE itab
       WHERE zdate IN date AND
             werks IN werks AND
    shftin = shftin.
      SORT itab BY mname zdate.
    DELETE ADJACENT DUPLICATES FROM itab.
      LOOP AT itab.
        MOVE-CORRESPONDING itab TO itab1.
        COLLECT itab1.
      ENDLOOP.
      LOOP AT itab1.
        itab1-tar_qty = itab1-tar_qty + ( itab1-quaty / 3 ).
        IF  ( itab1-tar_qty NE 0 ).
          itab1-ach_qty = ( itab1-ach_qty +  itab1-act_prod / itab1-tar_qty ) * 100.
        ELSE.
          itab1-ach_qty = 0 * 100.
        ENDIF.
        itab1-mch_eff = ( ( 8 - itab1-iserh ) / 8 ) * 100.
        MODIFY itab1 TRANSPORTING tar_qty ach_qty mch_eff.
      ENDLOOP.
      LOOP AT itab1.
        READ TABLE itab1 INDEX 1 INTO wa.
        IF itab1-mname = wa-mname.
          itab1-zdate = wa-zdate.
          itab2-shftin = itab1-shftin.
          itab2-mname = itab1-mname.
          itab2-zdate = itab1-zdate.
               itab2-quaty = itab2-quaty + itab1-quaty.     
               itab2-act_prod = itab2-act_prod + itab1-act_prod.
               itab2-iserh = itab2-iserh + itab1-iserh.
               itab2-tar_qty = itab2-tar_qty + itab1-tar_qty.
               itab2-ach_qty = itab2-ach_qty + itab1-ach_qty.
          itab2-mch_eff = itab2-mch_eff + itab1-mch_eff.
        ELSE.
               APPEND itab2.
               CLEAR itab2.
               MOVE-CORRESPONDING itab1 TO wa.
          itab2-shftin = itab1-shftin.
          itab2-mname = itab1-mname.
          itab2-zdate = itab1-zdate.
          itab2-quaty = itab2-quaty + itab1-quaty.     
          itab2-act_prod = itab2-act_prod + itab1-act_prod.
               itab2-iserh = itab2-iserh + itab1-iserh.
               itab2-tar_qty = itab2-tar_qty + itab1-tar_qty.
               itab2-ach_qty = itab2-ach_qty + itab1-ach_qty.
               itab2-mch_eff = itab2-mch_eff + itab1-mch_eff.
        ENDIF.
      ENDLOOP.
      APPEND itab2.
      LOOP AT itab2.
        IF  ( itab2-tar_qty NE 0 ).
          itab2-ach_qty = ( itab2-ach_qty +  itab2-act_prod / itab2-tar_qty(10) ) * 100.
        ELSE.
          itab2-ach_qty = 0 * 100.
        ENDIF.
        itab2-mch_eff = ( ( 8 - itab2-iserh ) / 8 ) * 100.
        MODIFY itab2 TRANSPORTING tar_qty ach_qty mch_eff.
      ENDLOOP.
    APPEND itab2.
      LOOP AT itab2.
       count = sy-tfill.
        a = a + itab2-tar_qty.
        b = b + itab2-ach_qty.
      ENDLOOP.
      CLEAR itab2.
      itab2-tar_qty = a.
      itab2-ach_qty = b.
      APPEND itab2.
      CLEAR itab2.
      count = a / sy-tfill.
      count1 = b / sy-tfill.
      itab2-tar_qty = count.
      itab2-ach_qty = count1.
    itab2-tar_qty = count.
      APPEND itab2.
    ENDFORM.                    " data_retrieval
    *&      Form  head_built
          text
         -->P_T_EVE  text
    FORM head_built  USING    p_t_eve TYPE slis_t_event.
    count = a / sy-tfill.
      DATA: ls_event TYPE slis_alv_event.
      REFRESH t_list_top_of_page.
      READ TABLE p_t_eve WITH KEY name = slis_ev_top_of_page INTO ls_event.
      IF sy-subrc = 0.
        MOVE c_formname_top_of_page TO ls_event-form.
        MODIFY p_t_eve FROM ls_event   INDEX sy-tabix.
      ENDIF.
       CLEAR st_line.
        st_line-typ = 'S'.
        st_line-key = 'Total Target Qty: '.
        st_line-info = count.
        APPEND st_line TO t_list_top_of_page.
    CLEAR st_line.
    st_line-typ = 'S'.
    st_line-info = count.
    CONCATENATE 'Avg Target Qty.'  count  ' ' INTO st_line-info.
    APPEND st_line TO t_list_top_of_page.
      CLEAR st_line.
        st_line-typ = 'S'.
        st_line-key = 'Avg.EMP Efficiency: '.
        st_line-info = count1.
        APPEND st_line TO t_list_top_of_page.
      CLEAR st_line.
        st_line-typ = 'S'.
        st_line-key = 'Avg. Machine Efficincy: '.
       st_line-info = count.
        APPEND st_line TO t_list_top_of_page.
    REFRESH t_list_end_of_page.
    READ TABLE p_t_eve WITH KEY name =  slis_ev_end_of_list INTO ls_event.
    IF sy-subrc = 0.
       MOVE c_formname_end_of_page TO ls_event-form.
       MODIFY p_t_eve FROM ls_event INDEX sy-tabix.
    ENDIF.
    CLEAR st_line.
    st_line-typ = 'S'.
    CONCATENATE 'END OF PAGE' ' ' INTO st_line-info.
    APPEND st_line TO t_list_end_of_page.
    ENDFORM.                    " head_built
    *&      Form  top-of-page
          text
    FORM top_of_page.
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
        EXPORTING
          it_list_commentary = t_list_top_of_page
        I_LOGO                   =
        I_END_OF_LIST_GRID       =
        I_ALV_FORM               =
    ENDFORM.                    "top-of-page
    *&      Form  display_alv
          text
    -->  p1        text
    <--  p2        text
    FORM display_alv .
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
       EXPORTING
      I_INTERFACE_CHECK                 = ' '
      I_BYPASSING_BUFFER                = ' '
      I_BUFFER_ACTIVE                   = ' '
         i_callback_program                = 'ZPP_RE_EMP_DETAILS'
      I_CALLBACK_PF_STATUS_SET          = ' '
      I_CALLBACK_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                   = 'ALV_BACKGROUND'
       i_grid_title                      = 'EMP Information'
      I_GRID_SETTINGS                   =
      IS_LAYOUT                         =
         it_fieldcat                       = t_fcat
      IT_EXCLUDING                      =
      IT_SPECIAL_GROUPS                 =
      IT_SORT                           =
      IT_FILTER                         =
      IS_SEL_HIDE                       =
      I_DEFAULT                         = 'X'
      I_SAVE                            = ' '
      IS_VARIANT                        =
         it_events                         = t_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                          = itab2
    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

  • Space in Top of page on alv header

    Hi Experts,
    I do have a query on ALV , Can you please help me in solving my problem.
    Here goes my query...
    I have to develop a ALV where on the top of page i have to display two fields as shown in below which was highlighted in the screen
    http://img410.imageshack.us/my.php?image=op2sn9.jpg
    But i'm getting output as shown below screen
    http://img410.imageshack.us/my.php?image=op1ut4.jpg
    I have tried with space and all other alternatives but i'm unable to get the desired output.
    Can i have any sample code for the same
    Regards
    Nanda

    Hi,
    TABLES:     ekko.
    type-pools: slis.                                 "ALV Declarations
    *Data Declaration
    TYPES: BEGIN OF t_ekko,
    ebeln TYPE ekpo-ebeln,
      ebelp TYPE ekpo-ebelp,
      statu TYPE ekpo-statu,
      aedat TYPE ekpo-aedat,
      matnr TYPE ekpo-matnr,
      menge TYPE ekpo-menge,
      meins TYPE ekpo-meins,
      netpr TYPE ekpo-netpr,
      peinh TYPE ekpo-peinh,
    END OF t_ekko.
    DATA: it_ekko TYPE STANDARD TABLE OF t_ekko INITIAL SIZE 0,
          wa_ekko TYPE t_ekko.
    *ALV data declarations
    data: fieldcatalog type slis_t_fieldcat_alv with header line,
          gd_tab_group type slis_t_sp_group_alv,
          gd_layout    type slis_layout_alv,
          gd_repid     like sy-repid,
          gt_events     type slis_t_event,
          gd_prntparams type slis_print_alv.
    *Start-of-selection.
    START-OF-SELECTION.
    perform data_retrieval.
    perform build_fieldcatalog.
    perform build_layout.
    perform build_events.
    perform build_print_params.
    perform display_alv_report.
    *&      Form  BUILD_FIELDCATALOG
    *       Build Fieldcatalog for ALV Report
    form build_fieldcatalog.
    * There are a number of ways to create a fieldcat.
    * For the purpose of this example i will build the fieldcatalog manualy
    * by populating the internal table fields individually and then
    * appending the rows. This method can be the most time consuming but can
    * also allow you  more control of the final product.
    * Beware though, you need to ensure that all fields required are
    * populated. When using some of functionality available via ALV, such as
    * total. You may need to provide more information than if you were
    * simply displaying the result
    *               I.e. Field type may be required in-order for
    *                    the 'TOTAL' function to work.
      fieldcatalog-fieldname   = 'EBELN'.
      fieldcatalog-seltext_m   = 'Purchase Order'.
      fieldcatalog-col_pos     = 0.
      fieldcatalog-outputlen   = 10.
      fieldcatalog-emphasize   = 'X'.
      fieldcatalog-key         = 'X'.
    *  fieldcatalog-do_sum      = 'X'.
    *  fieldcatalog-no_zero     = 'X'.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'EBELP'.
      fieldcatalog-seltext_m   = 'PO Item'.
      fieldcatalog-col_pos     = 1.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'STATU'.
      fieldcatalog-seltext_m   = 'Status'.
      fieldcatalog-col_pos     = 2.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'AEDAT'.
      fieldcatalog-seltext_m   = 'Item change date'.
      fieldcatalog-col_pos     = 3.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'MATNR'.
      fieldcatalog-seltext_m   = 'Material No'.
      fieldcatalog-col_pos     = 4.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'MENGE'.
      fieldcatalog-seltext_m   = 'PO quantity'.
      fieldcatalog-col_pos     = 5.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'MEINS'.
      fieldcatalog-seltext_m   = 'Order Unit'.
      fieldcatalog-col_pos     = 6.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'NETPR'.
      fieldcatalog-seltext_m   = 'Net Price'.
      fieldcatalog-col_pos     = 7.
      fieldcatalog-outputlen   = 15.
      fieldcatalog-datatype     = 'CURR'.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'PEINH'.
      fieldcatalog-seltext_m   = 'Price Unit'.
      fieldcatalog-col_pos     = 8.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
    endform.                    " BUILD_FIELDCATALOG
    *&      Form  BUILD_LAYOUT
    *       Build layout for ALV grid report
    form build_layout.
      gd_layout-no_input          = 'X'.
      gd_layout-colwidth_optimize = 'X'.
      gd_layout-totals_text       = 'Totals'(201).
    *  gd_layout-totals_only        = 'X'.
    *  gd_layout-f2code            = 'DISP'.  "Sets fcode for when double
    *                                         "click(press f2)
    *  gd_layout-zebra             = 'X'.
    *  gd_layout-group_change_edit = 'X'.
    *  gd_layout-header_text       = 'helllllo'.
    endform.                    " BUILD_LAYOUT
    *&      Form  DISPLAY_ALV_REPORT
    *       Display report using ALV grid
    form display_alv_report.
      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'
    *            i_grid_title           = outtext
                is_layout               = gd_layout
                it_fieldcat             = fieldcatalog[]
    *            it_special_groups       = gd_tabgroup
                it_events               = gt_events
                is_print                = gd_prntparams
                i_save                  = 'X'
    *            is_variant              = z_template
           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  DATA_RETRIEVAL
    *       Retrieve data form EKPO table and populate itab it_ekko
    form data_retrieval.
    select ebeln ebelp statu aedat matnr menge meins netpr peinh
    * up to 10 rows
      from ekpo
      into table it_ekko.
    endform.                    " DATA_RETRIEVAL
    * Form  TOP-OF-PAGE                                                 *
    * ALV Report Header                                                 *
    Form top-of-page.
    *ALV Header declarations
    data: t_header type slis_t_listheader,
          wa_header type slis_listheader,
          t_line like wa_header-info,
          ld_lines type i,
          ld_linesc(10) type c.
    * Title
      wa_header-typ  = 'H'.
      wa_header-info = 'EKKO Table Report'.
      append wa_header to t_header.
      clear wa_header.
    * Date
      wa_header-typ  = 'S'.
      wa_header-key = 'Date: '.
      CONCATENATE  sy-datum+6(2) '.'
                   sy-datum+4(2) '.'
                   sy-datum(4) INTO wa_header-info.   "todays date
      append wa_header to t_header.
      clear: wa_header.
    * Total No. of Records Selected
      describe table it_ekko lines ld_lines.
      ld_linesc = ld_lines.
    concatenate 'Total No. of Records Selected:' ld_linesc
                        into t_line separated by space.
      wa_header-typ  = 'A'.
      wa_header-info = t_line.
      append wa_header to t_header.
      clear: wa_header, t_line.
      call function 'REUSE_ALV_COMMENTARY_WRITE'
           exporting
                it_list_commentary = t_header.
    *            i_logo             = 'Z_LOGO'.
    endform.
    *       FORM USER_COMMAND                                          *
    *       --> R_UCOMM                                                *
    *       --> RS_SELFIELD                                            *
    FORM user_command USING r_ucomm LIKE sy-ucomm
                      rs_selfield TYPE slis_selfield.
    * Check function code
      CASE r_ucomm.
        WHEN '&IC1'.
    *   Check field clicked on within ALVgrid report
        IF rs_selfield-fieldname = 'EBELN'.
    *     Read data table, using index of row user clicked on
          READ TABLE it_ekko INTO wa_ekko INDEX rs_selfield-tabindex.
    *     Set parameter ID for transaction screen field
          SET PARAMETER ID 'BES' FIELD wa_ekko-ebeln.
    *     Sxecute transaction ME23N, and skip initial data entry screen
          CALL TRANSACTION 'ME23N' AND SKIP FIRST SCREEN.
        ENDIF.
      ENDCASE.
    ENDFORM.
    *&      Form  BUILD_EVENTS
    *       Build events table
    form build_events.
      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_end_of_page
                               into ls_event.
      if sy-subrc = 0.
        move 'END_OF_PAGE' to ls_event-form.
        append ls_event to gt_events.
      endif.
        read table gt_events with key name =  slis_ev_end_of_list
                               into ls_event.
      if sy-subrc = 0.
        move 'END_OF_LIST' to ls_event-form.
        append ls_event to gt_events.
      endif.
    endform.                    " BUILD_EVENTS
    *&      Form  BUILD_PRINT_PARAMS
    *       Setup print parameters
    form build_print_params.
      gd_prntparams-reserve_lines = '3'.   "Lines reserved for footer
      gd_prntparams-no_coverpage = 'X'.
    endform.                    " BUILD_PRINT_PARAMS
    *&      Form  END_OF_PAGE
    form END_OF_PAGE.
      data: listwidth type i,
            ld_pagepos(10) type c,
            ld_page(10)    type c.
      write: sy-uline(50).
      skip.
      write:/40 'Page:', sy-pagno .
    endform.
    *&      Form  END_OF_LIST
    form END_OF_LIST.
      data: listwidth type i,
            ld_pagepos(10) type c,
            ld_page(10)    type c.
      skip.
      write:/40 'Page:', sy-pagno .
    endform.
    Try with this sample
    Regards
    Krishna

  • Regarding ALV ( To be displayed in Tree Format)

    Hi all,
    I am working on a ALV report which is to be displayed in Tree Structure . I found some demo programs within SAP .. but do we have an Alternative .. all those Demos use  OOPS concept .. Can this Report be done without using OOPS in ALV.
    Please Suggest.
    Thanks & Regards
    Srinivas

    Hi,
    This is a ALV Report with tree structure.
    report  zwmr_pick_status_report no standard page heading
                                    message-id zw.
    Type Pools                                                           *
    type-pools: icon, slis.
    Tables                                                               *
    tables: tvst,
            likp,
            t30b,
            vekp,
            zpallettr,
            zvantr.
    Types                                                                *
    types:
      begin of ty_data,
         lgtor       like likp-lgtor,             " door
         vbeln       like likp-vbeln,             " delivery
         wbstk       like vbuk-wbstk,             " Goods movement status
         kostk       like vbuk-kostk,             " Picking status
         posnr       like lips-posnr,             " item
         route       like likp-route,             " route
         wadat       like likp-wadat,             " goods issue date
         lvsta       like vbup-lvsta,             " warehouse status
         packvorschr like vekp-packvorschr,       " pack mnemonic
         exidv       like vekp-exidv,             " handling unit
         zpallet_no(10),  "like zpallettr-zpallet_no,   " pallet no
         zcount_check like zpallettr-zcount_check," count check flag
         zvan_no(10),     "like zvantr-zvan_no,         " van no
         zvan_print  like zvantr-zvan_print,      " van manifest print
         zeod_print  like zvantr-zeod_print,      " eod manifest print
         zzpackclass like vekp-zzpackclass,       " package class
         zzti        like vekp-zzti,              " T.I. value
      end of ty_data.
    Data                                                                 *
    ranges: r_del   for likp-vbeln,
            r_lgtor for likp-lgtor.
    ranges: r_vanno for zvantr-zvan_no,
            r_palno for zpallettr-zpallet_no.
    data: begin of number_range occurs 0,
             mark(1),
             id(3),
             num(10) type n,
             desc like zpalletmd-zdesc,
          end of number_range.
    data: t_disp_tab  type standard table of zpickdisp,
          t_data_tab  type ty_data  occurs 0 with header line,
          t_disp_head type standard table of zpickhead.
    data: w_numrnge like number_range,
          w_number(10) type n.
    data: t_likp     like likp      occurs 0 with header line,
          t_lips     like lips      occurs 0 with header line,
          t_vbuk     like vbuk      occurs 0 with header line,
          t_vbup     like vbup      occurs 0 with header line,
          t_vepo     like vepo      occurs 0 with header line,
          t_vekp     like vekp      occurs 0 with header line,
          t_vantr    like zvantr    occurs 0 with header line,
          t_pallettr like zpallettr occurs 0 with header line,
          w_likp     like likp,
          w_lips     like lips,
          w_vbuk     like vbuk,
          w_vbup     like vbup,
          w_vepo     like vepo,
          w_vekp     like vekp.
    ALV DATA *****
    data:
         g_grid             type ref to cl_gui_alv_grid,
         g_sort             type slis_t_sortinfo_alv,
         g_custom_container type ref to cl_gui_custom_container,
         g_layout           type slis_layout_alv,
         gt_fieldcat        type slis_t_fieldcat_alv,
         t_fldcat           like line of gt_fieldcat,
         g_keyinfo          type slis_keyinfo_alv,
         gt_events          type slis_t_event,
         gs_event           type slis_alv_event,
         w_sy_repid         like sy-repid.
    data: begin of seltab occurs 0.
            include structure rsparams.
    data: end of seltab.
    SYSTEM GENERATED TABLE CONTROL DATA ********
    DECLARATION OF TABLECONTROL 'TC_TABCON' ITSELF
    controls: tc_tabcon type tableview using screen 0100.
    LINES OF TABLECONTROL 'TC_TABCON'
    data:     g_tc_tabcon_lines  like sy-loopc.
    data:     ok_code like sy-ucomm.
    Constants                                                            *
    constants: c_data_class like klah-class value 'DG_DATA',
               c_mat_class  like rmclf-klart value '001',
               c_pack       like lips-mtart value 'VERP',
               c_a(1)            value 'A',
               c_b(1)            value 'B',
               c_c(1)            value 'C',
               c_yes(1)          value 'X',
               c_no(1)           value ' '.
    Selection screen                                                     *
    standard report select options block
    selection-screen begin of block a with frame title text-002.
    select-options:
      s_wadat for likp-wadat no-extension obligatory.  " Goods Issue Date
    *parameters:                                           "TR01-
    p_vstel like tvst-vstel obligatory. " Shipping Point "TR01-
    select-options:                                             "TR01+
      p_vstel for tvst-vstel.            " Shipping Point  "TR01+
    select-options:
      s_lfart for likp-lfart,            " Delivery type
      s_lgtor for t30b-lgtor,            " Door selection
      s_exidv for vekp-exidv,            " Handling Unit
      s_vbeln for likp-vbeln.            " Delivery
    parameters:
      p_exdata as checkbox.              " Show extra columns flag
    selection-screen end of block a.
    van/pallet specific select options block
    selection-screen begin of block b with frame title text-001.
    select-options:
      s_palno for zpallettr-zpallet_no, " no-extension,
      s_vanno for zvantr-zvan_no.       " no-extension.
    selection-screen end of block b.
    Value Request Events                                                 *
    at selection-screen on value-request for s_palno-low.
      clear: number_range, w_number .
      refresh number_range.
    select numbers and display pop up screen for selection
      perform select_pal_nos.
      s_palno-low = w_number.
    at selection-screen on value-request for s_palno-high.
      clear: number_range, w_number .
      refresh number_range.
    select numbers and display pop up screen for selection
      perform select_pal_nos.
      s_palno-high = w_number.
    at selection-screen on value-request for s_vanno-low.
      clear: number_range, w_number .
      refresh number_range.
    select numbers and display pop up screen for selection
      perform select_van_nos.
      s_vanno-low = w_number.
    at selection-screen on value-request for s_vanno-high.
      clear: number_range, w_number .
      refresh number_range.
    select numbers and display pop up screen for selection
      perform select_van_nos.
      s_vanno-high = w_number.
    At Selection Screen                                                  *
    at selection-screen.
      perform validate_selections.
    Initialization                                                       *
    initialization.
    Start of selection                                                   *
    start-of-selection.
    clear all data tables
      clear: t_likp,
             t_lips,
             t_vbuk,
             t_vbup,
             t_vepo,
             t_vantr,
             t_pallettr,
             w_likp,
             w_lips,
             w_vbuk,
             w_vbup,
             w_vepo,
             w_vekp.
      refresh: t_likp,
               t_lips,
               t_vbuk,
               t_vbup,
               t_vepo,
               t_vantr,
               t_pallettr.
    select data for ALV
    due to different input parameters being used, to streamline the data
    selection process, different selection methods are required
      if not s_vanno is initial
      or not s_palno is initial.
      if selecting by van/pallet number, need to select the data from the
      handling unit upwards to delivery
        perform select_data_up.
      else.
      otherwise the data can be selected from the delivery downwards
        perform select_data_down.
      endif.
    End of selection                                                     *
    end-of-selection.
    call hierarchical ALV display function module
      call function 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'
           exporting
                i_callback_program       = 'ZWMR_PICK_STATUS_REPORT'
                i_callback_pf_status_set = 'SET_STATUS'
                i_callback_user_command =
                   'USER_COMMAND' "custom gui status form
                is_layout                = g_layout  "user command form
                it_fieldcat              = gt_fieldcat
                it_sort                  = g_sort
                it_events                = gt_events
                i_tabname_header         = 't_disp_head'
                i_tabname_item           = 't_disp_tab'
                i_structure_name_header  = 'ZPICKHEAD'
                i_structure_name_item    = 'ZPICKDISP'
                is_keyinfo               = g_keyinfo
           tables
                t_outtab_header          = t_disp_head
                t_outtab_item            = t_disp_tab.
      if sy-subrc <> 0.
        message id sy-msgid type sy-msgty number sy-msgno
                with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      endif.
                                FORMS                                    *
    Includes inserted by Screen Painter Wizard. DO NOT CHANGE THIS LINE!
      include zwmr_pick_status_reporto01 .
      include zwmr_pick_status_reporti01 .
      include zwmr_pick_status_reportf01 .
    *&      Form  select_pal_nos
          select pallet numbers for search help
    form select_pal_nos.
      data: begin of t_palno occurs 0,
              zpallet_no like zpallettr-zpallet_no,
            end of t_palno.
    select all available pallet numbers
      select distinct zpallet_no from zpallettr
                      into corresponding fields of table t_palno.
      loop at t_palno.
      get pallet id
        select single zpallet_id from zpallettr
                      into number_range-id
                      where zpallet_no = t_palno-zpallet_no.
      get pallet description
        select single zdesc from zpalletmd
                      into number_range-desc
                      where zpallet_id = number_range-id.
        number_range-num = t_palno-zpallet_no.
      append to search help table
        append number_range.
      endloop.
    call pop up dialog box
      call screen 0100 starting at 5 5.
    endform.                    " select_pal_nos
    *&      Form  select_van_nos
          select van numbers for search help
    form select_van_nos.
      data: begin of t_vanno occurs 0,
              zvan_no like zvantr-zvan_no,
            end of t_vanno.
    select available van numbers
      select distinct zvan_no from zvantr
                      into corresponding fields of table t_vanno.
      loop at t_vanno.
      select van id
        select single zvan_id from zvantr
                      into number_range-id
                      where zvan_no = t_vanno-zvan_no.
      select van description (maintained in pallet tables)
        select single zdesc from zpalletmd
                      into number_range-desc
                      where zpallet_id = number_range-id.
        number_range-num = t_vanno-zvan_no.
      append to search help table
        append number_range.
      endloop.
    call pop up dialog box
      call screen 0100 starting at 5 5.
    endform.                    " select_van_nos
    *&      Form  select_data_down
          select data if selecting from delivery down
    form select_data_down.
    select all deliveries from LIKP that fulfill selection criteria
      select * from likp into table t_likp
                         where vbeln in s_vbeln
                       and   vstel eq p_vstel                 "TR01-
                         and   vstel in p_vstel
                         and   lgtor in s_lgtor
                         and   wadat in s_wadat
                         and   lfart in s_lfart.
      if sy-subrc ne 0.
      no data found
        message i007.
        exit.
      endif.
      if not t_likp[] is initial.
      select sales document headers from VBUK
        select * from vbuk into table t_vbuk
                      for all entries in t_likp
                      where vbeln eq t_likp-vbeln.
      select all relevant delivery items from LIPS
        select * from lips into table t_lips
                      for all entries in t_likp
                      where vbeln eq t_likp-vbeln
                      and   pstyv ne 'ZPAC'
                      and   pstyv ne 'ZGDP'                     "TR02+
                      and   lfimg gt 0.                         "TR01+
      endif.
      if not t_lips[] is initial.
      select all sales document line items from VBUP
        select * from vbup into table t_vbup
                      for all entries in t_lips
                      where vbeln eq t_lips-vbeln
                      and   posnr = t_lips-posnr.
      select corresponding handling unit ID's (venum)
    TR03 Replace start
       select * from vepo appending corresponding fields of table t_vepo
                     for all entries in t_lips
                     where vbeln = t_lips-vbeln
                     and   posnr = t_lips-posnr
                     and   matnr = t_lips-matnr
                     and   charg = t_lips-charg.
        select * from vepo
                      inner join vekp on vepovenum = vekpvenum
                      appending corresponding fields of table t_vepo
                      for all entries in t_lips
                      where vepo~vbeln = t_lips-vbeln
                      and   vepo~posnr = t_lips-posnr
                      and   vepo~matnr = t_lips-matnr
                      and   vepo~charg = t_lips-charg
                      and   vekp~exidv in s_exidv.
    TR03 Replace end
      endif.
    build process table
      perform move_to_table.
    endform.   "select_data_down
    *&      Form  select_data_up
          select data if selecting from van/pallet up
    form select_data_up.
      if not s_vanno is initial.
      if van then select van numbers and hence pallet numbers
        select * from zvantr into table t_vantr
                              where zvan_no in s_vanno.
                            and   vstel   eq p_vstel."TR01-
        if not t_vantr[] is initial.
          select * from zpallettr into table t_pallettr
                                  for all entries in t_vantr
                                  where zpallet_no eq t_vantr-zpallet_no.
                                and   vstel      eq p_vstel."TR01-
        endif.
      else.
      otherwise can get pallet numbers directly
        select * from zpallettr into table t_pallettr
                                where zpallet_no in s_palno.
                              and   vstel      eq p_vstel."TR01-
      endif.
      if not t_pallettr[] is initial.
      from the pallet nos. we can select the handling units
        select * from vekp into table t_vekp
                           for all entries in t_pallettr
                           where exidv eq t_pallettr-exidv
                           and   exidv ne space
                           and   exidv in s_exidv               "TR03+
                           and ( exida = 'E'                    "TR01+
                           or    exida = 'F' ).                 "TR01+
      endif.
      if not t_vekp[] is initial.
      build vbeln range from t_vekp.
        loop at t_vekp.
          r_del-sign = 'I'.
          r_del-option = 'EQ'.
          r_del-low = t_vekp-vpobjkey.
          append r_del.
        endloop.
      select all deliveries from LIKP that correspond to HU's
        select * from likp into table t_likp
                           where vbeln in r_del
                           and   wadat in s_wadat
                           and   lfart in s_lfart.
      endif.
      if not t_likp[] is initial.
      select sales document headers from VBUK
        select * from vbuk into table t_vbuk
                      for all entries in t_likp
                      where vbeln eq t_likp-vbeln.
      select all relevant delivery items from LIPS
        select * from lips into table t_lips
                      for all entries in t_likp
                      where vbeln eq t_likp-vbeln
                      and   pstyv ne 'ZPAC'
                      and   pstyv ne 'ZGDP'                     "TR02+
                      and   lfimg gt 0.                         "TR01+
      endif.
      if not t_lips[] is initial.
      select all sales document line items from VBUP
        select * from vbup into table t_vbup
                      for all entries in t_lips
                      where vbeln eq t_lips-vbeln
                      and   posnr = t_lips-posnr.
      select corresponding handling unit ID's (venum)
        select * from vepo appending corresponding fields of table t_vepo
                      for all entries in t_lips
                      where vbeln = t_lips-vbeln
                      and   posnr = t_lips-posnr
                      and   matnr = t_lips-matnr
                      and   charg = t_lips-charg.
      endif.
    build process table
      perform move_to_table.
    endform.   "select_data_up
    *&      Form  move_to_table
          move data to processing table
    form move_to_table.
      loop at t_vepo.
        clear t_data_tab.
      delivery lines.
        clear w_lips.
        read table t_lips with key vbeln = t_vepo-vbeln
                                   posnr = t_vepo-posnr
                                   into w_lips.
        move-corresponding w_lips to t_data_tab.
      sales document line items
        clear w_vbup.
        read table t_vbup with key vbeln = t_vepo-vbeln
                                   posnr = t_vepo-posnr
                                   into w_vbup.
      if w_vbup-kosta = space.                   "TR01-
        not relevant for picking
        delete t_vepo.                           "TR01-
        continue.                                "TR01-
      else.                                      "TR01-
        move-corresponding w_vbup to t_data_tab.
      endif.                                     "TR01-
      sales doc header
        clear w_vbuk.
        read table t_vbuk with key vbeln = t_vepo-vbeln
                               into w_vbuk.
        move-corresponding w_vbuk to t_data_tab.
      delivery header
        clear w_likp.
        read table t_likp with key vbeln = t_vepo-vbeln
                               into w_likp.
        move-corresponding w_likp to t_data_tab.
      select handling unit info using vepo entry
        clear w_vekp.
        if t_vekp[] is initial.
          select single * from vekp into w_vekp
                                    where venum = t_vepo-venum.
        else.
          read table t_vekp with key venum = t_vepo-venum
                                     into w_vekp.
          if sy-subrc ne 0.
            select single * from vekp into w_vekp
                            where venum = t_vepo-venum.
          endif.
        endif.
        move-corresponding w_vekp to t_data_tab.
      select pallet / van load information
        select single zpallet_no zcount_check from zpallettr
                                 into (t_data_tab-zpallet_no,
                                       t_data_tab-zcount_check)
                                 where exidv eq w_vekp-exidv.
        if not t_data_tab-zpallet_no in s_palno.                "TR01+
          continue.                                             "TR01+
        endif.                                                  "TR01+
        if sy-subrc = 0.
          select single zvan_no zvan_print zeod_print from zvantr
                        into (t_data_tab-zvan_no,
                              t_data_tab-zvan_print,
                              t_data_tab-zeod_print)
                        where zpallet_no eq t_data_tab-zpallet_no.
          if not t_data_tab-zvan_no in s_vanno.                 "TR01+
            continue.                                           "TR01+
          endif.                                                "TR01+
        endif.
        append t_data_tab.
      endloop.
    *-----> TR01+ start
    If the delivery has yet to be packed, then need to include in report
    Thus delete t_lips here and if any entries left after looping through
    t_vepo, these will also need to be added to t_data_tab
    if the selection is by handling unit though we do not want these"TR03+
      if s_exidv is initial.                                          "TR03+
        loop at t_vepo.
          read table t_lips with key vbeln = t_vepo-vbeln
                                     posnr = t_vepo-posnr.
          if sy-subrc = 0.
            delete t_lips index sy-tabix.
          endif.
        endloop.
        if not t_lips[] is initial.
      move any unpacked items to the data table
          perform move_lips_to_table.
        endif.
      endif.                                                          "TR03+
    *<---- TR01+ End
    get relevant status icons
      perform select_icons.
    prepare ALV data
      perform prepare_alv.
    endform.                    " select_data
    *&      Form  select_icons
          select icons for display and move data to display table
    form select_icons.
      data: w_disp_tab like zpickdisp,
            w_disp_head like zpickhead,
            w_color like zpickdisp-color,
            ov_icon like zpickdisp-ov_icon,
            gi_icon like zpickdisp-gi_icon,
            to_icon like zpickdisp-to_icon,
            lp_icon like zpickdisp-lp_icon,
            pc_icon like zpickdisp-pc_icon,
            lv_icon like zpickdisp-lv_icon,
            vm_icon like zpickdisp-vm_icon,
            em_icon like zpickdisp-em_icon,
            t_ovst_tab like t_disp_tab with header line.
      constants: c_col1(3) value 'C10',
                 c_col2(3) value 'C20'.
      sort t_data_tab by lgtor vbeln.
      w_color = c_col2.
      loop at t_data_tab.
        at new lgtor.
        fill ALV header table
          clear w_disp_head.
          w_disp_head-lgtor = t_data_tab-lgtor.
          append w_disp_head to t_disp_head.
        endat.
      goods issue status & overall amber/green only
        case t_data_tab-wbstk.
          when c_c.
            move icon_green_light to gi_icon.
            move icon_green_light to ov_icon.
          when others.
            move icon_red_light to gi_icon.
            move icon_yellow_light to ov_icon.
        endcase.
      transfer order status
        case t_data_tab-lvsta.
          when c_a.
            move icon_red_light to to_icon.
          when c_b.
            move icon_yellow_light to to_icon.
          when c_c.
            move icon_green_light to to_icon.
          when space.
          write N/A
            to_icon = 'N/A'.
        endcase.
      loaded to pallet status
        if not t_data_tab-zpallet_no is initial.
          move icon_green_light to lp_icon.
        else.
          move icon_red_light to lp_icon.
        endif.
      pallet count status
        if not t_data_tab-zcount_check is initial.
          move icon_green_light to pc_icon.
        else.
          move icon_red_light to pc_icon.
        endif.
      loaded to van status
        if not t_data_tab-zvan_no is initial.
          move icon_green_light to lv_icon.
        else.
          move icon_red_light to lv_icon.
        endif.
      van manifest status
        if not t_data_tab-zvan_print is initial.
          move icon_green_light to vm_icon.
        else.
          move icon_red_light to vm_icon.
        endif.
      end of day manifest status
        if not t_data_tab-zeod_print is initial.
          move icon_green_light to em_icon.
        else.
          move icon_red_light to em_icon.
        endif.
      move working data table to display table
        move-corresponding t_data_tab to w_disp_tab.
        w_disp_tab-ov_icon = ov_icon.
        w_disp_tab-gi_icon = gi_icon.
        w_disp_tab-to_icon = to_icon.
        w_disp_tab-lp_icon = lp_icon.
        w_disp_tab-pc_icon = pc_icon.
        w_disp_tab-lv_icon = lv_icon.
        w_disp_tab-vm_icon = vm_icon.
        w_disp_tab-em_icon = em_icon.
        w_disp_tab-color = w_color.
      fill N/A values for initial fields for display
        if w_disp_tab-packvorschr is initial.
          w_disp_tab-packvorschr = 'N/A'.
        endif.
        if w_disp_tab-exidv is initial.
          w_disp_tab-exidv = 'N/A'.
        endif.
        if w_disp_tab-zpallet_no is initial.
          write 'N/A' to w_disp_tab-zpallet_no.
        endif.
        if w_disp_tab-zvan_no is initial.
          write 'N/A' to w_disp_tab-zvan_no.
        endif.
      display different color for new doc number
        at end of vbeln.
          if w_color = c_col1.
            w_color = c_col2.
          elseif w_color = c_col2.
            w_color = c_col1.
          endif.
        endat.
        append w_disp_tab to t_disp_tab.
        clear w_disp_tab.
      endloop.
    we have all the icons in display but need to check the overall status
    as this refers to the line items
    green and amber statuses already set and use the same criteria as the
    goods issue status unless detected as red here
      data: ov_stat_red(1).
      clear w_disp_tab.
      sort t_disp_tab by vbeln.
      loop at t_disp_tab into w_disp_tab.
        at new vbeln.
        check all line items for delivery
          loop at t_data_tab where vbeln = w_disp_tab-vbeln.
            if t_data_tab-lvsta = c_a.
            set overall status to red
              ov_stat_red = c_yes.
              exit.
            else.
            leave green/amber status icon as previosly determined
            endif.
          endloop.
          if ov_stat_red = c_yes.
          set overall status to red for all items in that delivery
            clear ov_stat_red.
            move icon_red_light to w_disp_tab-ov_icon.
            modify t_disp_tab from w_disp_tab transporting ov_icon
                              where vbeln = w_disp_tab-vbeln.
          endif.
        endat.
      endloop.
    endform.                    " select_icons
    *&      Form  fill_layout
          fill ALV layout parameters
    form fill_layout.
      clear g_layout.
      g_layout-colwidth_optimize = c_yes.   " column width optimisation
      g_layout-zebra = space.               " alternate line colors
      g_layout-box_fieldname = 'MARK'.      " checkbox fieldname
      g_layout-info_fieldname = 'COLOR'.    " highlight row indicator
      g_layout-no_vline = space.            " vertical line
      g_layout-key_hotspot = space.         " hotspot field
      g_layout-f2code = 'PICK'.             " F2 ok_code
      g_layout-numc_sum = c_yes.            " sum numc fields
      g_layout-box_tabname = 't_disp_head'. " checkbox table name
      g_layout-expand_fieldname = 'EXPAND'. " expand field name
    endform.                    " fill_layout
    *&      Form  fill_sort
          fill ALV sort table
    form fill_sort.
      data: w_g_sort type slis_sortinfo_alv.
      w_g_sort-spos      = 1.
      w_g_sort-fieldname = 'LGTOR'.
      w_g_sort-tabname   = 't_disp_tab'.
      w_g_sort-up        = c_yes.
      append w_g_sort to g_sort.
      w_g_sort-spos      = 2.
      w_g_sort-fieldname = 'VBELN'.
      w_g_sort-tabname   = 't_disp_tab'.
      w_g_sort-up        = c_yes.
      append w_g_sort to g_sort.
      w_g_sort-spos      = 3.
      w_g_sort-fieldname = 'POSNR'.
      w_g_sort-tabname   = 't_disp_tab'.
      w_g_sort-up        = c_yes.
      append w_g_sort to g_sort.
      w_g_sort-spos      = 4.
      w_g_sort-fieldname = 'WADAT'.
      w_g_sort-tabname   = 't_disp_tab'.
      w_g_sort-up        = c_yes.
      append w_g_sort to g_sort.
    endform.                    " fill_sort
    *&      Form  fill_fieldcat
          Fill field category structure for ALV
    form fill_fieldcat.
      clear t_fldcat.
    create field catalogue for header table
      call function 'REUSE_ALV_FIELDCATALOG_MERGE'
           exporting
                i_program_name         = 'ZWMR_PICK_STATUS_REPORT'
                i_internal_tabname     = 't_disp_head'
                i_structure_name       = 'ZPICKHEAD'
                i_client_never_display = c_yes
           changing
                ct_fieldcat            = gt_fieldcat[].
      if sy-subrc <> 0.
        message id sy-msgid type sy-msgty number sy-msgno
                with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      endif.
    ceate field catalogue for items table
      call function 'REUSE_ALV_FIELDCATALOG_MERGE'
           exporting
                i_program_name         = 'ZWMR_PICK_STATUS_REPORT'
                i_internal_tabname     = 't_disp_tab'
                i_structure_name       = 'ZPICKDISP'
                i_client_never_display = c_yes
           changing
                ct_fieldcat            = gt_fieldcat[].
      if sy-subrc <> 0.
        message id sy-msgid type sy-msgty number sy-msgno
                with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      endif.
    modify field catalogue for this report
    set no display flag if not requested on selection screen
      if p_exdata ne c_yes.
        t_fldcat-no_out    =  c_yes.
        modify gt_fieldcat from t_fldcat transporting no_out
                           where fieldname eq 'PACKVORSCHR'
                           or    fieldname eq 'EXIDV'
                           or    fieldname eq 'ZPALLET_NO'
                           or    fieldname eq 'ZVAN_NO'
                           or    fieldname eq 'ZZPACKCLASS'
                           or    fieldname eq 'ZZTI'.
      endif.
    set no display flag for item level LGTOR field
      t_fldcat-no_out    =  c_yes.
      modify gt_fieldcat from t_fldcat transporting no_out
                         where fieldname eq 'LGTOR'
                         and   tabname   eq 't_disp_tab'.
    prevent display of technical fields
      t_fldcat-tech = c_yes.
      modify gt_fieldcat from t_fldcat transporting tech
                         where fieldname eq 'EXPAND'
                         or    fieldname eq 'SELKZ'.
    set vbeln as key
      t_fldcat-key = c_yes.
      modify gt_fieldcat from t_fldcat transporting key
                         where fieldname eq 'VBELN'.
    prevent scrolling for info fields
      t_fldcat-fix_column = c_yes.
      modify gt_fieldcat from t_fldcat transporting fix_column
                         where fieldname eq 'VBELN'.
    endform.                    " fill_fieldcat
    *&      Form  prepare_ALV
          Fill ALV parameters
    form prepare_alv.
    fill ALV key info
      g_keyinfo-header01 = 'LGTOR'.
      g_keyinfo-item01   = 'LGTOR'.
    fill ALV events
      gs_event-name = 'TOP_OF_PAGE'.
      gs_event-form = 'TOP_OF_PAGE'.
      append gs_event to gt_events.
    fill ALV sort table
      perform fill_sort.
    fill ALV layout structure
      perform fill_layout.
    fill ALV field category
      perform fill_fieldcat.
    endform.                    " prepare_ALV
    *&      Form  user_command
          form called on user command from ALV list
    form user_command using r_ucomm     like sy-ucomm
                            rs_selfield type slis_selfield.
      data: index type i,
            w_disp_head like line of t_disp_head,
            w_door like likp-lgtor.
      clear r_lgtor. refresh r_lgtor.
      case r_ucomm.
        when 'PICK'. " Double click line
        when 'VANM'. " Van Manifest button
        read the header table where has been selected
          loop at t_disp_head into w_disp_head where mark = c_yes.
            r_lgtor-sign   = 'I'.
            r_lgtor-option = 'EQ'.
            r_lgtor-low    = w_disp_head-lgtor.
            append r_lgtor.
          endloop.
        print the van manifest
          perform print_van_manifest tables r_lgtor.
        when 'EODM'. " EOD Manifest button
        read the header table where has been selected
          loop at t_disp_head into w_disp_head where mark = c_yes.
            r_lgtor-sign   = 'I'.
            r_lgtor-option = 'EQ'.
            r_lgtor-low    = w_disp_head-lgtor.
            append r_lgtor.
          endloop.
        print the end of day manifest
          perform print_eod_manifest tables r_lgtor.
        when 'REFR'. "Refresh
        refresh display
          w_sy_repid = sy-repid.
          call function 'RS_REFRESH_FROM_SELECTOPTIONS'
               exporting
                    curr_report     = w_sy_repid
               tables
                    selection_table = seltab.
              exceptions
                  not_found       = 1
                  no_report       = 2
                  others          = 3.
          if sy-

Maybe you are looking for

  • How to create a calculated column in sharepoint

    I created the custom list in share point. In that list i renamed the title as Name. I created the WindowsID as person or group column in share point list. In the same list, I want to create a new calculated column as EmpName as hyperlink with the bel

  • Plot legend customization bug in 8.5?

    If someone can confirm this for me, I would appreciate it. I have 2 issues which I think may be based on the same problem: 1.  Take the attached control and insert into a LV 7.1 - 8.2 VI.  The plot legend should have the system box instead of the 3D

  • Arabic name displaying in JLabel using html tags

    If i execute the following code the value of the variable product_name as latin characters it's displaying correctely. If i use arabic characters it's adding white spaces import java.io.*; import java.awt.*; import java.awt.event.*; import javax.swin

  • Problem in Discoverer installation.

    Hi, When i am trying to install Oracle BI tools for Discoverer i am getting the problem with Swap memory. Actual Swap memory :1512 MB Required Swap memory :1535 MB Please suggest me how to increase Swap memory. Regards, Surendra.V

  • Updating itunes account problem

    I created an itunes account and when I went to sign in in itunes, it asked me to review my account, with only the 'Cancel' and 'Review' option available. I typed in all my information and pressed 'Next'. But it says something along this: 'For more as