Dynamically assign value to a column in ALV LIST Display

Hi all,
How can I dynamically assign value to a column in ALV LIST Display without using classes and methods?
Thanks,
Ridhima

Hi Vikranth,
I am displaying one ALV list say with columns A and B.
I have value in A but not in B. Now at runtime user selects one row, clicks on push button in application toolbar, then i have to display value in column B in the already displayed list.
I searched and came to know it can be done with oops concept. but i am not using classes and methods.
so how can i do this?
Thanks,
Ridhima.

Similar Messages

  • How to get subtotal value in ALV list display

    Hi all,
    How to give condition on the value of subtotal line in ALV list display,
    i.e.if value of subtotal of plan quantity = actual quantity (in red oval) it should show the message
    'ON TIME DELIVERY' else it should not show messagee.In my case(shown in red oval) its
    showing for each subtotal value. I know how to change the subtotal text but i want to change
    with respect to value of the subtotal.(plz refer attachment)
    Any input regard to this will be achieved great.
    Many thanks in advance.
    samadhan shinde.

    Hi Samadhan,
    I am awaiting for solution for this problem.....but as i think dynamically displaying sub total based on
    matching actual quantity and planned quantity is bit complicated.
    My idea is to display matched quantities in one block and unmatched  quantities in another. I mean using blocked list.
    awaiting suggestions.
    regards,

  • Display multiple values in a column in ALV

    I need to display plant order number from AFPO and PLAF table in reference to Goods Recepient(WEMPF) field.
    now in final internal table I assign AFPO--> Plant number value to PLNUM column of ALV.
    how do I add value to same column based on WEMPF common value for both table and append value to PLNUM column below value fetched from AFPO table.
    code for getting value from PLAF table.
    SELECT WEMPF PLNUM
    FROM PLAF
    INTO TABLE IST_PLAF
    FOR ALL ENTRIES IN IST_AFPO
    WHERE PLNNO = IST_AFPO-WEMPF
    AND  ......
    Point is for some WEMPF field entried their will be number of entries in AFPO and PLAF table (in PLNUM column)  so how I do displaying entries from both tables in single row??

    Hi Ankitkumar Dineshkumar Gautam,
    SAP would say: "This is a consulting issue". I would say: What's your problem? Look at some samle programs.
    Regards,
    Clemens

  • How can i dynamically assign values to the tld file

    How can i dynamically assign values to the tld file

    In the tld you write for the tag handler mention the following sub tags in the attribute
    <attribute>
    <name>xyz</name>
    <required>true</required>
    <rtexprvalue>true</rtexprvalue>
    </attribute>
    import the packagejavax.servlet.jsp.tagext.DynammicAttributes;
    add the method
    public void setDynamicAttribute(String rui, String localname, Object value) throws JspException
    <Your Required task>
    Its better if you SimpleTagSupport class to be extended.

  • Sum of values in a column in alv

    i am displaying data in a hierarchical list using OO programming.
    I have created a hot spot for a particular field so that i display a
    popup on clicking any value in that column.
    The popup displays another alv grid.
    I need to sum up the values of a particular column in that a;v grid
    that is displayed in the popup using OO prog.
    Could anyone suggest a mthod that helps summing the column values/

    Hello Rohan,
    Hope you are ready with the event handler method and other supporting stuff. Only thing missing is before calling second screen you need to set DO_SUM field in field catalog table and pass that field catalog for the second alv.
    Refer to SAP help [http://help.sap.com/saphelp_47x200/helpdata/en/52/5f0607e02d11d2b47d006094192fe3/frameset.htm] for more details.
    Thanks,
    Augustin.

  • Maximum number of character we can print in a column uing ALV grid display

    Hi frnds,
    My requirment is to print 500 charcter data in a column using ALV grid display.
    Could any body tell me is it possible and the maximum character it can i print in a column using ALV grid dispaly.
    Regards,
    Sandipan

    Hi Sandipan,
    refer notes 857823, 910300 and 959775. All these say there is a limitation of 128 characters.
    857823 - ALV grid: Strings with a maximum of 128 characters
    Symptom
    Entries in cells of the type CHAR or string are truncated after 128
    characters in the SAP GUI.
    also refer,
    ALV Grid Control (cl_gui_alv_grid), function module (Full-screen) Grid
    (Reuse_alv_grid_display, SAPLSLVC_FULLSCREEN), SAPGUI, back end, front end
    Cause and Prerequisites
    The data table that is sent to the front end only allows character values
    with the length 128.
    Solution
    This is the standard system behavior and cannot be changed.

  • How To avoid column heading for only total line in ALV list Display

    Hi,
    How To avoid column heading for only total line in ALV list Display.

    Hi,
    to change colunm header field catlog is built
    look at the example below
    Changing column text headers
    use this to change, hide, or alter the ALV columns
    CLEAR: gt_fcat.
    READ TABLE gt_fcat WITH KEY fieldname = 'TEXT1' " ***
    *TEXT1 is your field name
       ASSIGNING <gtfcat>.
    IF sy-subrc = 0.
       <gtfcat>-coltext   = 'Date Type'.
       <gtfcat>-no_out    = ' '.
       <gtfcat>-tooltip   = 'Date Type Text from IT0019'.
       <gtfcat>-seltext   = 'IT0019'.
    keep seltext to '' if u want to hide
    ENDIF.
    regards
    austin

  • How to give color of particular cell in alv list display for dynamic table

    Dear Experts,
    i want to give color of a particular cell in alv list display (reuse_alv_list_display). Here i am passing data through dynamic table?

    Hi,
    Se this:
    DATA: lt_color    TYPE lvc_t_scol WITH HEADER LINE.
    DATA: BEGIN OF data_tab OCCURS 0.
             tabcolor     TYPE   lvc_t_scol,
          END OF data_tab.
    * Befone ALV call
      alv_layout-coltab_fieldname  = 'TABCOLOR'.
    * For each row in data_tab
    REFRESH: lt_color.
    CLEAR: lt_color.
    lt_color-color-col = 6.
    lt_color-color-int = 1.
    lt_color-fname = FIELD1'.
    APPEND lt_color.
    lt_color-color-col = 2.
    lt_color-color-int = 0.
    lt_color-fname = 'FIELD2'.
    APPEND lt_color.
    data_tab-tabcolor[] = lt_color[].
    append data_tab.
    Best regards,
    Leandro Mengue

  • Want to display more than 300 charcters in a column using ALV grid display

    Hi Guru's,
    I am trying to display more than 500 charcters in a column using alv grid display but it in the output it is showing only 128 characters. Can you help me to display all the characters in particular column Or is there any limitation in maximum of no of charcters for a column?
    Thanks,
    Radha.

    Hi Paurl,
    Define a work area say
    wa_layout type slis_layout_alv.
    then fill this work area as
    wa_layout-zebra = X
    wa_layout-colwidth_optimize = X.
    wa_layout-max_linesize = 300.
    Then in FM 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
    is_layout = wa_layout
    etc.
    you provided this for the field which is displayed in alv grid will have more than 128 characters.
    from this code i want,how it refers to particular field.
    when i mentioned field catalog-OUTPUTLEN = '300'.
    it is not displayed the field morethan 128 characters.
    it only displays 128 characters.
    please provide me clear and breif information with suitable code.
    i am trying what your sending but it is not displayed more than 128 characters.
    if you don't mind please spend for me some time for this and
    give me clear and breif information with suitable code.
    Thanks & Regards,
    Radhakrishna.

  • Removing columns heading for a perticular page in ALV list display

    Dear All,
    For last page of my ALV list display i need to remove columns heading (Strictly for single page only).
    Kindly help me with possible solution.
    I am triggering page break by  using group attribute in the sort catalogue.(  l_v_sortcat-group     = '* '. )
    Best Regards
    Ravishekar Thallapally

    if u can catch the page number,
    while building fieldcat, put the condition
    if sy-page = (page number)
    ls_fielcact-fieldname = fieldname.
    ls_fieldcat-tech = 'X'.
    LS_FIELDCAT-NO_OUT = 'x'.
    modify lt_fielcat from ls_fieldcat.
    but how r u catching page number?? can u pls tell
    endif.
    Message was edited by: Hymavathi Oruganti

  • How to insert the checkbox as a separate column  in alv grid display

    Hi
    How to insert the checkboxes as a separate column  in alv grid display with using the reuse_alv_fieldcatlog_mege.
    example
    matnr    maktx  ersda                 checkbox
    10        books  28/03/2009          checkbox
    Thanks
    chinnu

    Hi,
        Check the following code.
    TYPE-POOLS: slis.
    TYPES:
          BEGIN OF ty_output,
          chk TYPE c,
          number TYPE i,
          name(20) TYPE c,
          END OF ty_output.
    DATA: gt_output TYPE STANDARD TABLE OF ty_output,
          gs_output TYPE ty_output.
    DATA: wa_layout           TYPE slis_layout_alv.
    DATA: it_fieldcatalog TYPE slis_t_fieldcat_alv,
    After you populate the data, build the field catlog like shown below.
    wa_fieldcatalog TYPE slis_fieldcat_alv.
    wa_fieldcatalog-fieldname = 'CHK'.
      wa_fieldcatalog-outputlen = '3'.
      wa_fieldcatalog-col_pos = '1'.
      wa_fieldcatalog-seltext_m   = 'CHK'.
      wa_fieldcatalog-checkbox = 'X'.
      wa_fieldcatalog-edit = 'X'.
      APPEND  wa_fieldcatalog TO it_fieldcatalog.
    wa_fieldcatalog-fieldname = 'NUMBER'.
      wa_fieldcatalog-outputlen = '10'.
      wa_fieldcatalog-col_pos = '2'.
      wa_fieldcatalog-seltext_m   = 'NUMBER'.
      APPEND  wa_fieldcatalog TO it_fieldcatalog.
      CLEAR  wa_fieldcatalog.
      wa_fieldcatalog-fieldname = 'NAME'.
      wa_fieldcatalog-outputlen = '10'.
      wa_fieldcatalog-col_pos = '3'.
      wa_fieldcatalog-seltext_m   = 'NAME'.
      APPEND  wa_fieldcatalog TO it_fieldcatalog.
      CLEAR  wa_fieldcatalog.
      wa_layout-box_fieldname     = 'CHK' .
      wa_layout-box_tabname       = 'GT_OUTPUT' .
    Now call the FM
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
    *   I_INTERFACE_CHECK                 = ' '
    *   I_BYPASSING_BUFFER                = ' '
    *   I_BUFFER_ACTIVE                   = ' '
          i_callback_program                = sy-repid
          i_callback_pf_status_set          = 'PF_STATUS'
          i_callback_user_command           = 'USER_COMMAND_GRID'
    *   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                      =
    *   I_GRID_SETTINGS                   =
          is_layout                         = wa_layout
          it_fieldcat                       = it_fieldcatalog
    *   IT_EXCLUDING                      =
    *   IT_SPECIAL_GROUPS                 =
    *   IT_SORT                           =
    *   IT_FILTER                         =
    *   IS_SEL_HIDE                       =
    *   I_DEFAULT                         = 'X'
    *   I_SAVE                            = ' '
    *   IS_VARIANT                        =
    *   IT_EVENTS                         =
    *   IT_EVENT_EXIT                     =
    *   IS_PRINT                          =
    *   IS_REPREP_ID                      =
    *   I_SCREEN_START_COLUMN             = 0
    *   I_SCREEN_START_LINE               = 0
    *   I_SCREEN_END_COLUMN               = 0
    *   I_SCREEN_END_LINE                 = 0
    *   IT_ALV_GRAPHICS                   =
    *   IT_HYPERLINK                      =
    *   IT_ADD_FIELDCAT                   =
    *   IT_EXCEPT_QINFO                   =
    *   I_HTML_HEIGHT_TOP                 =
    *   I_HTML_HEIGHT_END                 =
    * IMPORTING
    *   E_EXIT_CAUSED_BY_CALLER           =
    *   ES_EXIT_CAUSED_BY_USER            =
        TABLES
          t_outtab                          = gt_output
    * 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.

  • Icon and text together in one column in alv list

    Hello Everyone,
    I want to display icon and text together in one column in ALV list.
    I am using reuse_alv_grid_display function module.
    Currently, i am able to see icon only in the column but i want to see both icon and text in one column in ALV.
    Please let me know if this scenario is possible in ALV and how.
    Thanks in advance.
    Regards, Tarun

    Hi,
    Check this code....
    REPORT  ZTEST_ALV_CHECK     MESSAGE-ID ZZ           .
    TYPE-POOLS: SLIS,icon.
    DATA: X_FIELDCAT TYPE SLIS_FIELDCAT_ALV,
          IT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
          L_LAYOUT TYPE SLIS_LAYOUT_ALV/
    DATA: BEGIN OF ITAB OCCURS 0,
          VBELN LIKE VBAK-VBELN,
          POSNR LIKE VBAP-POSNR,
          ICON(1),
         END OF ITAB.
    SELECT VBELN
           POSNR
           FROM VBAP
           UP TO 20 ROWS
           INTO TABLE ITAB.
    loop at itab.
    if sy-tabix = 1 or sy-tabix = 2.
    itab-icon = '1'.
    elseif sy-tabix = 10 or sy-tabix = 20.
    itab-icon = '2'.
    else.
    itab-icon = '3'.
    endif.
    modify itab index sy-tabix.
    endloop.
    X_FIELDCAT-FIELDNAME = 'VBELN'.
    X_FIELDCAT-SELTEXT_L = 'VBELN'.
    X_FIELDCAT-HOTSPOT = 'X'.
    X_FIELDCAT-TABNAME = 'ITAB'.
    X_FIELDCAT-COL_POS = 1.
    APPEND X_FIELDCAT TO IT_FIELDCAT.
    CLEAR X_FIELDCAT.
    X_FIELDCAT-FIELDNAME = 'POSNR'.
    X_FIELDCAT-SELTEXT_L = 'POSNR'.
    X_FIELDCAT-TABNAME = 'ITAB'.
    X_FIELDCAT-COL_POS = 2.
    APPEND X_FIELDCAT TO IT_FIELDCAT.
    CLEAR X_FIELDCAT.
    L_LAYOUT-lights_fieldname = 'ICON'.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
      EXPORTING
        I_CALLBACK_PROGRAM       = SY-REPID
        IS_LAYOUT                = L_LAYOUT
        IT_FIELDCAT              = IT_FIELDCAT
      TABLES
        T_OUTTAB                 = ITAB
      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.
    Regards
    vijay

  • How to hide ,unhide columns  in ALV List

    Hi all,
    How to hide ,unhide columns  in ALV List..
    Plz guide me.
    Thanks in advance..
    Albert

    Hi Joseph,
    Check the following thread:
    Hide Unhide columns of ALV grid Report.
    Regards,
    Archana

  • Issue in ALV List display

    Issue in ALV List display  
    Posted: Apr 5, 2008 10:25 AM     Edit      E-mail this message      Reply 
    Hi Friends,
    Can any one help me out in the logic to display the output in the ALV list.
    i want to get the out put as
    based on the field4 i have to display fieds5, field6 and field 7 values as mentioned below.
    field1 field2 field3 field4 field5 field6 field7
    0L 123 456 2008  001 123.00 456.00
    -    -     -       -     002  213.00 789.00
    -      -       -     003 0.00     0.00
    -      -       -     004 0.00     0.00
    -      -        -    005 0.00     0.00
    -       -       -     006 0.00     0.00
                                   336.00  1245.00
    Thanks,
    Vijay

    for display you have to define fieldcatlaog and use Fm RESUE_ALV_GRID_DISPLAY,
    Go through this program
    *& Report  Z_OPEN_CLOSE                                                *
    REPORT  Z_OPEN_CLOSE MESSAGE-ID YW2 LINE-SIZE 231 LINE-COUNT 45
    NO STANDARD PAGE HEADING.
    Type Declaration *
    TYPE-POOLS SLIS.
    Tables *
    TABLES: MKPF, " Material Document: Header Data
            MSEG, " Material Document: Item Data
            MARA,
            MARD,
            S031,
            EKKO,
            EKPO,
            LIKP,
            MAKT,
            J_1IWRKCUS,
            T001W,
            WB2_V_MKPF_MSEG2,
            MMIM_REP_PRINT,
            YW2_STKMOVEMENTS,
            YPLNT,
            MARDH.
    Internal Tables *
    DATA: I_WERKS LIKE J_1IWRKCUS OCCURS 0 WITH HEADER LINE.
    DATA: BEGIN OF I_YPLNT OCCURS 0,
             PPLNT LIKE YPLNT-PPLNT,
             WPLNT LIKE YPLNT-WPLNT,
          END OF I_YPLNT.
    DATA: BEGIN OF I_MKPF OCCURS 0,
            MBLNR LIKE MKPF-MBLNR,
            MJAHR LIKE MKPF-MJAHR,
            BUDAT LIKE MKPF-BUDAT,
            VGART LIKE MKPF-VGART,
            BWART LIKE MSEG-BWART,
            MATNR LIKE MSEG-MATNR,
            WERKS LIKE MSEG-WERKS,
            LGORT LIKE MSEG-LGORT,
            MENGE LIKE MSEG-MENGE,
            MEINS LIKE MSEG-MEINS,
            KUNNR LIKE MSEG-KUNNR,
            ZEILE LIKE MSEG-ZEILE,
            XAUTO LIKE MSEG-XAUTO,
            SHKZG LIKE MSEG-SHKZG,
            MATNR1 LIKE MSEG-MATNR,
          END OF I_MKPF.
    DATA: BEGIN OF I_MARDH OCCURS 0,
           WERKS LIKE MARDH-WERKS,
           MEINS LIKE MARA-MEINS,
           MATNR LIKE MARDH-MATNR,
           LGORT LIKE MARDH-LGORT,
           LABST LIKE MARDH-LABST,
           LFGJA LIKE MARDH-LFGJA, "Added -MB
           LFMON LIKE MARDH-LFMON, "Added -MB
           PERIO(6),
           INSME LIKE MARDH-LABST,
           EINME LIKE MARDH-LABST,
           SPEME LIKE MARDH-LABST,
           RETME LIKE MARDH-LABST,
           O_STK LIKE MARDH-LABST, " Opening Stock
           C_STK LIKE MARDH-LABST, " Closing Stock
          END OF I_MARDH.
    DATA: BEGIN OF I_MARD OCCURS 0,
           WERKS LIKE MARD-WERKS,
           MATNR LIKE MARD-MATNR,
           LGORT LIKE MARD-LGORT,
           LABST LIKE MARD-LABST,
           INSME LIKE MARD-LABST,
           MEINS LIKE MARA-MEINS,
           EINME LIKE MARD-LABST,
           SPEME LIKE MARD-LABST,
           RETME LIKE MARD-LABST,
          END OF I_MARD.
    DATA: I_MARD1 LIKE I_MARD OCCURS 0 WITH HEADER LINE.
    DATA: I_MARDH1 LIKE I_MARDH OCCURS 0 WITH HEADER LINE.
    DATA: BEGIN OF I_MKPF1 OCCURS 0,
            MBLNR LIKE MKPF-MBLNR,
            WERKS LIKE MSEG-WERKS,
            MATNR LIKE MSEG-MATNR,
            BUDAT LIKE MKPF-BUDAT,
            BWART LIKE MSEG-BWART,
            MJAHR LIKE MKPF-MJAHR,
            VGART LIKE MKPF-VGART,
            LGORT LIKE MSEG-LGORT,
            MENGE LIKE MSEG-MENGE,
            MEINS LIKE MSEG-MEINS,
            XAUTO LIKE MSEG-XAUTO,
            SHKZG LIKE MSEG-SHKZG,
          END OF I_MKPF1.
    DATA: BEGIN OF I_MKPF2 OCCURS 0,
           WERKS LIKE MSEG-WERKS,
           MATNR LIKE MSEG-MATNR,
           BUDAT LIKE MKPF-BUDAT,
           BWART LIKE MSEG-BWART,
           MJAHR LIKE MKPF-MJAHR,
           VGART LIKE MKPF-VGART,
           LGORT LIKE MSEG-LGORT,
           MENGE LIKE MSEG-MENGE,
           MEINS LIKE MSEG-MEINS,
           XAUTO LIKE MSEG-XAUTO,
         END OF I_MKPF2.
    DATA: BEGIN OF I_FINAL5 OCCURS 0,
           WERKS LIKE MSEG-WERKS, " Plant
           MATNR LIKE MSEG-MATNR, " Material
           LGORT LIKE MSEG-LGORT, " Storage Location
           BUDAT LIKE MKPF-BUDAT, " Posting Date
           MTART LIKE MARA-MTART, " Material Type
           SPMON LIKE S031-SPMON, " Month
           MAKTX LIKE MAKT-MAKTX, " Description
    meins(3), " UOM
            MEINS LIKE MSEG-MEINS,
            O_STK LIKE MARDH-LABST, " opening stock
            TRECEP LIKE MARDH-LABST, " total receipts
            PRODU LIKE MARDH-LABST, " Net Receipts - Production
            RECEP LIKE MARDH-LABST, " Net Receipts - Receipts
            SAL_RET LIKE MARDH-LABST, " Net Receipts - Sales Return
            TDISP LIKE MARDH-LABST, " total dispatches
            CUSTMR LIKE MARDH-LABST, " Net Dispatches - Customers
            OPLANT LIKE MARDH-LABST, " Net Dispatches - To Other Plant
            TLOSS LIKE MARDH-LABST, " Total Loss
            TRLOSS LIKE MARDH-LABST, " Transit Loss
            WHLOSS LIKE MARDH-LABST, " Warehouse Loss
            C_STK LIKE MARDH-LABST, " Closing Stock
            TRFSTK LIKE MARDH-LABST, "Transfer stock
            MENGE LIKE MSEG-MENGE,
            OTHADJ LIKE MARDH-LABST,
          END OF I_FINAL5.
    DATA: BEGIN OF I_FINAL OCCURS 0,
            WERKS LIKE MSEG-WERKS, " Plant
            MATNR LIKE MSEG-MATNR, " Material
            BUDAT LIKE MKPF-BUDAT, " Posting Date
            MTART LIKE MARA-MTART, " Material Type
            SPMON LIKE S031-SPMON, " Month
            MAKTX LIKE MAKT-MAKTX, " Description
    meins(3), " UOM
            MEINS LIKE MSEG-MEINS,
            O_STK LIKE MARDH-LABST, " opening stock
            TRECEP LIKE MARDH-LABST, " total receipts
            PRODU LIKE MARDH-LABST, " Net Receipts - Production
            RECEP LIKE MARDH-LABST, " Net Receipts - Receipts
            SAL_RET LIKE MARDH-LABST, " Net Receipts - Sales Return
            TDISP LIKE MARDH-LABST, " total dispatches
            CUSTMR LIKE MARDH-LABST, " Net Dispatches - Customers
            OPLANT LIKE MARDH-LABST, " Net Dispatches - To Other Plant
            TRFSTK LIKE MARDH-LABST, "Material Transfer stock
            TRLOSS LIKE MARDH-LABST, " Transit Loss
            WHLOSS LIKE MARDH-LABST, " Warehouse Loss
            TLOSS LIKE MARDH-LABST, " Total Loss
            C_STK LIKE MARDH-LABST, " Closing Stock
            OTHADJ LIKE MARDH-LABST,
           END OF I_FINAL.
    DATA: I_FINAL1 LIKE I_FINAL OCCURS 0 WITH HEADER LINE.
    DATA: BEGIN OF I_FINAL_TEMP OCCURS 0,
            WERKS LIKE MSEG-WERKS, " Plant
            MATNR LIKE MSEG-MATNR, " Material
            MTART LIKE MARA-MTART, " Material Type
            MAKTX LIKE MAKT-MAKTX, " Description
            MEINS LIKE MSEG-MEINS,
            O_STK LIKE MARDH-LABST, " opening stock
            TRECEP LIKE MARDH-LABST, " total receipts
            PRODU LIKE MARDH-LABST, " Net Receipts - Production
            RECEP LIKE MARDH-LABST, " Net Receipts - Receipts
            SAL_RET LIKE MARDH-LABST, " Net Receipts - Sales Return
            TDISP LIKE MARDH-LABST, " total dispatches
            CUSTMR LIKE MARDH-LABST, " Net Dispatches - Customers
            OPLANT LIKE MARDH-LABST, " Net Dispatches - To Other Plant
            TRFSTK LIKE MARDH-LABST, "Material Transfer stock
            TRLOSS LIKE MARDH-LABST, " Transit Loss
            WHLOSS LIKE MARDH-LABST, " Warehouse Loss
            TLOSS LIKE MARDH-LABST, " Total Loss
            C_STK LIKE MARDH-LABST, " Closing Stock
            OTHADJ LIKE MARDH-LABST,
          END OF I_FINAL_TEMP.
    For Materials
    DATA: BEGIN OF I_MARA OCCURS 0,
           MATNR TYPE MARA-MATNR,
           MTART TYPE MARA-MTART,
           MEINS LIKE MARA-MEINS,
           LABST TYPE MARD-LABST,
           MAKTX LIKE MAKT-MAKTX,
          END OF I_MARA.
    DATA: BEGIN OF I_STKMVMNTS OCCURS 0,
           BWART LIKE MSEG-BWART,
           SHKZG LIKE MSEG-SHKZG,
           VZBEW LIKE YW2_STKMOVEMENTS-VZBEW,
          END OF I_STKMVMNTS.
    DATA: BEGIN OF I_FINALT OCCURS 0,
           WERKS LIKE MSEG-WERKS, " Plant
           MATNR LIKE MSEG-MATNR, " Material
           BUDAT LIKE MKPF-BUDAT, " Posting Date
           MTART LIKE MARA-MTART, " Material Type
           SPMON LIKE S031-SPMON, " Month
           MAKTX LIKE MAKT-MAKTX, " Description
    meins(3), " UOM
           MEINS LIKE MSEG-MEINS,
           O_STK LIKE MARDH-LABST, " opening stock
           TRECEP LIKE MARDH-LABST, " total receipts
           PRODU LIKE MARDH-LABST, " Net Receipts - Production
           RECEP LIKE MARDH-LABST, " Net Receipts - Receipts
           SAL_RET LIKE MARDH-LABST, " Net Receipts - Sales Return
           TDISP LIKE MARDH-LABST, " total dispatches
           CUSTMR LIKE MARDH-LABST, " Net Dispatches - Customers
           OPLANT LIKE MARDH-LABST, " Net Dispatches - To Other Plant
           TRFSTK LIKE MARDH-LABST, "Material Transfer stock
           TRLOSS LIKE MARDH-LABST, " Transit Loss
           WHLOSS LIKE MARDH-LABST, " Warehouse Loss
           TLOSS LIKE MARDH-LABST, " Total Loss
           C_STK LIKE MARDH-LABST, " Closing Stock
           OTHADJ LIKE MARDH-LABST,
           MONTH(8) ,
          END OF I_FINALT.
    DATA: IMKPFT LIKE I_MKPF OCCURS 0 WITH HEADER LINE.
    DATA: IMKPFT1 LIKE I_MKPF1 OCCURS 0 WITH HEADER LINE.
    DATA: IMARDT LIKE I_MARD OCCURS 0 WITH HEADER LINE.
    DATA: IMARDHT LIKE I_MARDH OCCURS 0 WITH HEADER LINE.
    DATA: T_FINAL LIKE I_MKPF OCCURS 0 WITH HEADER LINE.
    DATA: IMKPFT2 LIKE I_MKPF OCCURS 0 WITH HEADER LINE.
    FCAT is used for the field catalog
    DATA: FCAT TYPE TABLE OF SLIS_FIELDCAT_ALV WITH NON-UNIQUE DEFAULT KEY
                      WITH HEADER LINE INITIAL SIZE 0,
    for excluding the ICONs from the application toolbar
          FEXC TYPE TABLE OF SLIS_EXTAB WITH NON-UNIQUE DEFAULT KEY
                     WITH HEADER LINE INITIAL SIZE 0,
    FS_LAYO is used for Grid Layout
          FS_LAYO TYPE SLIS_LAYOUT_ALV,
    FEVENTS to handle the events TOP OF PAGE & USER_COMMAND
          FEVENTS TYPE TABLE OF SLIS_ALV_EVENT WITH NON-UNIQUE DEFAULT KEY
                     WITH HEADER LINE INITIAL SIZE 0,
    FHEADER is used for List header
          FHEADER TYPE TABLE OF SLIS_LISTHEADER WITH NON-UNIQUE DEFAULT KEY
                     WITH HEADER LINE INITIAL SIZE 0,
    sort is used for sorting
          FSORT TYPE TABLE OF SLIS_SORTINFO_ALV WITH NON-UNIQUE DEFAULT KEY
                     WITH HEADER LINE INITIAL SIZE 0,
          FCAT1 TYPE TABLE OF SLIS_FIELDCAT_ALV WITH NON-UNIQUE DEFAULT KEY
                    WITH HEADER LINE INITIAL SIZE 0,
          FS_LAYO1 TYPE SLIS_LAYOUT_ALV,
          GT_LIST_TOP_OF_PAGE1 TYPE SLIS_T_LISTHEADER,
          FEVENTS1 TYPE TABLE OF SLIS_ALV_EVENT WITH NON-UNIQUE DEFAULT KEY
                 WITH HEADER LINE INITIAL SIZE 0,
           FHEADER1 TYPE TABLE OF SLIS_LISTHEADER WITH NON-UNIQUE DEFAULT  
                  KEY WITH HEADER LINE INITIAL SIZE 0,
           G_STATU_071 TYPE SLIS_FORMNAME VALUE 'Z_PFSTATUS',
           ALV_VARIANT1 LIKE DISVARIANT.
    Variable Declaration *
    TYPES: TRFF_TYPE_DEC_6_5(6) TYPE P DECIMALS 5.
    DATA: FYEAR(4),
          MON(2),
          FYEAR1(4),
          MON1(2),
          OBAL LIKE MARD-LABST,
          CBAL LIKE MARD-LABST,
          INDEX TYPE I,
          COUNT,
          COUNT1 TYPE I,
          O_STK TYPE P DECIMALS 3,
          C_STK TYPE P DECIMALS 3,
          V_MJAHR LIKE MKPF-MJAHR,
          MONTHS TYPE TRFF_TYPE_DEC_6_5,
          MONTH TYPE I.
    Global variables for handling ALV functionality
    DATA: ALV_KEYINFO TYPE SLIS_KEYINFO_ALV,
          ALV_VARIANT LIKE DISVARIANT,
          ALV_LAYOUT TYPE SLIS_LAYOUT_ALV,
          ALV_REPID LIKE SY-REPID,
          ALV_PRINT TYPE SLIS_PRINT_ALV,
          ALV_DETAIL_FUNC(30),
          ALV_DEFAULT_VARIANT LIKE DISVARIANT-VARIANT,
          ALV_COLOURIZE_FIELDS LIKE MMIM_REP_PRINT-COLOR.
    RANGES: R_BUDAT FOR MKPF-BUDAT.
    *Added by Prabhu for year on 26.4.05.
    DATA: IDATE LIKE R_BUDAT OCCURS 0 WITH HEADER LINE.
    Selection Screen Elements *
    SELECTION-SCREEN BEGIN OF BLOCK BLK WITH FRAME TITLE TEXT-001.
      SELECT-OPTIONS: S_WERKS FOR MARD-WERKS OBLIGATORY NO INTERVALS.
      PARAMETER: P_SPMON LIKE S031-SPMON NO-DISPLAY .
      SELECT-OPTIONS: S_MATNR FOR MARA-MATNR OBLIGATORY,
                      S_LGORT FOR MSEG-LGORT NO-EXTENSION NO INTERVALS,
                      S_MBLNR FOR MKPF-MBLNR,
                      S_BUDAT FOR MKPF-BUDAT OBLIGATORY .
    SELECTION-SCREEN END OF BLOCK BLK.
    SELECTION-SCREEN BEGIN OF BLOCK BLK3 WITH FRAME TITLE TEXT-004.
          PARAMETER : MTART LIKE MARA-MTART DEFAULT 'FERT' NO-DISPLAY.
    SELECTION-SCREEN END OF BLOCK BLK3.
    SELECTION-SCREEN BEGIN OF BLOCK BLK2 WITH FRAME TITLE TEXT-003.
    SELECTION-SCREEN END OF BLOCK BLK2.
    ADDED BY PRABHU FOR DAY-WISE REPORT.
    SELECTION-SCREEN BEGIN OF BLOCK B3 WITH FRAME TITLE TEXT-007.
      PARAMETERS: D1 RADIOBUTTON GROUP P1 DEFAULT 'X',
                  M1 RADIOBUTTON GROUP P1,
                  Y1 RADIOBUTTON GROUP P1.
    SELECTION-SCREEN END OF BLOCK B3.
    SELECTION-SCREEN BEGIN OF BLOCK B2 WITH FRAME TITLE TEXT-006.
    PARAMETERS: ALV_DEF LIKE DISVARIANT-VARIANT.
    SELECTION-SCREEN END OF BLOCK B2.
    DATA: S_BUDAT1 LIKE S_BUDAT OCCURS 0 WITH HEADER LINE."prabhu
    Initialization *
    INITIALIZATION.
      PERFORM ALV_INIT.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR ALV_DEF.
      PERFORM ALV_F4.
    At Selection Screen
    *AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_spmon.
    PERFORM monat_f4.
    At Selection Screen *
    AT SELECTION-SCREEN.
    checking for the layout
      PERFORM ALV_CHECK.
    authorisation check for the Plant
    PERFORM auth_check.
    Validation for the Plant
      PERFORM VALIDITY_CHECK.
      IF MTART NE 'FERT'.
        MESSAGE E041 WITH 'Material Type must be FERT Only...'.
      ENDIF.
      IF D1 = 'X'." On 26.4.05.
        P_SPMON0(4) = S_BUDAT-LOW0(4).
        P_SPMON4(2) = S_BUDAT-LOW4(2).
      ELSE.
        P_SPMON0(4) = S_BUDAT-LOW0(4).
        P_SPMON4(2) = S_BUDAT-LOW4(2).
      ENDIF.
      LOOP AT S_BUDAT.
        IF S_BUDAT-HIGH IS INITIAL.
          S_BUDAT-HIGH = S_BUDAT-LOW.
          MODIFY S_BUDAT.
        ENDIF.
      ENDLOOP.
      IDATE-LOW = S_BUDAT-LOW.
      IDATE-HIGH = S_BUDAT-HIGH.
      CALL FUNCTION 'FIMA_DAYS_AND_MONTHS_AND_YEARS'
        EXPORTING
           I_DATE_FROM = IDATE-LOW
           I_DATE_TO = IDATE-HIGH
       IMPORTING
    E_DAYS =
          E_MONTHS = MONTH
    E_YEARS =
      DATA: I(3) TYPE C.
      I = S_BUDAT-LOW+4(2).
      CLEAR: R_BUDAT.
      REFRESH: R_BUDAT.
    *added by Prabhu for Only for Oneday.on 18.5.5
      IF MONTH EQ '0'.
        MONTH = MONTH + 1.
      ENDIF.
    *added by Prabhu for Only for Oneday.on 18.5.5
      DO MONTH TIMES.
        R_BUDAT-LOW = S_BUDAT-LOW.
        APPEND R_BUDAT.
      ENDDO.
      I = 0.
      LOOP AT R_BUDAT.
        R_BUDAT-LOW4(2) = S_BUDAT-LOW4(2) + I.
        I = I + 1.
        R_BUDAT-LOW+6(2) = '01'.
        MODIFY R_BUDAT.
      ENDLOOP.
      LOOP AT R_BUDAT.
        CALL FUNCTION 'RP_LAST_DAY_OF_MONTHS'
           EXPORTING
             DAY_IN = R_BUDAT-LOW
           IMPORTING
             LAST_DAY_OF_MONTH = R_BUDAT-HIGH
          EXCEPTIONS
            DAY_IN_NO_DATE = 1
            OTHERS = 2
        MODIFY R_BUDAT.
      ENDLOOP.
      LOOP AT R_BUDAT.
        IF R_BUDAT-LOW4(2) = S_BUDAT-LOW4(2).
          R_BUDAT-LOW = S_BUDAT-LOW.
          MODIFY R_BUDAT.
        ENDIF.
        IF R_BUDAT-HIGH4(2) = S_BUDAT-HIGH4(2).
          R_BUDAT-HIGH = S_BUDAT-HIGH.
          MODIFY R_BUDAT.
        ENDIF.
    For Summary on 26.4.05.
        IF Y1 = 'X'.
          CLEAR R_BUDAT.
          REFRESH R_BUDAT.
          R_BUDAT-LOW = S_BUDAT-LOW.
          R_BUDAT-HIGH = S_BUDAT-HIGH.
          APPEND R_BUDAT.
          CLEAR R_BUDAT.
        ENDIF.
      ENDLOOP.
    At Selection Screen *
    AT SELECTION-SCREEN OUTPUT.
    Start of Selection *
    START-OF-SELECTION.
      V_MJAHR = P_SPMON+0(4).
    Get plant distinction warehouse/production
      PERFORM GET_PLANT_DISTINCTION.
    Collect the data from various tables
      PERFORM GETDATA_FG_STOCK.
    here the number of rows in the output table is found
      PERFORM OUTPUT_TABLE_CHECK.
    here the top of the page code is written, that is to be displayed
    in the output
      PERFORM Z_TOP_OF_PAGE.
    here ALV layout properties are set
      PERFORM Z_LAYOUT_SETTINGS.
    ALV EVENTS for TOP OF PAGE and for USER COMMAND
      PERFORM Z_ALV_EVENTS.
    The field catalog is defined for the Primary List is defined in
    the subroutine CREATE_FIELD_CATALOG include program ZPRRDOCR_FCAT
      PERFORM Z_CREATE_FIELD_CATALOG.
    This is for displaying the output
      PERFORM Z_REUSE_ALV_GRID_DISPLAY.
    *& Form getdata_fg_stock
    Getting data from standard tables
    FORM GETDATA_FG_STOCK.
    For getting the Start date & end date of the month
    PERFORM get_month_dates.
    Getting the Opening Stock from MARDH table
      IF MON EQ '01'.
        MON1 = MON.
        FYEAR1 = FYEAR.
        MON = '12'.
        FYEAR = FYEAR - 1.
      ELSE.
        MON1 = MON.
        FYEAR1 = FYEAR.
        MON = MON - 1.
        FYEAR = FYEAR.
      ENDIF.
      PERFORM GET_RECORDS_FROM_DB.
    *added for Month Summary on 26.4.05.
      LOOP AT R_BUDAT.
        S_BUDAT-LOW = R_BUDAT-LOW.
        S_BUDAT-HIGH = R_BUDAT-HIGH.
    *for Month
        P_SPMON0(4) = S_BUDAT-LOW0(4).
        P_SPMON4(2) = S_BUDAT-LOW4(2).
    *for summary.
        IF Y1 = 'X'.
          LOOP AT S_BUDAT.
            S_BUDAT1-SIGN = 'I'.
            S_BUDAT1-OPTION = 'NB'.
            S_BUDAT1-LOW = S_BUDAT-LOW.
            S_BUDAT1-HIGH = S_BUDAT-HIGH.
            APPEND S_BUDAT1.
            CLEAR S_BUDAT1.
          ENDLOOP.
        ENDIF.
        IMKPFT[] = I_MKPF[].
        IMKPFT2[] = I_MKPF[].
        IMARDT[] = I_MARD[].
        IMARDHT[] = I_MARDH[].
        PERFORM MONTH_WISE.
        PERFORM PROCESS_MOVEMENTS.
        PERFORM CALCULATE_OPENING_STOCK.
        PERFORM UPDATE_NON_TRANSACTION_ITMS.
        PERFORM DELETE_EMPTY_RECORDS.
        CLEAR: IMARDHT,IMARDT,IMKPFT1,IMKPFT,I_FINAL,I_FINAL5.
        REFRESH: IMARDHT,IMARDT,IMKPFT1,I_FINAL,I_FINAL5,IMKPFT.
      ENDLOOP.
      CLEAR: R_BUDAT.
      REFRESH: R_BUDAT.
    *end of changes for month.
    ENDFORM. " getdata_fg_stock
    FORM MONAT_F4 *
    F4-Hilfe für Monat *
    FORM MONAT_F4.
      DATA: BEGIN OF MF_DYNPFIELDS OCCURS 1.
              INCLUDE STRUCTURE DYNPREAD.
      DATA: END OF MF_DYNPFIELDS.
      DATA: MF_RETURNCODE LIKE SY-SUBRC,
             MF_MONAT LIKE ISELLIST-MONTH,
             MF_HLP_REPID LIKE SY-REPID.
      FIELD-SYMBOLS: .
    Wert von Dynpro lesen
      GET CURSOR FIELD MF_DYNPFIELDS-FIELDNAME.
      APPEND MF_DYNPFIELDS.
      MF_HLP_REPID = SY-REPID.
      DO 2 TIMES.
        CALL FUNCTION 'DYNP_VALUES_READ'
          EXPORTING
            DYNAME               = MF_HLP_REPID
            DYNUMB               = SY-DYNNR
          TABLES
            DYNPFIELDS           = MF_DYNPFIELDS
          EXCEPTIONS
            INVALID_ABAPWORKAREA = 01
            INVALID_DYNPROFIELD  = 02
            INVALID_DYNPRONAME   = 03
            INVALID_DYNPRONUMMER = 04
            INVALID_REQUEST      = 05
            NO_FIELDDESCRIPTION  = 06
            UNDEFIND_ERROR       = 07.
        IF SY-SUBRC = 3.
    Aktuelles Dynpro ist Wertemengenbild
          MF_HLP_REPID = 'SAPLALDB'.
        ELSE.
          READ TABLE MF_DYNPFIELDS INDEX 1.
    Unterstriche durch Blanks ersetzen
          TRANSLATE MF_DYNPFIELDS-FIELDVALUE USING '_ '.
          EXIT.
        ENDIF.
      ENDDO.
      IF SY-SUBRC = 0.
    Konvertierung ins interne Format
        CALL FUNCTION 'CONVERSION_EXIT_PERI_INPUT'
          EXPORTING
            INPUT         = MF_DYNPFIELDS-FIELDVALUE
          IMPORTING
            OUTPUT        = MF_MONAT
          EXCEPTIONS
            ERROR_MESSAGE = 1.
        IF MF_MONAT IS INITIAL.
    Monat ist initial => Vorschlagswert aus akt. Datum ableiten
          MF_MONAT = SY-DATLO(6).
        ENDIF.
        CALL FUNCTION 'POPUP_TO_SELECT_MONTH'
          EXPORTING
            ACTUAL_MONTH               = MF_MONAT
          IMPORTING
            SELECTED_MONTH             = MF_MONAT
            RETURN_CODE                = MF_RETURNCODE
          EXCEPTIONS
            FACTORY_CALENDAR_NOT_FOUND = 01
            HOLIDAY_CALENDAR_NOT_FOUND = 02
            MONTH_NOT_FOUND            = 03.
        IF SY-SUBRC = 0 AND MF_RETURNCODE = 0.
    ASSIGN (MF_DYNPFIELDS-FIELDNAME) TO <MF_FELD>. " ==>> note 148804
    <MF_FELD> = MF_MONAT.
          CALL FUNCTION 'CONVERSION_EXIT_PERI_OUTPUT'
            EXPORTING
              INPUT  = MF_MONAT
            IMPORTING
              OUTPUT = MF_DYNPFIELDS-FIELDVALUE.
          COLLECT MF_DYNPFIELDS.
          CALL FUNCTION 'DYNP_VALUES_UPDATE'
            EXPORTING
              DYNAME               = MF_HLP_REPID
              DYNUMB               = SY-DYNNR
            TABLES
              DYNPFIELDS           = MF_DYNPFIELDS
            EXCEPTIONS
              INVALID_ABAPWORKAREA = 01
              INVALID_DYNPROFIELD  = 02
              INVALID_DYNPRONAME   = 03
              INVALID_DYNPRONUMMER = 04
              INVALID_REQUEST      = 05
              NO_FIELDDESCRIPTION  = 06
              UNDEFIND_ERROR       = 07. "<<== note 148804
        ENDIF.
      ENDIF.
    ENDFORM.                                                    "MONAT_F4
    *& Form get_month_dates
    Calculating the Month Start & End Date
    FORM GET_MONTH_DATES.
      IF M1 = 'X'.
        FYEAR = P_SPMON+0(4).
        MON = P_SPMON+4(2).
        CONCATENATE FYEAR MON '01' INTO R_BUDAT-LOW.
        R_BUDAT-SIGN = 'I'.
        R_BUDAT-OPTION = 'BT'.
        CALL FUNCTION 'BKK_GET_MONTH_LASTDAY'
          EXPORTING
            I_DATE = R_BUDAT-LOW
          IMPORTING
            E_DATE = R_BUDAT-HIGH.
        APPEND R_BUDAT.
        CLEAR S_BUDAT.
        REFRESH S_BUDAT.
        S_BUDAT-SIGN = 'I'.
        S_BUDAT-OPTION = 'BT'.
        S_BUDAT-LOW = R_BUDAT-LOW.
        S_BUDAT-HIGH = R_BUDAT-HIGH.
        APPEND S_BUDAT.
      ELSE.
        FYEAR = P_SPMON+0(4).
        MON = P_SPMON+4(2).
        CONCATENATE FYEAR MON '01' INTO R_BUDAT-LOW.
        R_BUDAT-SIGN = 'I'.
        R_BUDAT-OPTION = 'BT'.
        CALL FUNCTION 'BKK_GET_MONTH_LASTDAY'
          EXPORTING
            I_DATE = R_BUDAT-LOW
          IMPORTING
            E_DATE = R_BUDAT-HIGH.
        APPEND R_BUDAT.
      ENDIF.
    ENDFORM. " get_month_dates
    *& Form output_table_Check
    checking for records for output
    FORM OUTPUT_TABLE_CHECK .
      DESCRIBE TABLE I_FINALT LINES INDEX.
      IF INDEX EQ 0.
        MESSAGE I041 WITH TEXT-005.
        LEAVE LIST-PROCESSING.
      ENDIF.
    ENDFORM. "OUTPUT_TABLE_CHECK
    *& Form Z_TOP_OF_PAGE
    for setting the details in the top of page *
    has no formal paramters *
    FORM Z_TOP_OF_PAGE.
      DATA: V_MON(2),
      V_YR(40),
      V_FIN(18),
      V_FIN1(48),
      LOW(10),
      HIGH(10).
      V_MON = P_SPMON+4(2).
      V_YR = P_SPMON+0(4).
      FHEADER-TYP = 'H'.
      FHEADER-INFO = 'Stock Register Report (FG Stock)'.
      APPEND FHEADER.
      CLEAR FHEADER.
    *if m1 = 'X'.
    CONCATENATE 'Month = ' v_mon '.' v_yr INTO v_fin.
    fheader-typ = 'H'.
    fheader-info = v_fin.
    APPEND fheader.
    CLEAR fheader.
    *endif."prabhu on 18.5.5
      IF D1 = 'X'.
        CLEAR S_BUDAT.
        LOOP AT S_BUDAT.
          CONCATENATE S_BUDAT-LOW6(2) '/' S_BUDAT-LOW4(2) '/'
          S_BUDAT-LOW+0(4) INTO LOW.
          CONCATENATE S_BUDAT-HIGH6(2) '/' S_BUDAT-HIGH4(2) '/'
          S_BUDAT-HIGH+0(4) INTO HIGH.
          CONCATENATE 'Date = ' LOW ' - ' HIGH INTO V_FIN1.
          FHEADER-TYP = 'H'.
          FHEADER-INFO = V_FIN1.
          APPEND FHEADER.
          CLEAR FHEADER.
        ENDLOOP.
      ENDIF.
    ENDFORM. " Z_TOP_OF_PAGE
    *& Form Z_LAYOUT_SETTINGS
    this is done for setting the properties for the layout of the *
    grid *
    has no formal paramters *
    FORM Z_LAYOUT_SETTINGS.
      FS_LAYO-ZEBRA = 'X'. " Output in Zebra pattern
      FS_LAYO-DETAIL_POPUP = 'X'. " A popup window appears to give
      FS_LAYO-DETAIL_TITLEBAR = TEXT-022.
      FS_LAYO-COLWIDTH_OPTIMIZE = 'X'.
    ENDFORM. " Z_LAYOUT_SETTINGS
    *& Form Z_ALV_EVENTS
    This is used for handling the events TOP OF PAGE and the USER *
    COMMAND event *
    has no formal paramters *
    FORM Z_ALV_EVENTS.
      CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
        EXPORTING
          I_LIST_TYPE = 0
        IMPORTING
          ET_EVENTS   = FEVENTS[].
      READ TABLE FEVENTS WITH KEY NAME = 'TOP_OF_PAGE'.
      IF SY-SUBRC = 0.
        FEVENTS-FORM = 'Z_TOPOFPAGE'.
        MODIFY FEVENTS INDEX SY-TABIX.
        CLEAR FEVENTS.
      ENDIF.
      READ TABLE FEVENTS WITH KEY NAME = 'USER_COMMAND'.
      IF SY-SUBRC = 0.
        FEVENTS-FORM = 'Z_USER_COMMAND'.
        MODIFY FEVENTS INDEX SY-TABIX.
        CLEAR FEVENTS.
      ENDIF.
    ENDFORM. "Z_ALV_EVENTS
    *& Form Z_CREATE_FIELD_CATALOG
    here the field catalog is created for the primary list *
    no formal parameters *
    FORM Z_CREATE_FIELD_CATALOG.
    for the Plant
      FCAT-FIELDNAME = 'WERKS'.
      FCAT-KEY = 'X'.
      FCAT-OUTPUTLEN = '000005'.
      FCAT-JUST = 'L'.
      FCAT-SELTEXT_M = 'Plant'.
      FCAT-DDICTXT = 'M'.
      FCAT-INTTYPE = 'C'.
      FCAT-DATATYPE = 'CHAR'.
      APPEND FCAT.
      CLEAR FCAT.
    for the Material Type
      FCAT-FIELDNAME = 'MTART'.
      FCAT-KEY = 'X'.
      FCAT-OUTPUTLEN = '000006'.
      FCAT-JUST = 'L'.
      FCAT-SELTEXT_M = 'MatTyp'.
      FCAT-DDICTXT = 'M'.
      FCAT-INTTYPE = 'C'.
      FCAT-DATATYPE = 'CHAR'.
      APPEND FCAT.
      CLEAR FCAT.
    for the Material No.
      FCAT-FIELDNAME = 'MATNR'.
      FCAT-KEY = 'X'.
    fcat-hotspot = 'X'.
      FCAT-OUTPUTLEN = '000018'.
      FCAT-JUST = 'L'.
      FCAT-SELTEXT_M = 'Material'.
      FCAT-DDICTXT = 'M'.
      FCAT-INTTYPE = 'C'.
      FCAT-DATATYPE = 'CHAR'.
      APPEND FCAT.
      CLEAR FCAT.
    for the Material Description
      FCAT-FIELDNAME = 'MAKTX'.
      FCAT-KEY = ''.
      FCAT-OUTPUTLEN = '000040'.
      FCAT-JUST = 'L'.
      FCAT-SELTEXT_M = 'Description'.
      FCAT-DDICTXT = 'M'.
      FCAT-INTTYPE = 'C'.
      FCAT-DATATYPE = 'CHAR'.
      APPEND FCAT.
      CLEAR FCAT.
    for the Unit of Measure
      FCAT-FIELDNAME = 'MEINS'.
      FCAT-KEY = ''.
      FCAT-OUTPUTLEN = '03'.
      FCAT-JUST = 'C'.
      FCAT-SELTEXT_M = 'UOM'.
      FCAT-DDICTXT = 'M'.
      FCAT-INTTYPE = 'C'.
      FCAT-DATATYPE = 'UNIT'.
      APPEND FCAT.
      CLEAR FCAT.
    for the Plant
      FCAT-FIELDNAME = 'MONTH'.
      FCAT-KEY = 'X'.
      FCAT-OUTPUTLEN = '08'.
      FCAT-JUST = 'L'.
      FCAT-SELTEXT_M = 'MONTH'.
      FCAT-DDICTXT = 'M'.
      FCAT-INTTYPE = 'C'.
      FCAT-DATATYPE = 'CHAR'.
      APPEND FCAT.
      CLEAR FCAT.
    for the Opening Stock
      FCAT-FIELDNAME = 'C_STK'.
      FCAT-HOTSPOT = ' '.
      FCAT-OUTPUTLEN = '000016'.
      FCAT-JUST = 'L'.
      FCAT-SELTEXT_M = 'Opening Stock'.
      FCAT-DDICTXT = 'M'.
      FCAT-INTTYPE = 'Q'.
      FCAT-DATATYPE = 'QUAN'.
    fcat-do_sum = 'X'.
      FCAT-JUST = 'R'.
      FCAT-NO_ZERO = 'X'.
      APPEND FCAT.
      CLEAR FCAT.
    for the Total Receipts
      FCAT-FIELDNAME = 'TRECEP'.
      FCAT-HOTSPOT = ' '.
      FCAT-OUTPUTLEN = '000016'.
      FCAT-JUST = 'L'.
      FCAT-SELTEXT_M = 'Total Receipts'.
      FCAT-DDICTXT = 'M'.
      FCAT-INTTYPE = 'Q'.
      FCAT-DATATYPE = 'QUAN'.
      FCAT-DO_SUM = 'X'.
      FCAT-JUST = 'R'.
      FCAT-NO_ZERO = 'X'.
      APPEND FCAT.
      CLEAR FCAT.
    for the Production
      FCAT-FIELDNAME = 'PRODU'.
      FCAT-HOTSPOT = ' '.
      FCAT-OUTPUTLEN = '000016'.
      FCAT-JUST = 'L'.
      FCAT-SELTEXT_M = 'Production'.
      FCAT-DDICTXT = 'M'.
      FCAT-INTTYPE = 'Q'.
      FCAT-DATATYPE = 'QUAN'.
      FCAT-DO_SUM = 'X'.
      FCAT-JUST = 'R'.
      FCAT-NO_ZERO = 'X'.
      APPEND FCAT.
      CLEAR FCAT.
    for the Other Plant Receipts
      FCAT-FIELDNAME = 'RECEP'.
      FCAT-HOTSPOT = ' '.
      FCAT-OUTPUTLEN = '000016'.
      FCAT-JUST = 'L'.
      FCAT-SELTEXT_M = 'Othr Plnt Recpts'.
      FCAT-DDICTXT = 'M'.
      FCAT-INTTYPE = 'Q'.
      FCAT-DATATYPE = 'QUAN'.
      FCAT-DO_SUM = 'X'.
      FCAT-JUST = 'R'.
      FCAT-NO_ZERO = 'X'.
      APPEND FCAT.
      CLEAR FCAT.
    Sales Return
      FCAT-FIELDNAME = 'SAL_RET'.
      FCAT-HOTSPOT = ' '.
      FCAT-OUTPUTLEN = '000016'.
      FCAT-JUST = 'L'.
      FCAT-SELTEXT_M = 'Sales Return'.
      FCAT-DDICTXT = 'M'.
      FCAT-INTTYPE = 'Q'.
      FCAT-DATATYPE = 'QUAN'.
      FCAT-DO_SUM = 'X'.
      FCAT-JUST = 'R'.
      FCAT-NO_ZERO = 'X'.
      APPEND FCAT.
      CLEAR FCAT.
    Total Dispatches
      FCAT-FIELDNAME = 'TDISP'.
      FCAT-HOTSPOT = ' '.
      FCAT-OUTPUTLEN = '000016'.
      FCAT-JUST = 'L'.
      FCAT-SELTEXT_M = 'Total Dispatches'.
      FCAT-DDICTXT = 'M'.
      FCAT-INTTYPE = 'Q'.
      FCAT-DATATYPE = 'QUAN'.
      FCAT-DO_SUM = 'X'.
      FCAT-JUST = 'R'.
      FCAT-NO_ZERO = 'X'.
      APPEND FCAT.

  • Refresh alv list display

    Hi,
    how to refresh an ALV LIST display?
    Thanks.

    Hi,
    Content and Structure Change
    Use
    You are able to change the internal data table in various ways. Depending on which type of change you use, you  have to proceed differently to make the change visible on the front end in the ALV output as well.
    You are able to make the following changes:
    ·        You change content or the sequence of the individual data records
    Afterwards you need to refresh the ALV output
    ·        You replace the entire data table
    Refresh Display of the ALV Output
    If you have changed single values, added rows or deleted rows in the data table of list-type ALV outputs, you need to complete these changes in the ALV output as well by refreshing the ALV display.
    For Changes in the Tree Structure you do not have to refresh the display. In the other ALV tools, you do not have to refresh the ALV output when you make the following changes:
    §         Changes to the Display of Columns
    §         Changes Sequence of Columns in the ALV display
    §         Changes to the DDIC Reference of Columns
    By default, the ALV output automatically scrolls to the beginning. However, you are able to determine that the current display (position on the screen) not be changed.
    You are able to refresh the ALV output in two ways:
    ·        All settings for filters and sorting remain.
    This setting can lead to newly inserted data records not being displayed because the filter setting hid exactly these data records.
    ·        All settings for filters and sorting remain.
    Features
    For changes to content and structure, you are able to make the following settings:
    ·        Refresh ALV output
    ·        Swap the data table of the ALV output
    Refresh ALV output
    With the refresh, you ensure that the changed values are available on the front end as well.
    Display type
    ALV Tool
    Classic ABAP list
    Full screen
    In the Container
    Simple, two-dimensional table
    Yes
    Yes
    Yes
    Hierarchical-sequential list
    Yes
    Tree structure
    No
    No
    Methods
    Function
    Class
    Method
    Refresh ALV output without deleting filter and sort settings
    CL_SALV_TABLE
    CL_SALV_HIERSEQ_TABLE
    REFRESH
    (Parameter REFRESH_MODE: SOFT)
    Refresh ALV output and delete filter and sort settings
    REFRESH
    (Parameter REFRESH_MODE: FULL)
    Change the Structure of the Data Table with SET_DATA
    Depending on which ALV tool you are using, the parameters of the SET_DATA method are different:
    If you assign a new structure with SET_DATA, all objects that referred to the previous structure will be deleted such as all sort objects in list-type ALV outputs or all node objects in tree structures.
    Methods
    Function
    Class
    Method
    Change structure and data table
    CL_SALV_TABLE
    CL_SALV_HIERSEQ_TABLE
    CL_SALV_TREE
    CL_SALV_HIERSEQ_LEVEL
    SET_DATA
    Change the Structure of the Data Table with the SET_DATA Method
    ALV Tool
    Parameter
    Remarks
    Simple, two-dimensional table
    T_TABLE
    Table for structure and contents of the ALV output
    Hierarchical-sequential list
    (in CL_SALV_HIERSEQ_TABLE)
    LEVEL
    Hierarchy level whose structure you wish to change
    T_TABLE
    New table of hierarchy level
    T_BINDING
    List of up to five foreign-key relationships
    (in CL_SALV_HIERSEQ_LEVEL)
    VALUE
    New table of hierarchy level
    T_BINDING
    List of up to five foreign-key relationships
    Tree structure
    T_TABLE
    Initial table
    Empty table, only sets the structure

Maybe you are looking for