Alv Grid layout

Hi Experts,
                  The requirment of my alv loyout is as follows..
  For the paticular customer number and customer name i should get the layout. like for expample.
Cust Num 100
cust nam sunita for this paticular doc num, doc date...etc should come in one box...
for Cust num 100
cust name SDn for this paticular doc num doc date..etc..should come...in the following box.
Note here cust num ..cust name are in the top-of-page and for each cust name we should hav diffrent box..
hope all experts have undestand my problem.. please help me out...
Corrects answers will be awarded with good points..
Regards
Sunita

Hi,
create a Filed cataolog for the Customer name With Output_len = 100 ( as it shud accomodiate name , date..etc,).
Now in ur logic Concatenate all the fields which shud come in One cell, and fill teh final internal table.
Now pass this Internal table to the FM " reuse_alv_grid/list.."
revrt back if any issues,
regards,
Naveen

Similar Messages

  • Alv grid layout display in 2 pages

    Hi All,
    I am presently working in ALV programming.
    The client requierment is "GL line items and summary sheet will be listed in separate pages."
    i am dispalying the output using ALV grid layout display.
    Can you please conform that how to write logic for summary sheet.that will display after the line items and also saparate page.
    Thanks,
    Sridhar

    Hi ,
          Use event END OF PAGE .
    Write a Form for end of page
    then do calcualtions.
    Reward if useful.

  • ALV Grid Layouts - Setting them user-specific

    Hi everybody -
    I am using the ALV grid layout for a report using function module REUSE_ALV_GRID_DISPLAY.  There are a number of fields that are not immediately viewed on screen - they are in hide mode within the field catalog.  We want to allow the users to add them / remove them from the report using an ALV variant.
    I can allow the users to add/remove with a layout variant no problem - but I am having an issue allowing them to save the variant that they are using to view the data, as user-specific.  For whatever reason, they are only allowed to save their layout variants as global - the "User-specific" box is grayed out.
    Does anyone know how I can get the "User Specific" box to be NOT grayed out within an ALV grid?
    Thanks!
    Abby

    Set the I_SAVE parameter to 'U' in your function call.
    Regards
    Rich Heilman

  • How to download only some fields(dynamically) from alv grid layouts

    I have ALV grid list.
    I have layouts for selecting sets of fields dynamically.
    If I select a particular layout, I want to download only those fields into an Excel sheet.
    If I select another layout, I want to download only fields of that layout , into an Excel sheet.
    Can u plz write examples.
    Narendra

    Hello ,
    Here it is.
      FIELD-SYMBOLS <FS> TYPE ANY.
      DATA: GR_ATTACHMENT TYPE Z48S3_ATTACHMENT,
            GT_ATTACHMENT TYPE Z48S3_ATTACHMENT_TAB,
            L_F_TITLE     TYPE SO_OBJ_DES,
            L_R_FIELDCAT  LIKE LINE OF GT_FIELDCAT,
            L_F_FIELD     LIKE L_R_FIELDCAT-FIELDNAME,
            L_F_EMAILID   TYPE Z48S3_RECEIVER,
            L_F_FIRST     TYPE C.
      IF SY-SYSID EQ G_C_DEV_SYSTEM OR
         SY-SYSID EQ G_C_QUA_SYSTEM.
        CONCATENATE SY-SYSID '/' SY-MANDT ':' INTO L_F_TITLE.
        CONDENSE L_F_TITLE.
        CONCATENATE L_F_TITLE SY-TITLE INTO L_F_TITLE SEPARATED BY SPACE.
      ELSE.
        L_F_TITLE = SY-TITLE.
      ENDIF.
      G_R_VARIANT-REPORT = SY-REPID.
      G_R_VARIANT-VARIANT = P_VARIAN.
      CALL FUNCTION 'REUSE_ALV_VARIANT_SELECT'
           EXPORTING
                I_DIALOG            = 'N'
                I_USER_SPECIFIC     = 'A'
                I_DEFAULT           = 'X'
                IT_DEFAULT_FIELDCAT = G_T_FIELDCAT
                I_LAYOUT            = GR_LAYOUT
           IMPORTING
                ET_FIELDCAT         = G_T_FIELDCAT
                ES_LAYOUT           = GR_LAYOUT
           CHANGING
                CS_VARIANT          = G_R_VARIANT
           EXCEPTIONS
                ERROR_MESSAGE       = 4
                OTHERS              = 4.
      SORT G_T_FIELDCAT BY COL_POS.
      PERFORM CREATE_EXCEL_ATTM_HEADING_ROW TABLES GT_ATTACHMENT
                                                   G_T_FIELDCAT.
      LOOP AT G_T_ALVLIST.
        L_F_FIRST = 'X'.
        LOOP AT G_T_FIELDCAT INTO L_R_FIELDCAT WHERE NO_OUT IS INITIAL.
          CLEAR GR_ATTACHMENT-XNEWLINE.
          IF NOT L_F_FIRST IS INITIAL.
            GR_ATTACHMENT-XNEWLINE = 'X'.
            CLEAR L_F_FIRST.
          ENDIF.
          CLEAR L_F_FIELD.
          CONCATENATE 'G_T_ALVLIST-' L_R_FIELDCAT-FIELDNAME
                 INTO L_F_FIELD.
          CONDENSE L_F_FIELD.
          ASSIGN (L_F_FIELD) TO <FS>.
          WRITE <FS> TO GR_ATTACHMENT-FIELDVALUE.
          UNASSIGN <FS>.
          APPEND GR_ATTACHMENT TO GT_ATTACHMENT.
        ENDLOOP.
      ENDLOOP.
    Regards,
    Vasanth

  • How to use Style in LVC_S_LAYO (ALV Grid Layout)

    Hi Experts,
    I am trying to set field 'STYLEFNAME' of LVC_S_LAYO while setting up layout for ALV GRID using 'SET_TABLE_FOR_FIRST_DISPLAY' . I'm passing the field name contain the styles for each row. I am setting it in the same way we set 'INFO_FNAME' by passing color field name for coloring the rows. Styles are available in include <CL_ALV_CONTROL> .
    Please note styles are working properly when I am setting it at field cat level by setting fieldcat field LVC_S_FCAT-STYLE. But set sets style for entire column. I want to set style for few rows. I want to use style 'ALV_STYLE_BUTTON' .
    Please advice how to do this.
    Regards,
    Sushant.

    I'll try to understand your question.
    You have a 'new-style' alv and want to show some fields as pushbutton.
    To make a cell to be displayed as a pushbutton, we have two steps.
    Firstly, insert a new inner table of type u201CLVC_T_STYLu201D into your list data table.
    *--- Internal table holding list data
    DATA BEGIN OF gt_list OCCURS 0 .
    INCLUDE STRUCTURE SFLIGHT .
    DATA rowcolor(4) TYPE c .
    DATA cellcolors TYPE lvc_t_scol .
    DATA carrid_handle TYPE int4 .
    DATA connid_handle TYPE int4 .
    DATA cellstyles TYPE lvc_t_styl .
    DATA END OF gt_list .
    Fill this inner table for each field to be displayed as pushbutton.
    DATA ls_style TYPE lvc_s_styl .
    READ TABLE gt_list INDEX 7 .
    ls_style-fieldname = 'SEATSMAX' .
    ls_style-style = cl_gui_alv_grid=>mc_style_button .
    APPEND ls_style TO gt_list-cellstyles .
    MODIFY gt_list INDEX 7 .
    As usual, we state our list data table field related with styles in the layout structure at field u2018STYLEFNAMEu2019.
    e.g. ps_layout-stylefname = 'CELLSTYLES' .
    Button click event is handled like hotspot click via the event u201Cbutton_clicku201D through its parameters u201Ces_col_idu201D and u201Ces_row_nou201D which contain the address of the clicked pushbutton cell.

  • Alv grid layout as default.

    In an alv grid you can personalize the layout (Change layout, save layout). Is it possible to somehow add this saved layout to the report so that it will be shown as the defaylt layout for eveyone that runs the report?
    Best Regards Claes

    Hello Rich Heilman and thank you for your help.
    I solved the problem as you suggested in the first example. This has worked great but now i need to set different layouts depending of what the user chooses. This i have not solved yet.
    Is there anything else that I need to do except create the layouts with those names <i>/Y23HPAREsum</i> and <i>Y23HPAREind</i> as you se in the code below?
    data:  variant type disvariant.
           variant-report = sy-repid.
      if p_sum eq 'X'.
           variant-VARIANT = '<i>/Y23HPAREsum</i>'.
           else.
           variant-VARIANT = '<i>Y23HPAREind</i>'.
      endif.
    form reuse_alv_list_display.
      data : l_repid like sy-repid.
      move sy-repid to l_repid.
      call function 'REUSE_ALV_GRID_DISPLAY'
        exporting
          i_callback_program     =   l_repid
          i_callback_top_of_page =   st_formname_top_of_page
          it_fieldcat            =   st_fieldcat[]
            i_save               =   'X'
            is_variant           =   variant
        tables
          t_outtab               = lt_rec.
    endform.                               " REUSE_ALV_LIST_DISPLAY
    Best Regards Claes

  • Problem with ALV GRID layout

    Hi friends
    really need yours help
    I have to show an ALV grid with checkbox as first column.
    This checkbox is based on internal table condition may be enabled or disabled, other columns are disabled.
    I used the structure 'ZMESD' where i decleared that checkbox field.
    I called function module:
    CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
        EXPORTING
          i_structure_name   = 'ZMESD'
          i_bypassing_buffer = 'X'
        CHANGING
          ct_fieldcat        = it_fieldcat[].
      x_fieldcat-seltext_s = 'CheckBox'.
      x_fieldcat-checkbox  = 'X'.      " Display this field as a
      x_fieldcat-edit      = 'X'.     " You can specify the width of a
      MODIFY it_fieldcat FROM x_fieldcat TRANSPORTING seltext_s checkbox
    edit WHERE fieldname = 'CHK' .
    Now the problem is, I want to use
    "REUSE_ALV_GRID_DISPLAY", where I am using
    is_layout  = x_layout
    and value of x_layout is filled based on condition as follows
      LOOP AT gt_grid INTO ls_outtab.
        DATA l_tabix TYPE i.
        IF ls_outtab-status = 'Reserved'.  "This is the condition for which checkbox is disabled
          l_tabix = sy-tabix.
          REFRESH lt_edit.
          ls_edit-fieldname = 'CHK'.
          ls_edit-style = cl_gui_alv_grid=>mc_style_disabled.
          ls_edit-style2 = space.
          ls_edit-style3 = space.
          ls_edit-style4 = space.
          ls_edit-maxlen = 10.
          APPEND ls_edit TO lt_edit.
          APPEND LINES OF lt_edit TO ls_outtab-handle_style.
          MODIFY gt_grid INDEX l_tabix FROM ls_outtab  TRANSPORTING
                                            handle_style .
        ENDIF.
      ENDLOOP.
    Now I finally i m using:
      <b>x_layout-lights_tabname = 'handle_style'.</b>
    but its giving dump.
    I am sure its only because i havent found the corrosponding X_layout field for 'handle_event'.
    Please help me, as its urgent.
    Points ll be awarded for sure.

    Thank you friends
    I got the answer.
    I used function module
    CALL FUNCTION <b>'LVC_FIELDCATALOG_MERGE</b>'
       EXPORTING
      I_BUFFER_ACTIVE              =
         i_structure_name             = 'ZMESD'
      I_CLIENT_NEVER_DISPLAY       = 'X'
         i_bypassing_buffer           = 'X'
      I_INTERNAL_TABNAME           =
        CHANGING
          ct_fieldcat                  = it_fieldcat[].
    EXCEPTIONS
      INCONSISTENT_INTERFACE       = 1
      PROGRAM_ERROR                = 2
      OTHERS                       = 3
    Its solved the problem

  • "alv grid" layout as default does not work

    I created a layout for my ALV and saved it. It is supossed to appear as default but every time I restart the ALV the layout is gone and I have to select it again. Do I have to do something else besides putting it as default in the "Layout choose" selection? Thanks in advance.

    Hello,
    Did you pass the parameters: IS_LAYOUT & I_SAVE to the ALV function module?
      FP_ST_LAYOUT-ZEBRA = C_X.
      FP_ST_LAYOUT-COLWIDTH_OPTIMIZE = C_X.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          I_CALLBACK_PROGRAM       = SY-REPID
          IS_LAYOUT                = FP_ST_LAYOUT
          IT_FIELDCAT              = FP_IT_FIELDCAT
          I_SAVE                   = 'A'
        TABLES
          T_OUTTAB                 = FP_IT_OUTPUT
        EXCEPTIONS
          PROGRAM_ERROR            = 1
          OTHERS                   = 2.
      IF SY-SUBRC <> 0.
    *   Error in calling Standard ALV Functional Module
        MESSAGE I019. "Error Occured in ALV Function Module
        LEAVE LIST-PROCESSING.
      ENDIF.
    Hope this helps.
    BR,
    Suhas

  • Create unique handle for ALV grid layout

    Hi,
    in some generic classes we display internal tables in a grid. We want to activate the save&maintain layouts feature by passing the DISVARIANT structure, Here wen have to give Report and handle. As we display some more tables using the same method, we must set a unique handle so that saved ALV layouts do not get merged /confused. As we do not have a table name at this point, my idea is to create a hash key based on the fields in the field catalog (field catalog is only distinguishable object here).
    I need an algorithm to create the 4-character handle as a hash value based on the (concatenated) field names in field catalog.
    Or a better idea to create unique handles in the generic ALV calls in one program.
    Please: Serious answers only.
    Regards,
    Clemens

    Here it is
    function enqueuecomputehash.
    *"*"Lokale Schnittstelle:
    *"  IMPORTING
    *"     VALUE(INPUT) TYPE  STRING
    *"     VALUE(INPUT_LEN) TYPE  I
    *"     VALUE(HASH_LEN) TYPE  I
    *"  EXPORTING
    *"     REFERENCE(HASH) TYPE  STRING
    *"     REFERENCE(TIME_USEC) TYPE  I
    *"  EXCEPTIONS
    *"      INVALID_ARGUMENT
    field-symbols <text>.
    field-symbols <hash>.
    data: tmp_input type text8192.
    data: tmp_hash  type text8192.
    if input_len < 1 or hash_len < 1.
       raise invalid_argument.
    endif.
    assign tmp_input(input_len) to <text>.
    assign tmp_hash(hash_len) to <hash>.
    data: t1 type i,
          t2 type i.
    <text> = input.
    get run time field t1.
    call 'C_ENQ_WILDCARD' id 'TEXT'     field <text>
                          id 'TEXTHASH' field <hash>.
    get run time field t2.
    hash = <hash>.
    time_usec = t2 - t1.
    endfunction.

  • ALV Grid Layout problem

    I have define a form layout on the first screen (ALV) of my program then the program call another screen,  the same layout is applied to the new screen 0200 (ALV). I don't want the same layout been applied to the new screen. What is my problem?
    Regards,

    Hi Daniel ,
    Your problem can be solved by the following ways,
    For example : you have 2 screens , screen 200 and screen 201 .
    1)Go to T code SE51 , for 1st screen number 200. you create/drag a custom container as per your desired size.
    2) For the same program now for the second  screen 201 , you create/drag a custom container as per second screen requirement ,it should not same like 1st screen size (To see the difference between 1st and 2nd screens).
    With this you can solve your problem
    Regards,
    Saravana.S

  • How can we use the saved alv grid layout in a report?

    I have a requirement where I go to se16n transaction and select a few fields of a table and extract the data of the table. Again I re-arrange the columns in the report and save it as a variant along with this new layout. Now how to call this variant in a report wherein I want only the re arranged positions of the column(fields) of the field catalog? Is there any function module available?

    hi,
    you can have selection screen field : "parameters : p_disvar like disvariant-variant."  and at event selection scree you can call the below function and select the variant create for the report.
    "at selection-screen on value-request for p_disvar.
      call function 'REUSE_ALV_VARIANT_F4'
           exporting
                is_variant          = g_variant
              I_TABNAME_HEADER    =
              I_TABNAME_ITEM      =
              IT_DEFAULT_FIELDCAT =
                i_save              = g_variant_save
           importing
                e_exit              = h_exit
                es_variant          = gx_variant
            exceptions
                not_found           = 1
                program_error       = 2
                others              = 3.
      if sy-subrc is initial and h_exit is initial.
        g_variant-variant = gx_variant-variant.
        p_disvar          = gx_variant-variant.
      else.
        message id sy-msgid type 'S'
                     number sy-msgno
                     with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      endif.
    Atul

  • Searching for ALV grid layout variants

    How can I find weather there are any saved layout variants? I tried some functions like LVC_VARIANT_F4, but I do not need any pop-ups and so on. I need only to are there any saved variants or no.
    Thanks in advance
    Regards
    Peter Yordanov

    just declare like this and pass to IT_RA_REPORT.
    ranges: lr_report for ltdx-report.
      lr_report-sign = 'I'.
      lr_report-option = 'EQ'.
      lr_report-low    = gc_repid.
      append lr_report.
    and pass lr_report to   FM   LT_VARIANTS_READ_FROM_LTDX
    call function 'LT_VARIANTS_READ_FROM_LTDX'
           tables
                et_variants     = lt_variants
                it_ra_report    = lr_report
                it_ra_handle    = lr_handle
                it_ra_log_group = lr_log_group
                it_ra_username  = lr_username
                it_ra_variant   = lr_variant
                it_ra_type      = lr_type
           exceptions
                not_found       = 1
                others          = 2.

  • ALV Summation button is not working when GRID layout is specified

    Hi,
    I have created a report with Field: ALV Grid Layout. When i dont select anything in ALV GRID Layout. and execute the report. The outout is displayed in ALV Grid. and if i select amt column and PRESS SUMMATION button. im getting the total. Thats fine.
    When i select any of the saved layout in ALV Grid Layout field.and run the report, the output is geeting displayed. and if i select amt column and press SUMMATION Button, im getting info message in the popup saying "Desired operation cant be performed for Column 'amt'"
    Whts te problem ?
    Thanks in Advance.
    Jhovee.

    PART-II
    FORM f_display_data.
      TYPE-POOLS: slis.                    " ALV Global types
    DEFINE m_fieldcat.
        add 1 to ls_fieldcat-col_pos.
        ls_fieldcat-fieldname   = &1.
        ls_fieldcat-ref_tabname = 'VBAK'.
        ls_fieldcat-do_sum      = &2.
        ls_fieldcat-cfieldname  = &3.
        append ls_fieldcat to lt_fieldcat.
      END-OF-DEFINITION.
      DEFINE m_sort.
        add 1 to ls_sort-spos.
        ls_sort-fieldname = &1.
        ls_sort-up        = 'X'.
        ls_sort-subtot    = &2.
        append ls_sort to lt_sort.
      END-OF-DEFINITION.
      DATA: ls_fieldcat TYPE slis_fieldcat_alv,
        lt_fieldcat TYPE slis_t_fieldcat_alv,
        lt_sort     TYPE slis_t_sortinfo_alv,
        ls_sort     TYPE slis_sortinfo_alv,
        ls_layout   TYPE slis_layout_alv.
      m_fieldcat 'VKORG' ''  ''.
      m_fieldcat 'KUNNR' ''  ''.
      m_fieldcat 'VBELN' ''  ''.
      m_fieldcat 'NETWR' 'X' 'WAERK'.
      m_fieldcat 'WAERK' ''  ''.
      m_sort 'VKORG' 'X'.                  " Sort by vkorg and subtotal
      m_sort 'KUNNR' 'X'.                  " Sort by kunnr and subtotal
      m_sort 'VBELN' ''.                   " Sort by vbeln
      ls_layout-cell_merge = 'X'.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
           EXPORTING
                is_layout   = ls_layout
                it_fieldcat = lt_fieldcat
                it_sort     = lt_sort
           TABLES
               t_outtab    = gt_vbak.
    ENDFORM.                               " F_DISPLAY_DATA

  • Regarding Alv Grid Totals_text is not Printing

    Hi All,
    I am presently working in Alv Grid dispaly.
    I need to dispaly Totals_Text = 'Totals'. But this text is not displaying in my output dispaly.i am copying my code here.
    Code:
    REPORT  ZFTRSERV NO STANDARD PAGE HEADING
                     MESSAGE-ID YV
                     LINE-SIZE 255.
    TABLES: BSIS,           "Accounting: Secondary Index for G/L Accounts
            BSAS,           "Accounting: Secondary Index for G/L Accounts (Cleared Items)
            BSID,           "Accounting: Secondary Index for Customers
            BKPF,           "Accounting Document Header
            ITCPP.          "SAPscript output parameters
    TYPE-POOLS: SLIS.       "ALV Declarations
    $$********************************************************************
    $$    GLOBAL TYPES
    $$    NAMING CONVENTION: "Y_NAME"
    $$********************************************************************
    *eject
    $$********************************************************************
    $$    GLOBAL INTERNAL TABLES (WITH INCLUDE STRUCTURE)
    $$    NAMING CONVENTION: "I_NAME"
    $$********************************************************************
    $$********************************************************************
    $$    GLOBAL INTERNAL TABLES (CUSTOM STRUCTURE)
    $$    NAMING CONVENTION: "T_NAME"
    $$********************************************************************
    *eject
    $$********************************************************************
    $$    GLOBAL FIELD-SYMBOLS
    $$    NAMING CONVENTION: "<FS_NAME>"
    $$********************************************************************
    FIELD-SYMBOLS: <FS_BSIS>  TYPE Y_BSIS.
    $$********************************************************************
    $$    MACROS DECLARATION
    $$    NAMING CONVENTION: M_NAME
    $$********************************************************************
    $$********************************************************************
    $$    PARAMETERS & SELECT-OPTIONS
    $$    NAMING CONVENTION: "P_NAME" & "S_NAME"
    $$********************************************************************
    SELECTION-SCREEN BEGIN OF BLOCK SS01 WITH FRAME TITLE TEXT-B01.
    GENERAL SELECTIONS
    SELECT-OPTIONS:   S_BUKRS FOR BSIS-BUKRS OBLIGATORY,
                      S_HKONT FOR BSIS-HKONT OBLIGATORY,
                      S_BLART FOR BSIS-BLART,
                      S_BELNR FOR BSIS-BELNR.
    SELECTION-SCREEN END OF BLOCK SS01.
    SELECTION-SCREEN BEGIN OF BLOCK SS02 WITH FRAME TITLE TEXT-B02.
      OPEN ITEMS:
    SELECTION-SCREEN BEGIN OF LINE.
    PARAMETERS P_OPIT LIKE ITEMSET-XOPSEL RADIOBUTTON GROUP RAD1 DEFAULT 'X'.
    SELECTION-SCREEN COMMENT 3(20) TEXT-003 FOR FIELD P_OPIT.
    SELECTION-SCREEN END OF LINE.
    PARAMETERS P_STIDA LIKE RFPDO-ALLGSTID DEFAULT SY-DATLO.
    SELECTION-SCREEN SKIP.
    SELECTION-SCREEN: COMMENT (12) BLANK1,
                      COMMENT (20) TEXT-006 FOR FIELD P_OSST.
    PARAMETERS:  P_OSST  AS CHECKBOX DEFAULT SPACE.
    SELECTION-SCREEN: COMMENT (12) BLANK2,
                      COMMENT (20) TEXT-007 FOR FIELD P_OUTD.
    PARAMETERS:P_OUTD LIKE ITCPP-TDDEST.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN END OF BLOCK SS03.
    *eject
    $$********************************************************************
    $$    INITIALIZATION
    $$********************************************************************
    INITIALIZATION.
      CLEAR: E_BSID,
             E_BSIS,
             E_BSAS,
             E_BKPF,
             E_TOTAL,
             E_SUMSHET_OPEN,
             E_SUMSHET_CLEAR,
             E_SUMSHET_TOTAL,
             E_CATLOG,
             E_ALV_LAYOUT.
      FREE:  T_BSID,
             T_BSIS,
             T_BSAS,
             T_BKPF,
             T_TOTAL,
             T_SUMSHET_OPEN,
             T_SUMSHET_CLEAR,
             T_SUMSHET_TOTAL.
    *eject
    $$********************************************************************
    $$    AT SELECTION-SCREEN
    $$********************************************************************
    AT SELECTION-SCREEN .
    *eject
    $$********************************************************************
    $$    START-OF-SELECTION
    $$********************************************************************
    START-OF-SELECTION.
    To Get data from tables
      PERFORM F_OUT_DATA_RETRIEVEL.
    *eject
    $$********************************************************************
    $$    END-OF-SELECTION
    $$********************************************************************
    END-OF-SELECTION.
    To Display ALV Grid Layout
      PERFORM F_ALV_DATA_RETRIVAL.
    *eject
    *&      Form  f_out_data_retrievel
        data retrival for Open,Clear and All items
    FORM F_OUT_DATA_RETRIEVEL.
      IF P_OPIT EQ C_X.
    *‘open items’ is selected data will be retrieved from BSIS table.
        PERFORM F_OPEN_ITEMS.
    TO GET DATA FOR SUMMARY SHEET OPEN ITEMS.
        PERFORM F_GET_OPEN_SUMSHET.
      ENDIF.
    ENDFORM.                    " f_out_data_retrievel
    *&      Form  F_OPEN_ITEMS
       getting data for Open items from BSIS Table
    FORM F_OPEN_ITEMS .
      SELECT BUKRS
             HKONT
             AUGDT
             AUGBL
             ZUONR
             GJAHR
             BELNR
             BUZEI
             BUDAT
             BLDAT
             BLART
             BSCHL
             MWSKZ
             DMBTR
             SGTXT
        FROM BSIS
        INTO  CORRESPONDING FIELDS OF TABLE T_BSIS
       WHERE BUKRS IN S_BUKRS
         AND HKONT IN S_HKONT
         AND BLART IN S_BLART
         AND BELNR IN S_BELNR
         AND AUGDT NE P_STIDA .
      IF SY-SUBRC NE C_0.
        MESSAGE S999 WITH text-030.
      ENDIF.
      PERFORM F_GET_DATA_BSIS.
    ENDFORM.                    " F_OPEN_ITEMS
    To get the Entry date and Reference Key2
      PERFORM F_GET_DATA_BSIS.
    *&      Form  F_GET_DATA_BSAS
          GETTING DATA FROM BSAS TABLE
    FORM F_GET_DATA_BSAS .
      DATA: W_TABIX TYPE SY-TABIX.
      UNASSIGN <FS_BSAS>.
    GETTING DATA FROM BKPF AND BSID TABLES
      LOOP AT T_BSAS ASSIGNING <FS_BSAS>.
        CLEAR: E_BKPF,
               E_BSID,
               W_TABIX.
        MOVE SY-TABIX TO W_TABIX.
        SELECT SINGLE BUKRS
                      BELNR
                      GJAHR
                      CPUDT
                      BUDAT
          FROM BKPF
          INTO CORRESPONDING FIELDS OF E_BKPF
         WHERE BUKRS EQ E_BSAS-BUKRS
           AND BLART EQ E_BSAS-BLART
           AND BELNR EQ E_BSAS-BELNR
           AND BUDAT EQ E_BSAS-BUDAT.
        IF SY-SUBRC EQ C_0.
          MOVE E_BKPF-CPUDT TO <FS_BSAS>-CPUDT.
          MODIFY T_BSAS INDEX W_TABIX FROM <FS_BSAS>
                 TRANSPORTING CPUDT.
        ENDIF.
        SELECT SINGLE BUKRS
                      KUNNR
                      UMSKS
                      UMSKZ
                      AUGDT
                      AUGBL
                      ZUONR
                      GJAHR
                      BELNR
                      BUZEI
                      XREF2
          FROM  BSID
          INTO CORRESPONDING FIELDS OF E_BSID
         WHERE BUKRS EQ E_BSAS-BUKRS
           AND BELNR EQ E_BSAS-BELNR
           AND BLART EQ E_BSAS-BLART
           AND BUDAT EQ E_BSAS-BUDAT.
        IF SY-SUBRC EQ C_0.
          MOVE E_BSID-XREF2 TO <FS_BSAS>-XREF2.
          FREE T_BSID.
          MODIFY T_BSAS INDEX W_TABIX FROM <FS_BSAS>
                 TRANSPORTING XREF2.
        ENDIF.
        <FS_BSAS>-IDATE = SY-DATUM.
        <FS_BSAS>-IEDAT = <FS_BSAS>-CPUDT - <FS_BSAS>-ZUONR.
        <FS_BSAS>-PTIME = SY-DATUM - <FS_BSAS>-CPUDT.
        MODIFY T_BSAS INDEX W_TABIX FROM <FS_BSAS>
               TRANSPORTING IEDAT
                            PTIME
                            IDATE.
      ENDLOOP.
      SORT T_BSAS BY HKONT XREF2 CPUDT.
    ENDFORM.                    " F_GET_DATA_BSAS
    *&      Form  F_GET_DATA_BSIS
        GETTING DATA FROM BSIS TABLE
    FORM F_GET_DATA_BSIS .
      DATA: W_TABIX  TYPE SY-TABIX,
            W_SGTXT  LIKE BSIS-SGTXT,
            W_SGTXT1 LIKE BSIS-SGTXT,
            W_SORTL LIKE KNA1-SORTL.
      CLEAR: E_BKPF,
             E_BSID,
             W_TABIX,
             W_SGTXT,
             W_SGTXT1,
             W_SORTL.
    GETTING DATA FROM BKPF AND BSID TABLES
      LOOP AT T_BSIS INTO E_BSIS.
        MOVE SY-TABIX TO W_TABIX.
        SELECT SINGLE BUKRS
                      BELNR
                      GJAHR
                      CPUDT
                      BUDAT
          FROM BKPF
          INTO CORRESPONDING FIELDS OF E_BKPF
         WHERE BUKRS EQ E_BSIS-BUKRS
           AND BLART EQ E_BSIS-BLART
           AND BELNR EQ E_BSIS-BELNR
           AND BUDAT EQ E_BSIS-BUDAT.
        IF SY-SUBRC EQ C_0.
          MOVE E_BKPF-CPUDT TO E_BSIS-CPUDT.
          FREE T_BKPF.
          MODIFY T_BSIS INDEX W_TABIX FROM E_BSIS
                 TRANSPORTING CPUDT.
        ENDIF.
        SELECT SINGLE BUKRS
                      KUNNR
                      UMSKS
                      UMSKZ
                      AUGDT
                      AUGBL
                      ZUONR
                      GJAHR
                      BELNR
                      BUZEI
                      XREF2
          FROM BSID
          INTO CORRESPONDING FIELDS OF E_BSID
         WHERE BUKRS EQ E_BSIS-BUKRS
           AND BLART EQ E_BSIS-BLART
           AND BELNR EQ E_BSIS-BELNR
           AND BUDAT EQ E_BSIS-BUDAT.
        IF sy-subrc EQ C_0.
         DUMMY CHECK
        ENDIF.
        SELECT SINGLE  KUNNR
          FROM BSID
          INTO CORRESPONDING FIELDS OF E_BSID
         WHERE BUKRS EQ E_BSIS-BUKRS
           AND BLART EQ E_BSIS-BLART
           AND BELNR EQ E_BSIS-BELNR
           AND BUDAT EQ E_BSIS-BUDAT.
        IF sy-subrc EQ C_0.
         DUMMY CHECK
        ENDIF.
        SELECT SINGLE SORTL
          FROM KNA1
          INTO W_SORTL
         WHERE KUNNR EQ E_BSID-KUNNR.
        IF SY-SUBRC EQ C_0.
          MOVE W_SORTL TO E_BSIS-XREF2.
          MODIFY T_BSIS INDEX W_TABIX FROM E_BSIS
                 TRANSPORTING XREF2.
        ENDIF.
        W_SGTXT = E_BSIS-SGTXT.
        SPLIT W_SGTXT AT C_SLASH INTO W_SGTXT W_SGTXT1.
        MOVE: W_SGTXT TO E_BSIS-SGTXT,
              SY-DATUM TO E_BSIS-IDATE.
        DATA : W_ZOUNR LIKE BSAS-ZUONR,
               W_DATE TYPE D,
               W_Z(10) TYPE C.
        CLEAR:  W_ZOUNR,
                W_DATE,
                W_Z.
        MOVE E_BSIS-ZUONR TO W_ZOUNR.
        MOVE : W_ZOUNR4(4) TO W_Z0(4),
               W_ZOUNR2(2) TO W_Z4(2),
               W_ZOUNR0(2) TO W_Z6(2).
        MOVE W_Z TO W_DATE.
        E_BSIS-IEDAT = E_BSIS-CPUDT - W_DATE.
        CONCATENATE W_ZOUNR+0(2)  C_DOT
                    W_ZOUNR+2(2)  C_DOT
                    W_ZOUNR+4(4)  INTO E_BSIS-ZUONR.
        E_BSIS-PTIME = SY-DATUM - E_BSIS-CPUDT.
        MODIFY T_BSIS INDEX W_TABIX FROM E_BSIS
               TRANSPORTING IEDAT
                            PTIME
                            IDATE
                            SGTXT
                            ZUONR.                              "30TH
      ENDLOOP.
      SORT T_BSIS BY HKONT XREF2 CPUDT.
    ENDFORM.                    " F_GET_DATA_BSIS
    *&      Form  f_build_fld_catlog1
          BUILDING FIELD CATALOG FOR OPEN ITEMS DATA
    FORM F_FLD_CATLOG_OPEN_ITEMS.
      ORM f_fld_catlog_open_items.
      REFRESH i_catlog1.
      CLEAR w_col_pos.
      w_col_pos = w_col_pos + c_1.
      PERFORM f_first_field_catalog USING C_HKONT
                                          C_BSIS
                                          w_col_pos
                                          text-010
                                          SPACE
                                          SPACE.
      w_col_pos = w_col_pos + c_1.
      PERFORM f_first_field_catalog USING C_XREF2
                                          C_BSIS
                                          w_col_pos
                                          text-011
                                          SPACE
                                          SPACE.
      w_col_pos = w_col_pos + c_1.
      PERFORM f_first_field_catalog USING C_BELNR
                                          C_BSIS
                                          w_col_pos
                                          text-012
                                          SPACE
                                          SPACE.
      w_col_pos = w_col_pos + c_1.
      PERFORM f_first_field_catalog USING C_BLART
                                          C_BSIS
                                          w_col_pos
                                          text-013
                                          SPACE
                                          SPACE.
      w_col_pos = w_col_pos + c_1.
      PERFORM f_first_field_catalog USING c_BLDAT
                                          C_BSIS
                                          W_col_pos
                                          text-014
                                          SPACE
                                          SPACE.
      w_col_pos = w_col_pos + c_1.
      PERFORM f_first_field_catalog USING c_BUDAT
                                          C_BSIS
                                          w_col_pos
                                          text-015
                                          SPACE
                                          SPACE.
      w_col_pos = w_col_pos + c_1.
      PERFORM f_first_field_catalog USING c_CPUDT
                                          C_BSIS
                                          w_col_pos
                                          text-016
                                          SPACE
                                          SPACE.
      w_col_pos = w_col_pos + c_1.
      PERFORM f_first_field_catalog USING c_ZUONR
                                          C_BSIS
                                          w_col_pos
                                          text-017
                                          SPACE
                                          SPACE.
      w_col_pos = w_col_pos + c_1.
      PERFORM f_first_field_catalog USING c_BSCHL
                                          C_BSIS
                                          w_col_pos
                                          text-018
                                          SPACE
                                          SPACE.
      w_col_pos = w_col_pos + c_1.
      PERFORM f_first_field_catalog USING C_DMBTR
                                          C_BSIS
                                          w_col_pos
                                          text-019
                                          C_X           "dispaly Sum Total
                                          '40'.
      w_col_pos = w_col_pos + c_1.
      PERFORM f_first_field_catalog USING c_MWSKZ
                                          C_BSIS
                                          w_col_pos
                                          text-020
                                          SPACE
                                          SPACE.
      w_col_pos = w_col_pos + c_1.
      PERFORM f_first_field_catalog USING c_SGTXT
                                          C_BSIS
                                          w_col_pos
                                          text-021
                                          SPACE
                                          SPACE.
      w_col_pos = w_col_pos + c_1.
      PERFORM f_first_field_catalog USING c_IEDAT
                                          C_BSIS
                                          w_col_pos
                                          text-022
                                          SPACE
                                          SPACE.
      w_col_pos = w_col_pos + c_1.
      PERFORM f_first_field_catalog USING C_PTIME
                                          C_BSIS
                                          w_col_pos
                                          text-023
                                          SPACE
                                          SPACE.
      CLEAR: W_COL_POS,
             I_ALV_EVENTS.
    ENDFORM.                    " f_fld_catlog_open_items
    *&      Form  f_first_report_dispaly
         ROUTINE FOR OPEN ITEMS  GRID LAYOUT DISPLAY
    FORM F_DISPALY_OPEN_ITEMS.
      CLEAR W_REPNAME.
      W_REPNAME = SY-REPID.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
       EXPORTING
      I_INTERFACE_CHECK                 = ' '
      I_BYPASSING_BUFFER                = ' '
      I_BUFFER_ACTIVE                   = ' '
         I_CALLBACK_PROGRAM                = W_REPNAME
       I_CALLBACK_PF_STATUS_SET          = C_FSTAT
       I_CALLBACK_USER_COMMAND           = C_FUCOM
         I_CALLBACK_TOP_OF_PAGE            = C_FTOPI
      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                         = E_ALV_LAYOUT
         IT_FIELDCAT                       = I_CATLOG1[]
      IT_EXCLUDING                      =
      IT_SPECIAL_GROUPS                 =
      IT_SORT                           =
      IT_FILTER                         =
      IS_SEL_HIDE                       =
         I_DEFAULT                         = C_A
      I_SAVE                            = ' '
      IS_VARIANT                        =
         IT_EVENTS                         = I_ALV_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                          = T_BSIS
       EXCEPTIONS
         PROGRAM_ERROR                     = 1
         OTHERS                            = 2  .
      IF SY-SUBRC NE 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    ENDFORM.                    " f_dispaly_open_items
    *&      Form  f_first_field_catalog
          BUILDING FIELD CATALOG FOR SECONDERY LIST
         -->us_fieldname  field name
         -->us_ref field  ref field
         -->us_ref tab    ref table
         -->us_text       text
         -->us_sum        sum
    FORM F_FIRST_FIELD_CATALOG  USING    US_FIELDNAME TYPE ANY
                                         US_REF_TAB   TYPE ANY
                                         US_COL_POS   TYPE ANY
                                         US_COLTEXT   TYPE ANY
                                         US_DO_SUM    TYPE ANY
                                         us_out       type any.
      CLEAR E_CATLOG.
      MOVE : US_FIELDNAME TO E_CATLOG-FIELDNAME,
             US_REF_TAB   TO E_CATLOG-TABNAME,
             US_COL_POS   TO E_CATLOG-COL_POS,
             US_COLTEXT   TO E_CATLOG-SELTEXT_L,
             US_DO_SUM    TO E_CATLOG-DO_SUM,
             US_out       to E_CATLOG-outputlen.
      APPEND E_CATLOG TO I_CATLOG1.
      CLEAR E_CATLOG.
      APPEND E_CATLOG TO I_CATLOG1.
      CLEAR E_CATLOG.
    ENDFORM.                    " f_first_field_catalog
    *&      Form  F_ALV_DATA_RETRIVAL
          ALV DATA VALIDATION
    FORM F_ALV_DATA_RETRIVAL .
      IF  P_OPIT EQ C_X
      AND P_OSST EQ C_SPACE .
    building field catlog for ‘open items’  list
        PERFORM f_fld_catlog_open_items.
    first list display ‘open items’ list
        PERFORM f_dispaly_open_items.
    Building Alv Layout
        PERFORM f_alv_layout_open_items.
      ENDIF.
    Code to display only summary sheet P_OSST check box
      IF  P_OPIT EQ C_X
      AND P_OSST EQ C_X.
    building field catlog for ‘open items’ Summary sheet
        PERFORM F_FLD_CATLOG_SUMSHET_OPEN.
    first list display ‘open items’ Summary sheet
        PERFORM F_DISPALY_SUMSHEET_OPEN.
      ENDIF.
    ENDFORM.                    " F_ALV_DATA_RETRIVAL
    *&      Form  F_GET_OPEN_SUMSHET
         GET SUMMARY SHEET OPEN ITEM DATA
    FORM F_GET_OPEN_SUMSHET .
      SORT T_BSIS BY SGTXT.
      UNASSIGN <FS_BSIS>.
      LOOP AT T_BSIS ASSIGNING <FS_BSIS>.
        MOVE SY-TABIX TO W_TABIX.
        IF W_TABIX EQ C_1.
          MOVE : <FS_BSIS>-SGTXT TO W_SGTXT,
                 <FS_BSIS>-PTIME TO W_PTIME,
                 <FS_BSIS>-DMBTR TO W_DMBTR,
                 <FS_BSIS>-IEDAT TO W_IEDAT.
          W_COUNT = W_COUNT + C_1.
          CONTINUE.
        ELSE.
          IF <FS_BSIS>-SGTXT EQ W_SGTXT.
            W_PTIME = W_PTIME + <FS_BSIS>-PTIME.
            W_DMBTR = W_DMBTR + <FS_BSIS>-DMBTR.
            W_COUNT = W_COUNT + C_1.
            W_IEDAT = W_IEDAT + <FS_BSIS>-IEDAT.
            CONTINUE .
          ELSE.
            W_ATIME = W_PTIME / W_COUNT.
            W_IEDAT = W_IEDAT / W_COUNT.
            MOVE : W_SGTXT TO E_SUMSHET_OPEN-SGTXT,
                   W_COUNT TO E_SUMSHET_OPEN-COUNT,
                   W_ATIME TO E_SUMSHET_OPEN-ATIME,
                   W_DMBTR TO E_SUMSHET_OPEN-DMBTR,
                   W_IEDAT TO E_SUMSHET_OPEN-IEDAT.
            APPEND E_SUMSHET_OPEN TO T_SUMSHET_OPEN.
            CLEAR: W_SGTXT,
                   W_PTIME,
                   W_DMBTR,
                   W_COUNT,
                   W_IEDAT.
            MOVE :  <FS_BSIS>-SGTXT TO W_SGTXT,
                    <FS_BSIS>-PTIME TO W_PTIME,
                    <FS_BSIS>-DMBTR TO W_DMBTR,
                    <FS_BSIS>-IEDAT TO W_IEDAT.
            W_COUNT = W_COUNT + C_1.
            CONTINUE.
          ENDIF.
        ENDIF.
      ENDLOOP.
      W_ATIME = W_PTIME / W_COUNT.
      W_IEDAT = W_IEDAT / W_COUNT.
      MOVE : W_SGTXT TO E_SUMSHET_OPEN-SGTXT,
             W_COUNT TO E_SUMSHET_OPEN-COUNT,
             W_ATIME TO E_SUMSHET_OPEN-ATIME,
             W_DMBTR TO E_SUMSHET_OPEN-DMBTR,
             W_IEDAT TO E_SUMSHET_OPEN-IEDAT.
      APPEND E_SUMSHET_OPEN TO T_SUMSHET_OPEN.
      CLEAR  E_SUMSHET_OPEN.
    ENDFORM.                    " F_GET_OPEN_SUMSHET
    *&      Form  F_TOP_OF_PAGE
          ITEMS TOP OF PAGE DATA
    FORM F_TOP_OF_PAGE .
      DATA: T_HEADER  TYPE SLIS_T_LISTHEADER,
            W_HEADER TYPE SLIS_LISTHEADER,
            T_LINE    LIKE W_HEADER-INFO.
      CLEAR W_HEADER.
    *TITLE
      MOVE C_H TO W_HEADER-TYP.
      MOVE C_TEXT TO W_HEADER-INFO.
      APPEND W_HEADER TO T_HEADER.
      CLEAR W_HEADER.
      MOVE C_S TO W_HEADER-TYP.
      MOVE C_TEXT2 TO W_HEADER-KEY.
      CONCATENATE  SY-DATUM+6(2) C_SLASH
                   SY-DATUM+4(2) C_SLASH
                   SY-DATUM(4) INTO W_HEADER-INFO.
      APPEND W_HEADER TO T_HEADER.
      CLEAR: W_HEADER.
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
        EXPORTING
          IT_LIST_COMMENTARY = T_HEADER.
    ENDFORM.                    " F_TOP_OF_PAGE
    FORM F_DISPALY_SUMSHEET_OPEN .
      CLEAR w_repname.
      w_repname = sy-repid.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
       EXPORTING
      I_INTERFACE_CHECK                 = ' '
      I_BYPASSING_BUFFER                = ' '
      I_BUFFER_ACTIVE                   = ' '
         I_CALLBACK_PROGRAM                = w_repname
       I_CALLBACK_PF_STATUS_SET          = C_FSTAT
      I_CALLBACK_USER_COMMAND           = ' '
       I_CALLBACK_TOP_OF_PAGE            =  C_FTOPS
      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                         = e_alv_layout
         IT_FIELDCAT                       = i_catlog1[]
      IT_EXCLUDING                      =
      IT_SPECIAL_GROUPS                 =
      IT_SORT                           =
      IT_FILTER                         =
      IS_SEL_HIDE                       =
         I_DEFAULT                         = C_A
      I_SAVE                            = ' '
      IS_VARIANT                        =
         IT_EVENTS                         = i_alv_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                          = T_SUMSHET_OPEN
       EXCEPTIONS
         PROGRAM_ERROR                     = 1
         OTHERS                            = 2
      IF SY-SUBRC NE 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      FREE T_SUMSHET_OPEN.
    ENDFORM.                    " F_DISPALY_SUMSHEET_OPEN
    *&      Form  F_TOP_OF_PAGE_SUMSHET
          TOP OF PAGE FOR SUMMARY SHEET
    FORM F_TOP_OF_PAGE_SUMSHET .
      DATA: T_HEADER  TYPE SLIS_T_LISTHEADER,
            W_HEADER TYPE SLIS_LISTHEADER,
            T_LINE    LIKE W_HEADER-INFO.
      CLEAR: W_HEADER,
             T_HEADER,
             T_LINE.
    *TITLE
      MOVE C_H TO W_HEADER-TYP.
      MOVE C_TEXT1 TO W_HEADER-INFO.
      APPEND W_HEADER TO T_HEADER.
      CLEAR W_HEADER.
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
        EXPORTING
          IT_LIST_COMMENTARY = T_HEADER.
    ENDFORM.                    " F_TOP_OF_PAGE_SUMSHET
    *&      Form  F_PF_STATUS
          GET PF STATUS
    FORM F_PF_STATUS USING US_EXTAB TYPE SLIS_T_EXTAB.
      SET PF-STATUS C_STAT EXCLUDING US_EXTAB.
    ENDFORM.                    "F_PF_STATUS
    *&      Form  F_USER_COMMAND
          GET USER COMMAND
    *FORM F_USER_COMMAND USING W_UCOMM LIKE SY-UCOMM
                             US_SELFIELD  TYPE SLIS_SELFIELD.
    FORM F_USER_COMMAND USING US_UCOMM LIKE SY-UCOMM
                                      US_SELFIELD  TYPE SLIS_SELFIELD.
      CONSTANTS:C_NEXT(6)  TYPE C  VALUE '&NEXT'.
      if sy-subrc eq c_0.
        MOVE C_TEXT3 TO US_SELFIELD-TABNAME.
      endif.
      IF   P_OPIT  EQ C_X
      AND  US_UCOMM EQ C_NEXT .
        PERFORM F_FLD_CATLOG_SUMSHET_OPEN.
        PERFORM F_DISPALY_SUMSHEET_OPEN.
      ELSEIF  P_CLIT EQ C_X
      AND     US_UCOMM EQ C_NEXT.
        PERFORM F_FLD_CATLOG_SUMSHET_CLEAR.
        PERFORM F_DISPALY_SUMSHET_CLEAR.
      ELSEIF  P_ALIT EQ C_X
      AND     US_UCOMM EQ C_NEXT.
        PERFORM F_FLD_CATLOG_SUMSHET_TOTAL.
        PERFORM F_DISPALY_SUMSHET_TOTAL.
      ENDIF.
    ENDFORM.                    "F_USER_COMMAND
    *&      Form  f_alv_layout_open_items
          text
    ----

    Hi,
    Please refer to the sample code :
    *&      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
    Thanks,
    Sriram Ponna.

  • ALV Grid Excel in Place using REUSE_ALV_GRID_DISPLAY

    I have a ALV grid displayed in a report and i have a bunch of layouts created by various users and the layouts works fine when selected. But when I use 'Excel'  (excel-in-place) button to export the grid into an excel sheet, the order of the columns are all jumbled up and not in sync with the ALV grid layout on the screen. However, when I use export to local file>excel option, the order of columns are in sync with the layout. Can any one explain why this is happening and how I can fix it ? Is there any OSS note or something that I need to apply ?
    PS : I am using REUSE_ALV_GRID_DISPLAY to display the report and I am building the fieldcatalog manually
    Eg :
    CLEAR r_fieldcatalog.
      MOVE 'TB_OUTPUT'  TO r_fieldcatalog-tabname.
      MOVE 'BUKRS'      TO r_fieldcatalog-fieldname.
      MOVE 'VBAK'       TO r_fieldcatalog-ref_tabname.
      MOVE 'BUKRS_VF'   TO r_fieldcatalog-ref_fieldname.
      MOVE text-f01     TO r_fieldcatalog-seltext_s.
      MOVE text-f01     TO r_fieldcatalog-seltext_m.
      MOVE text-f01     TO r_fieldcatalog-seltext_l.
      add '1' to lv_col_pos .
      move lv_col_pos to r_fieldcatalog-col_pos .
      APPEND r_fieldcatalog TO tc_fieldcatalog.
      CLEAR r_fieldcatalog.
      MOVE 'TB_OUTPUT'  TO r_fieldcatalog-tabname.
      MOVE 'VKORG'      TO r_fieldcatalog-fieldname.
      MOVE 'VBAK'       TO r_fieldcatalog-ref_tabname.
      MOVE 'VKORG'      TO r_fieldcatalog-ref_fieldname.
      MOVE text-f02     TO r_fieldcatalog-seltext_s.
      MOVE text-f02     TO r_fieldcatalog-seltext_m.
      MOVE text-f02     TO r_fieldcatalog-seltext_l.
      add '1' to lv_col_pos .
      move lv_col_pos to r_fieldcatalog-col_pos .
      APPEND r_fieldcatalog     TO tc_fieldcatalog.
    Thanks in advance,
    Shareen

      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          i_callback_pf_status_set = 'ALV_PF_STATUS'
          i_callback_program       = sy-repid
          is_layout                = gs_layout
          it_fieldcat              = gt_fieldcat[]
          i_default                = ' '
          i_save                   = g_save
        TABLES
          t_outtab                 = it_tab
        EXCEPTIONS
          program_error            = 1
          OTHERS                   = 2.
    and beneath this just put a form.as its shown.
    FORM alv_pf_status USING l_alv_excl TYPE STANDARD TABLE.
      SET PF-STATUS 'STANDARD_FULLSCREEN' "excluding lt_extab
                    OF PROGRAM 'SAPLSETB'.
    ENDFORM.                    "alv_pf_status

Maybe you are looking for

  • Down Payments only with Down Payment Request

    Hello, is there a way to post a down payment only from a down payment request, i mean that the user only can make the down payment from a previously down payment request. I notice that there is a SAP message F5002 , how can i activate this message, b

  • Data access

    I have a fileLoader class that process multiple files and store data in a Vector of Vector structure(data matrix), then I need to access these data in my other classes to process them. Should I use static modifier for the Vector of Vector in order fo

  • Maestro need help also code is 75957252

    maestro need help also code is 75957252 for bios password reset This question was solved. View Solution.

  • Javascript confirm alert Can we change the text ok

    can we change the ok and cancel text in the javascript confirm alert. pls respond, its very ungent Edited by: Bini John on Jun 10, 2009 9:19 AM

  • Cannot access audiogon via firefox or safarai on my mac; please help.

    Until this afternoon, using Safari and then google, I never had a problem accessing audiogon. I tried google via firefox and have the same problem. Can you help me restore access? Please know that there is not a problem with audiogon. I contacted a f