Displaying ALV hierarchy at a certain level

Hi all,
I have an ALV report that shows a hierarchy. This ALV hierarchy is created using std class CL_GUI_ALV_TREE.
The number of hierarchy levels is dynamic and only determined during run time. However I would like to be able to either display all nodes expanded or only the last node unexpanded. In other words I would like to control which hierarhcy level is expanded when the report is first displayed.
Can anyone suggest a way to do this please?
Thanks

If you want to display the sum for a given hierarchy level, you should use CUBESET function.
 e.g.
=IF(B2="all",CUBESET("mycube","[Location].[Location Hierarchy].[Department].&[DEPT 07]","all"),Cubemember("MyCube","[Location].[Location Hierarchy].[Department].&[DEPT 07].&["&B1&"]"))
Hope it helps.

Similar Messages

  • Control display level for "display as hierarchy" in BI 7 Query Designer ?

    Hi
    I'm using BI 7.0 query designer and I can see there's an additional difference between BI 3.5 and BI 7.0 in rows/columns behavior, in the "display as hierarchy" functionality.
    In BW 3.5 one could specify till what level the expand needed to be by default. So it could be 0 for totally collapsed. This is seems not possible anymore in BI 7.0 query designs anymore. Only on natural/technical hierarchies (cost center etc ...) this option is still there.
    Is there a way (javascript or other) to have the hierarchies created by "display as hierarchy" also fully collapsed by default ?
    Thanks.
    Geert

    HI, thanks for the reply.
    But this is not about the standard InfoObject 'hierarchy" tab, with all it's options on default expand levels etc.
    This is about a "pseudo structure" hierarchy which is defined at designtime (in Query Designer) and generated/shown at runtime (so bad for performance, I know). It's based on the real transaction data, not on a pre-created hierarchy as in normal hierarchies. It creates a tree view of otherwise unrelated InfoObjects, displays it in an collapsible/expandable tree shape.
    it's a bit hidden in version 7 Query Designer, compared to version 3.5. In 3.5 one had a larger set of options, including the -now lacking- default expand-to level. But in Version 7, most options are dropped. Probably due to the move from the ABAP to the java backend, lots of other stuff got culled in that move as well.
    For more info, look at the posts from Larry in this thread : [Display as Hierarchy|Display as Hierarchy]
    I know it's an option not used a lot but can be handy in certain cases.
    I really would like some help in getting a default query result with the "display as Hierarchy" collapsed.
    Thanks,
    Geert

  • ALV Hierarchy display: How to get rid of the bullets ?

    Hi All,
    I am using Web dypro ALV to display my data, and I use ALV display type hierarchy.  When I expand the parent node in my hierarchy column, I get bullets in my lower level rows in the hierarchy column( this is the standard hierarchical ALV display). Is it possible to override these bullets ? I want to have a link to action element instead of the bullets in that column(for the lower level rows). If this is not possible, then atleast I would like to have an empty column with no text instead of the bullets. Could any one of you please help me ?
    Thanks and Best Regards,
    Viqar Ali.

    Hi jagruti,
    It is very simple to display a Hierarchical ALV. Just do the following:
        lr_column = l_value->if_salv_wd_column_settings~get_column( 'COLUMN_NAME' ).
    For hierarchical column display: Set column as hierarchy column
        lr_column->if_salv_wd_column_hierarchy~set_hierarchy_column( abap_true ).
    Use display type hierarchical for the table.
        l_value->if_salv_wd_table_settings~set_display_type( if_salv_wd_c_table_settings=>display_type_hierarchy ).
    This is sufficient coding to display the ALV as a hierarchy.
    However, my problem is that when I display the ALV as a hierarchy, I get bullets in the hierarchy column in my lower level rows on expanding the parent node. I wanted to know if it is possible to get rid of the bullets.
    Thanks and Best Regards,
    Viqar Ali.

  • Multiple levels in ALV Hierarchy

    Hi All
    How to display Multiple levels in ALV Hierarchy.
    I have header and Item Tables but Under Header Expansions I have to display one more Expansion.
    Means Multiple levels.

    Hi,
      I think you can check standard program BCALV_TEST_HIERSEQ_LIST
    Regards,
    Himanshu

  • How to display the Hierarchy Node Level in BEx

    Hi Folks,
    In my report I have a Hierarchy. I have to display the Node level of the Hierarchy in the output.
    For Eg:
             If I have BB under AA root node then in the output it should display Level 1 for AA and Level 2 for BB.
    Thanks in Advance.
    Regards,
    Srikanth N

    I don't think it is possble to display the hierarchy level in the report itself.
    However, if you go to properties of the characteristic where you have the hierarchy defined, there you can expand the hierarchy to a pre-defined level...I guess you know that.
    AT

  • Hierarchial display alv

    hi friendz
    i am new to abap.i tried executing the hierarchial display alv, but i did not get the output.though i got the field names in the output but there are no contents displayed.i am including the code here.please help me out.
    rg
    sandeep
    REPORT  ZVV_ALV_HIERARCHIAL .
    *--type pools
    TYPE-POOLS: slis.
    *--tables declaration
    TABLES: SFLIGHT,SPFLI.
    *--types declaration
    DATA: BEGIN OF i_SFLIGHT OCCURS 0,
          CARRID LIKE SFLIGHT-CARRID,
          CONNID LIKE SFLIGHT-CONNID,
          FLDATE LIKE SFLIGHT-FLDATE,
           END OF i_SFLIGHT.
    DATA: BEGIN OF i_SPFLI OCCURS 0,
          CARRID LIKE SPFLI-CARRID,
          CONNID LIKE SPFLI-CONNID,
         AIRPFROM LIKE SPFLI-AIRPFROM,
         AIRPTO LIKE SPFLI-AIRPTO,
           DISTANCE LIKE SPFLI-DISTANCE,
          END OF i_SPFLI.
    *--variables
    DATA: i_repid LIKE sy-repid.
    i_repid = sy-repid.
    DATA: i_field TYPE  slis_t_fieldcat_alv.
    DATA: G_TABNAME_HEADER TYPE SLIS_TABNAME.
    DATA: G_TABNAME_ITEM TYPE SLIS_TABNAME.
    DATA: G_KEYINFO TYPE SLIS_KEYINFO_ALV.
    *--select options
    SELECT-OPTIONS :  S_CARRID FOR SFLIGHT-CARRID .
    *--initialosation
    INITIALIZATION.
    *--selection screen on
    AT SELECTION-SCREEN .
    *--start of selection
    START-OF-SELECTION.
      SELECT CARRID
             CONNID
             FLDATE
             FROM SFLIGHT INTO TABLE i_SFLIGHT
             WHERE CARRID IN S_CARRID.
    IF NOT i_SFLIGHT IS INITIAL.
        SELECT CARRID
               CONNID
               DISTANCE
               INTO TABLE i_SPFLI FROM SPFLI
               FOR ALL ENTRIES IN I_SFLIGHT
               WHERE CARRID = i_SFLIGHT-CARRID.
      ENDIF.
      PERFORM fill_fieldcatalog1.
      PERFORM fill_fieldcatalog2.
      PERFORM HIERARCHY_ALV.
    PERFORM alv_events.
    G_KEYINFO-header01 = 'CARRID'.
    G_KEYINFO-item01   = 'CONNID'.
    G_TABNAME_HEADER = 'I_SFLIGHT'.
    G_TABNAME_ITEM  = 'I_SPFLI'.
    *&      Form  fill_fieldcatalog
    FORM fill_fieldcatalog1 .
      CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
       EXPORTING
                       i_program_name               = i_repid
                       i_internal_tabname           = 'I_SFLIGHT'
                      i_structure_name             = EKPO
                     I_CLIENT_NEVER_DISPLAY       = 'X'
                       i_inclname                   = i_repid
                     I_BYPASSING_BUFFER           = 'X'
                     I_BUFFER_ACTIVE              = ''
        CHANGING
                       ct_fieldcat                  = i_field
                   EXCEPTIONS
                     INCONSISTENT_INTERFACE       = 1
                     PROGRAM_ERROR                = 2
                     OTHERS                       = 3
      IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    ENDFORM.                    " fill_fieldcatalog
    *&      Form  fill_fieldcatalog2
    form fill_fieldcatalog2 .
    CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
    EXPORTING
                       i_program_name               = i_repid
                       i_internal_tabname           = 'I_SPFLI'
                      i_structure_name             = EKPO
                     I_CLIENT_NEVER_DISPLAY       = 'X'
                      i_inclname                   = i_repid
                     I_BYPASSING_BUFFER           = 'X'
                     I_BUFFER_ACTIVE              = ''
        CHANGING
                       ct_fieldcat                  = i_field
                   EXCEPTIONS
                     INCONSISTENT_INTERFACE       = 1
                     PROGRAM_ERROR                = 2
                     OTHERS                       = 3
      IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    endform.                    " fill_fieldcatalog2
    *&      Form  HIERARCHY_ALV
    form HIERARCHY_ALV .
                   CALL FUNCTION 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'
                     EXPORTING
                     I_INTERFACE_CHECK              = ' '
                      I_CALLBACK_PROGRAM             = I_REPID
                     I_CALLBACK_PF_STATUS_SET       = ' '
                     I_CALLBACK_USER_COMMAND        = ' '
                     IS_LAYOUT                      =
                      IT_FIELDCAT                    = I_FIELD
                     IT_EXCLUDING                   =
                     IT_SPECIAL_GROUPS              =
                     IT_SORT                        =
                     IT_FILTER                      =
                     IS_SEL_HIDE                    =
                     I_SCREEN_START_COLUMN          = 0
                     I_SCREEN_START_LINE            = 0
                     I_SCREEN_END_COLUMN            = 0
                     I_SCREEN_END_LINE              = 0
                     I_DEFAULT                      = 'X'
                      I_SAVE                         = 'A '
                     IS_VARIANT                     =
                     IT_EVENTS                      = I_EVENTS
                     IT_EVENT_EXIT                  =
                       i_tabname_header               = G_TABNAME_HEADER
                       i_tabname_item                 = G_TABNAME_ITEM
                     I_STRUCTURE_NAME_HEADER        =
                     I_STRUCTURE_NAME_ITEM          =
                       is_keyinfo                     = G_KEYINFO
                     IS_PRINT                       =
                     IS_REPREP_ID                   =
                     I_BYPASSING_BUFFER             =
                     I_BUFFER_ACTIVE                =
                   IMPORTING
                     E_EXIT_CAUSED_BY_CALLER        =
                     ES_EXIT_CAUSED_BY_USER         =
                     tables
                       t_outtab_header                = I_SFLIGHT
                       t_outtab_item                  = I_SPFLI
                   EXCEPTIONS
                     PROGRAM_ERROR                  = 1
                     OTHERS                         = 2
                   IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
                   ENDIF.
    endform.                    " HIERARCHY_ALV

    The program works fine if there is no data in the I_SPFLI. But if the table I_SPFLI is populated it shows an error like 'Unable to interpret "AA " as a number' where AA is the CARRID.
    If the header01 is changed to CONNID the program works well. Here is the program.
    TYPE-POOLS: slis.
    *--tables declaration
    TABLES: SFLIGHT,SPFLI.
    *--types declaration
    DATA: BEGIN OF i_SFLIGHT OCCURS 0,
    CARRID LIKE SFLIGHT-CARRID,
    CONNID LIKE SFLIGHT-CONNID,
    FLDATE LIKE SFLIGHT-FLDATE,
    END OF i_SFLIGHT.
    DATA: BEGIN OF i_SPFLI OCCURS 0,
    CARRID LIKE SPFLI-CARRID,
    CONNID LIKE SPFLI-CONNID,
    * AIRPFROM LIKE SPFLI-AIRPFROM,
    * AIRPTO LIKE SPFLI-AIRPTO,
    DISTANCE LIKE SPFLI-DISTANCE,
    END OF i_SPFLI.
    *--variables
    DATA: i_repid LIKE sy-repid.
    i_repid = sy-repid.
    DATA: i_field TYPE slis_t_fieldcat_alv.
    DATA: i_field2 TYPE slis_t_fieldcat_alv.
    DATA: G_TABNAME_HEADER TYPE SLIS_TABNAME.
    DATA: G_TABNAME_ITEM TYPE SLIS_TABNAME.
    DATA: G_KEYINFO TYPE SLIS_KEYINFO_ALV.
    *--select options
    SELECT-OPTIONS : S_CARRID FOR SFLIGHT-CARRID .
    *--initialosation
    INITIALIZATION.
    *--selection screen on
    AT SELECTION-SCREEN .
    *--start of selection
    START-OF-SELECTION.
    SELECT CARRID
    CONNID
    FLDATE
    FROM SFLIGHT INTO TABLE i_SFLIGHT
    WHERE CARRID IN S_CARRID.
    IF i_SFLIGHT[] IS NOT INITIAL.
    SELECT CARRID
    CONNID
    DISTANCE
    INTO TABLE i_SPFLI FROM SPFLI
    FOR ALL ENTRIES IN I_SFLIGHT
    WHERE CARRID = i_SFLIGHT-CARRID.
    IF sy-subrc NE 0.
      MESSAGE e001(z538msg).
    ENDIF.
    ENDIF.
    PERFORM fill_fieldcatalog1.
    PERFORM fill_fieldcatalog2.
    PERFORM HIERARCHY_ALV.
    * PERFORM alv_events.
    G_KEYINFO-header01 = 'CARRID'.
    G_KEYINFO-item01 = 'CONNID'.
    G_TABNAME_HEADER = 'I_SFLIGHT'.
    G_TABNAME_ITEM = 'I_SPFLI'.
    *& Form fill_fieldcatalog
    FORM fill_fieldcatalog1 .
    CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
    EXPORTING
    i_program_name = i_repid
    i_internal_tabname = 'I_SFLIGHT'
    * i_structure_name = EKPO
    * I_CLIENT_NEVER_DISPLAY = 'X'
    i_inclname = i_repid
    * I_BYPASSING_BUFFER = 'X'
    * I_BUFFER_ACTIVE = ''
    CHANGING
    ct_fieldcat = i_field
    * EXCEPTIONS
    * INCONSISTENT_INTERFACE = 1
    * PROGRAM_ERROR = 2
    * OTHERS = 3
    IF sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    * WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    ENDFORM. " fill_fieldcatalog
    *& Form fill_fieldcatalog2
    form fill_fieldcatalog2 .
    CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
    EXPORTING
    i_program_name = i_repid
    i_internal_tabname = 'I_SPFLI'
    * i_structure_name = EKPO
    * I_CLIENT_NEVER_DISPLAY = 'X'
    i_inclname = i_repid
    * I_BYPASSING_BUFFER = 'X'
    * I_BUFFER_ACTIVE = ''
    CHANGING
    ct_fieldcat = i_field
    * EXCEPTIONS
    * INCONSISTENT_INTERFACE = 1
    * PROGRAM_ERROR = 2
    * OTHERS = 3
    IF sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    * WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    endform. " fill_fieldcatalog2
    *& Form HIERARCHY_ALV
    form HIERARCHY_ALV .
    <b>*G_KEYINFO-header01 = 'CARRID'.</b>
    <b>G_KEYINFO-header01 = 'CONNID'.</b>
    G_KEYINFO-item01 = 'CONNID'.
    G_TABNAME_HEADER = 'I_SFLIGHT'.
    G_TABNAME_ITEM = 'I_SPFLI'.
    CALL FUNCTION 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'
    EXPORTING
    * I_INTERFACE_CHECK = ' '
    I_CALLBACK_PROGRAM = I_REPID
    * I_CALLBACK_PF_STATUS_SET = ' '
    * I_CALLBACK_USER_COMMAND = ' '
    * IS_LAYOUT =
    IT_FIELDCAT = I_FIELD
    * IT_EXCLUDING =
    * IT_SPECIAL_GROUPS =
    * IT_SORT =
    * IT_FILTER =
    * IS_SEL_HIDE =
    * I_SCREEN_START_COLUMN = 0
    * I_SCREEN_START_LINE = 0
    * I_SCREEN_END_COLUMN = 0
    * I_SCREEN_END_LINE = 0
    * I_DEFAULT = 'X'
    I_SAVE = 'A'
    * IS_VARIANT =
    * IT_EVENTS = I_EVENTS
    * IT_EVENT_EXIT =
    i_tabname_header = G_TABNAME_HEADER
    i_tabname_item = G_TABNAME_ITEM
    * I_STRUCTURE_NAME_HEADER =
    * I_STRUCTURE_NAME_ITEM =
    is_keyinfo = G_KEYINFO
    * IS_PRINT =
    * IS_REPREP_ID =
    * I_BYPASSING_BUFFER =
    * I_BUFFER_ACTIVE =
    * IMPORTING
    * E_EXIT_CAUSED_BY_CALLER =
    * ES_EXIT_CAUSED_BY_USER =
    tables
    t_outtab_header = I_SFLIGHT
    t_outtab_item = I_SPFLI
    * EXCEPTIONS
    * PROGRAM_ERROR = 1
    * OTHERS = 2
    IF sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    * WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    endform. " HIERARCHY_ALV

  • Connect by prior usage restricted to certain level in an hierarchy.

    Hi,
    I had a requirement where the values are stored in a hierarchial basis in a database table. The hierarchy is upto five levels. When I use connect by prior, its using all the five levels to evaluate. But I want to restrict the evaluation upto only three levels. So can anyone help me out in resolving the issue. I would like to know how we restrict, the usage to only say, two or three levels.
    Any help is highly appreciated.
    Thanks and Regards,
    Venky.

    Just add AND LEVEL < 4 to CONNECT BY clause. For example:
    SQL> select lpad(' ',(level-1)*2) || level || ' ' || ename as ename
      2    from emp
      3    start with mgr is null
      4    connect by prior empno = mgr
      5        and level < 4;
    ENAME
    1 KING
      2 JONES
        3 SCOTT
        3 FORD
      2 BLAKE
        3 ALLEN
        3 WARD
        3 MARTIN
        3 TURNER
        3 JAMES
      2 CLARK
    ENAME
        3 MILLER
    12 rows selected.
    SQL> SY.

  • Display the totals only at Material level in ALV

    Hi........,
    I am calculating the subtotals and totals. I am having the columns Company Code , Plant and Material etc.
    First I did sort on table as :
    gr_sorts = gr_table->get_sorts( ).
      gr_sorts->add_sort( columnname = 'C_CODE' subtotal = abap_true ).
      gr_sorts->add_sort( columnname = 'WERKS-WERKS' subtotal = abap_true ).
      gr_sorts->add_sort( columnname = 'MATNR' subtotal = abap_true ).
    After that I am doing the aggregation like this :
    gr_agg = gr_table->get_aggregations( ).
      gr_agg->add_aggregation( 'QUANTITY' ).
      gr_agg->add_aggregation( 'QUANTITY1' ).
      gr_agg->add_aggregation( 'DELTA' ).
    It is displaying the totals and subtotals at each Company code , Plant and Material level.
    But I want to display the totals only at Material level.
    Guide me on the same.
    Reply me as early as possible.
    Thanx,
    Jay
    Edited by: Alvaro Tejada Galindo on Feb 14, 2008 11:08 AM

    Replace your code for sorting
    gr_sorts = gr_table->get_sorts( ).
    gr_sorts->add_sort( columnname = 'C_CODE' subtotal = abap_true ).
    gr_sorts->add_sort( columnname = 'WERKS-WERKS' subtotal = abap_true ).
    gr_sorts->add_sort( columnname = 'MATNR' subtotal = abap_true ).
    with the code given below.
    gr_sorts = gr_table->get_sorts( ).
    gr_sorts->add_sort( columnname = 'C_CODE' subtotal = abap_false ).
    gr_sorts->add_sort( columnname = 'WERKS-WERKS' subtotal = abap_false ).
    gr_sorts->add_sort( columnname = 'MATNR' subtotal = abap_true ).
    Hope this helps. Reward points if helpful.
    Thanks,
    Balaji

  • How to load 3.x hierarchy data source from a certain level ?

    Hi all,
    I have an old 3.x hierarchy data souce which has a structure like below :
       Level 0 :  root node
                  Level 1:  Product Category
                      Level 2: Product Line
                          Level 3: Product
                              Level 4 : Product Version
    each level has independent infoobject for it.
    The hierarchy was initially constructed for the infoobject on the level 4 'Product Version'.
    Now here comes anther requriement, we also want to have a hierarchy for 'Product' and try to reuse the datasource.
    So the question is , is it possible to extract from the same data source, while just update the hierarchy for 'Product ' starting from the level 3 (up to level 0)?
    PS: i can't migrate the data souce to 7.X, because the source system doesn't support.
    I hope I made my question clearly.
    Really apprericated that you can give me a hint.
    Thanks,
    Amon

    Finally I solved this problem myself.
    there are many mays if you want to realize the requirement, only if you change your way of thinking, don't be stuck your mind with the thought we have to use the original data source coming from the source system.
      I'd like to introduce 2 ways I am thinking of:
    1. use the SAP standard program 'Z_SAP_HIERARCHY_DOWNLOAD' to save the hierarchy as a .csv file, then you can refer to http://scn.sap.com/community/data-warehousing/bw/blog/2012/01/08/bw-730-hierarchy-loading-becomes-easier-with-the-help-of-new-framework
    however this didn't work for me, because the program might be outdated in my working environment BW7.4, though I did some bugfix for this program , the output file seems with some errors.
    2. since the hierarchy for the 4th level infoobject has been successfully updated in my case, we can use it as the data provider directly . Here is the general dataflow : 4th level infoobject hierarchy -> DSO -> target infoobject hierarchy (3rd level infoobject) .
    for this DSO strucure, you should also refer to the link above, the structure is just like the EXCEL file provided. but you should be aware of adding external characteristics in the data fields of your DSO if there is external characteristics in your hierarchy.
    in the transformation of 'source infoobject hierarchy' , you should select 'hierarchy (one segment)' as the subtype of hierarchy.
    in the transoformation of 'DSO -> target infoobject' , you should map the source and target carefully , especially for the segment 'Structure' , you should make sure the field 0H_HIERNODE and the external chars. have proper value filled.

  • Top_of_page is not working in ALV hierarchy?

    Hi,
          I have written following code for top_of_page using event but which is not working...This report is developed for interactive report.
    Note: passed the it_events into ALV hierarchy functional module.
    FORM build_event_tab .
       CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
         EXPORTING
           i_list_type = 1
         IMPORTING
           et_events   = it_events[].
       READ TABLE it_events INTO wa_events WITH KEY form = 'TOP_OF_PAGE'.
       IF sy-subrc = 0.
         wa_events-form = 'TOP_OF_PAGE'.
         APPEND wa_events TO it_events.
       ENDIF.
    ENDFORM. "Get_events
    FORM top_of_page USING document TYPE REF TO cl_dd_document.
       DATA: dl_text(255) TYPE c,
             lv_cutime TYPE sy-uzeit,
             lv_cudt(20) TYPE c.
       lv_cudt = sy-datum.
    *--Passing Date----*
       WRITE  lv_cudt TO dl_text.
       CONCATENATE 'Date : ' lv_cudt+6(2) '-'
                             lv_cudt+4(2) '-'
                             lv_cudt+0(4) INTO dl_text.
       CALL METHOD document->add_text
         EXPORTING
           text = dl_text.
       CLEAR : dl_text.
       CALL METHOD document->add_gap
         EXPORTING
           width = 50.
       WRITE 'Company Name' TO dl_text.
       CALL METHOD document->add_text
         EXPORTING
           text         = dl_text
           sap_emphasis = cl_dd_area=>heading
           sap_style    = cl_dd_area=>heading
           sap_color    = cl_dd_area=>list_total_inv.
       CLEAR : dl_text.
       CALL METHOD document->add_gap
         EXPORTING
           width = 150.
       lv_cutime = sy-uzeit.
       CONCATENATE 'Time : ' lv_cutime+0(2) ':'
                             lv_cutime+2(2) ':'
                             lv_cutime+4(2) INTO dl_text.
       CALL METHOD document->add_text
         EXPORTING
           text = dl_text.
       CALL METHOD document->add_gap
         EXPORTING
           width = 60.
       WRITE 'Title' TO dl_text.
       CALL METHOD document->add_text
         EXPORTING
           text         = dl_text
           sap_emphasis = cl_dd_area=>heading
           sap_style    = cl_dd_area=>heading
           sap_color    = cl_dd_area=>list_total_inv.
       CLEAR : dl_text.
       CALL METHOD document->add_gap
         EXPORTING
           width = 50.
    ENDFORM.                    "html_top_of_page
    Thanks
    Shree

    PERFORM build_fieldcat.
      PERFORM build_event_tab.
      PERFORM alv_display.
    *---Build fieldcat
    FORM build_fieldcat.
      wa_fieldcat-tabname = 'IT_VENDOR'.
      wa_fieldcat-fieldname = 'LIFNR'.
      wa_fieldcat-col_pos   = '2'.
      wa_fieldcat-seltext_l = 'SUPPLIER'.
      wa_fieldcat-outputlen = 20.
      APPEND wa_fieldcat TO it_fieldcat.
      CLEAR wa_fieldcat.
      wa_fieldcat-tabname = 'IT_VENDOR'.
      wa_fieldcat-fieldname = 'NAME1'.
      wa_fieldcat-col_pos   = '2'.
      wa_fieldcat-seltext_l = 'VENDOR NAME'.
      wa_fieldcat-outputlen = 40.
      APPEND wa_fieldcat TO it_fieldcat.
      CLEAR wa_fieldcat.
      wa_fieldcat-tabname = 'IT_FINAL'.
      wa_fieldcat-fieldname = 'WERKS'.
      wa_fieldcat-col_pos   = '1'.
      wa_fieldcat-seltext_l = 'Plant'.
      wa_fieldcat-outputlen = 5.
      APPEND wa_fieldcat TO it_fieldcat.
      CLEAR wa_fieldcat.
      wa_fieldcat-tabname = 'IT_FINAL'.
      wa_fieldcat-fieldname = 'AWKEY'.
      wa_fieldcat-col_pos   = '2'.
      wa_fieldcat-seltext_l = ' Document'.
      wa_fieldcat-hotspot = 'X'.
      wa_fieldcat-outputlen = 16.
      APPEND wa_fieldcat TO it_fieldcat.
      CLEAR wa_fieldcat.
      wa_fieldcat-tabname = 'IT_FINAL'.
      wa_fieldcat-fieldname = 'BELNR'.
      wa_fieldcat-col_pos   = '3'.
      wa_fieldcat-seltext_l = 'A/c Document'.
      wa_fieldcat-hotspot = 'X'.
      wa_fieldcat-outputlen = 16.
      APPEND wa_fieldcat TO it_fieldcat.
      CLEAR wa_fieldcat.
      wa_fieldcat-tabname = 'IT_FINAL'.
      wa_fieldcat-fieldname = 'BUDAT'.
      wa_fieldcat-col_pos   = '4'.
      wa_fieldcat-seltext_l = 'PJ Date'.
      wa_fieldcat-outputlen = 16.
      APPEND wa_fieldcat TO it_fieldcat.
      CLEAR wa_fieldcat.
      wa_fieldcat-tabname = 'IT_FINAL'.
      wa_fieldcat-fieldname = 'XBLNR'.
      wa_fieldcat-col_pos   = '5'.
      wa_fieldcat-seltext_l = 'Inv'.
      wa_fieldcat-outputlen = 16.
      APPEND wa_fieldcat TO it_fieldcat.
      CLEAR wa_fieldcat.
      wa_fieldcat-tabname = 'IT_FINAL'.
      wa_fieldcat-fieldname = 'BLDAT'.
      wa_fieldcat-col_pos   = '6'.
      wa_fieldcat-seltext_l = 'PJ Date'.
      wa_fieldcat-outputlen = 16.
      APPEND wa_fieldcat TO it_fieldcat.
      CLEAR wa_fieldcat.
      wa_fieldcat-tabname = 'IT_FINAL'.
      wa_fieldcat-fieldname = 'DMBTR'.
      wa_fieldcat-col_pos   = '7'.
      wa_fieldcat-seltext_l = 'Bill.Amount'.
      wa_fieldcat-outputlen = 19.
      wa_fieldcat-do_sum   = 'X'.
      APPEND wa_fieldcat TO it_fieldcat.
      CLEAR wa_fieldcat.
      wa_fieldcat-tabname = 'IT_FINAL'.
      wa_fieldcat-fieldname = 'HKONT'.
      wa_fieldcat-col_pos   = '8'.
      wa_fieldcat-seltext_l = 'Cost Ctr'.
      wa_fieldcat-outputlen = 16.
      APPEND wa_fieldcat TO it_fieldcat.
      CLEAR wa_fieldcat.
    ENDFORM.                    "Build_fieldcat
    *----ALV Display-----*
    FORM alv_display.
      key-header01 = 'LIFNR'.
      key-item01   = 'LIFNR'.
      DELETE ADJACENT DUPLICATES FROM it_vendor.
      DELETE ADJACENT DUPLICATES FROM it_final.
      CALL FUNCTION 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'
        EXPORTING
          i_callback_program       = sy-repid
          i_callback_user_command  = 'USER_COMMAND'
          i_callback_pf_status_set = 'PFSTATUS'
          it_fieldcat              = it_fieldcat[]
          i_tabname_header         = 'IT_VENDOR'
          i_tabname_item           = 'IT_FINAL'
          it_events                = it_events[]
          is_keyinfo               = key
        TABLES
          t_outtab_header          = it_vendor[]
          t_outtab_item            = it_final[].
    ENDFORM.                    "alv_display
    *----interactive method--
    FORM user_command USING r_ucomm TYPE sy-ucomm
                            rs_selfield TYPE slis_selfield.
      CASE r_ucomm.
        WHEN '&IC1'.
          READ TABLE it_final INTO wa_final INDEX rs_selfield-tabindex.
          IF sy-subrc = 0.
            IF rs_selfield-fieldname = 'BELNR'.
              SET PARAMETER ID 'BLN' FIELD wa_final-belnr.
              SET PARAMETER ID 'BUK' FIELD pa_bukrs.
              SET PARAMETER ID 'GJA' FIELD pa_gjahr.
              CALL TRANSACTION 'FB03' AND SKIP FIRST SCREEN.
            ELSEIF rs_selfield-fieldname = 'AWKEY'.
              SET PARAMETER ID 'RBN' FIELD wa_final-awkey.
              SET PARAMETER ID 'GJR' FIELD pa_gjahr.
              CALL TRANSACTION 'MIR4' AND SKIP FIRST SCREEN.
            ELSEIF rs_selfield-fieldname = 'LFBNR'.
              SET PARAMETER ID 'BLN' FIELD it_bsak-lfbnr.
              SET PARAMETER ID 'BUK' FIELD pa_bukrs.
              SET PARAMETER ID 'GJA' FIELD pa_gjahr.
              CALL TRANSACTION 'FB03' AND SKIP FIRST SCREEN.
            ELSEIF rs_selfield-fieldname = 'EBELN'.
              SELECT SINGLE
                     ebeln
                     INTO wk_ebeln
                     FROM ekko
                     WHERE ebeln = it_bsak-ebeln
                     AND bstyp = 'F'.
              IF sy-subrc EQ 0.
                SET PARAMETER ID 'BES' FIELD it_bsak-ebeln.
                CALL TRANSACTION 'ME23N' AND SKIP FIRST SCREEN.
              ELSE.
                SET PARAMETER ID 'VRT' FIELD it_bsak-ebeln.
                CALL TRANSACTION 'ME33' AND SKIP FIRST SCREEN.
              ENDIF.
            ENDIF.
          ENDIF.
      ENDCASE.
    ENDFORM.                    "user_command
    FORM pfstatus USING ut_extab TYPE slis_t_extab.
      SET PF-STATUS 'STANDARD_FULLSCREEN' OF PROGRAM 'SAPLKKBL'.
    ENDFORM.                    "pfstatus
    *---Authorization check---
    FORM bukrs_check.
      SELECT SINGLE
             butxt "Name of the Company Code / Company
             ort01 "City
             INTO (wk_company, wk_city) FROM t001
             WHERE  bukrs = pa_bukrs.
      IF sy-subrc <> 0.
        MESSAGE 'create your own message' TYPE 'I'.
      ENDIF.
    ENDFORM.                    " BUKRS_CHECK
    FORM build_event_tab.
      CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
        EXPORTING
          i_list_type = 0
        IMPORTING
          et_events   = it_events[].
      READ TABLE it_events INTO wa_events
         WITH KEY name = 'SLIS_EV_TOP_OF_PAGE'.
      IF sy-subrc = 0.
        wa_events-form = 'TOP_OF_PAGE'.
        MODIFY it_events FROM wa_events INDEX sy-tabix.
      ENDIF.
      READ TABLE it_events INTO wa_events WITH KEY name =
                    'SLIS_EV_END_OF_PAGE'.
      IF sy-subrc = 0.
        wa_events-form = 'END_OF_PAGE'.
        MODIFY it_events FROM wa_events INDEX sy-tabix.
      ENDIF.
    ENDFORM. "Get_events
    FORM end_of_page.
      DATA: it_header TYPE slis_t_listheader,
            wa_header TYPE slis_listheader.
      wa_header-typ = 'S'.
      wa_header-key = 'MATERIAL'.
    *  wa_line-info = p1.
      APPEND wa_header TO it_header.
      CLEAR wa_header.
    *  READ TABLE it_maktx WITH KEY matnr = p1.
      wa_header-typ = 'S'.
      wa_header-key = 'DESCRIPTION'.
    *  wa_line-info = it_maktx-maktx.
      APPEND  wa_header TO it_header.
      CLEAR wa_header.
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
         EXPORTING
    *      i_logo             = 'ENJOYSAP_LOGO'
           it_list_commentary = it_header.
    ENDFORM.                    "END_OF_PAGE
    FORM top_of_page USING document TYPE REF TO cl_dd_document.
      DATA: dl_text(255) TYPE c,
            lv_cutime TYPE sy-uzeit,
            lv_cudt(20) TYPE c.
      lv_cudt = sy-datum.
    *--Passing Date----*
      WRITE  lv_cudt TO dl_text.
      CONCATENATE 'Date : ' lv_cudt+6(2) '-'
                            lv_cudt+4(2) '-'
                            lv_cudt+0(4) INTO dl_text.
      CALL METHOD document->add_text
        EXPORTING
          text = dl_text.
      CLEAR : dl_text.
      CALL METHOD document->add_gap
        EXPORTING
          width = 50.
      WRITE 'INCAP CON MFG SER (P) LTD' TO dl_text.
      CALL METHOD document->add_text
        EXPORTING
          text         = dl_text
          sap_emphasis = cl_dd_area=>heading
          sap_style    = cl_dd_area=>heading
          sap_color    = cl_dd_area=>list_total_inv.
      CLEAR : dl_text.
      CALL METHOD document->add_gap
        EXPORTING
          width = 150.
      lv_cutime = sy-uzeit.
      CONCATENATE 'Time : ' lv_cutime+0(2) ':'
                            lv_cutime+2(2) ':'
                            lv_cutime+4(2) INTO dl_text.
      CALL METHOD document->add_text
        EXPORTING
          text = dl_text.
      CALL METHOD document->add_gap
        EXPORTING
          width = 60.
      WRITE 'Purchase Journal' TO dl_text.
      CALL METHOD document->add_text
        EXPORTING
          text         = dl_text
          sap_emphasis = cl_dd_area=>heading
          sap_style    = cl_dd_area=>heading
          sap_color    = cl_dd_area=>list_total_inv.
      CLEAR : dl_text.
      CALL METHOD document->add_gap
        EXPORTING
          width = 50.
    ENDFORM.                    "html_top_of_page

  • No Display of Hierarchy in BI 7.0

    Hi,
      I have sucessfully loaded the Hierarchy for 0WBS_ELEMT IN BI 7.0.
      However, when I run my BEx Report, the 0WBS_ELEMT does NOT display the hierarchy. Indeed it just accumulates the Key Figure values and displays in as '#'
      The 0WBS_ELEMT Master Data is Active. In BEX, the Hierarchy has been assigned under properties. Also, upon inspection of the MultiProvider it does correctly  show the assigned WBS ELEMENT.
      Can some please advice ?
      FYI, we are using BW 3.5 data sources but in BI 7.0 on Patch Level 8
      Thanks

    Few questions
    1) Is it only the WBS hierarchy having problems ,are all other hiearchies working ??
    2)Did you Try removing hiearchy from the properties tab of WBS_ELEMT and check if the data(Transaction) is populating first for WBS_ELEMT...put WBS_ELEMT in the ROW of query with your KEY FIGS.
    3)If not check in the listcube for cube contents if you have any transaction data for WBS_ELEMT.
    4)Did you Remove any filters if any ...
    Hope it Helps
    Chetan
    @CP..

  • Setting the ALV Hierarchy tree with grid line between the columns and rows

    Hi Experts,
    I would like to ask if there is any suggestion on setting the ALV hierarchy tree to be separated by grid line between the columns and rows just like how it is display the same way in normal ALV grid.
    Thanks in advance.

    Hi Lin,
    The requirement which you have stated is not possible.
    Lin,
    Also i have a query regarding BADI ZME_PROCESS_REQ_CUST, which you had raised on SDN. You have marked the question as solved/answered.
    Changing the data of a customize field in purchase requisition
    Could you please let me know, the steps you did to update the screen fields through the BADI.
    I would really appreciate your reply, because i am facing exactly the same problem which you have mentioned.
    Thanks,
    Best regards,
    Prashant

  • Alv hierarchy subtotal in 2 fields

    Hi gurus,
    First, thanks to all those who helped me with my first problem. I have a new question, still regarding subtotal.
    The client now wants to have a subtotal in alv hierarchy per vendor and purchase doc. My output displays a subtotal per purchase doc only. Client wants to have an output that would look like this:
    VENDOR     
    PURCH DOC        PO AMT.
    1
    410000001            1000
    410000001             2000
    410000001            3000   (subtotal  per purch doc)
    410000002            100
    410000002            100     (subtotal per purch doc)
    1                          3100   (subtotal per vendor)
    2
    420000001            500
    420000001            300
    420000001            800       (subtotal per purch doc)
    2                          800       (subtotal per vendor)
    TOTAL                  3900
    Here's an excerpt of my code:
    FORM build_fcat using p_type changing p_fcat.
    data lt_fcat type slis_t_fieldcat_alv.
    field-symbols <fs_fcat> like line of lt_fcat.
    lt_fcat = p_fcat.
    loop at lt_fcat assigning <fs_fcat>.
    <fs_fcat>-ddictxt = 'L'.
    case <fs_fcat>-fieldname.
    when 'LIFNR'.
    <fs_fcat>-seltext_l = 'VENDOR'.
    <fs_fcat>-tabname = 'I_HEADER'.
    <fs_fcat>-key = 'X'.
    <fs_fcat>-outputlen = 15.
    modify lt_fcat from <fs_fcat>.
    when 'EBELN'.
    <fs_fcat>-seltext_l = 'PURCH DOC'.
    <fs_fcat>-tabname = 'I_ITEM'.
    <fs_fcat>-key = 'X'.
    <fs_fcat>-outputlen = 12.
    modify lt_fcat from <fs_fcat>.
    when 'RLWRT'.
    <fs_fcat>-seltext_l = 'PO AMT.'.
    <fs_fcat>-tabname = 'I_ITEM'.
    <fs_fcat>-datatype = 'CURR'.
    <fs_fcat>-ref_fieldname = 'WAERS'.
    <fs_fcat>-ref_tabname = 'I_ITEM'.
    <fs_fcat>-do_sum = 'X'.
    <fs_fcat>-outputlen = 15.
    modify lt_fcat from <fs_fcat>.
    endcase.
    endloop.
    p_fcat = lt_fcat.
    ENDFORM.
    FORM build_fsort changing p_fsort.
    data lt_sort type slis_t_sortinfo_alv.
    data ls_sort like line of lt_sort.
    ls_sort-spos = 1.
    ls_sort-fieldname = 'EBELN'.
    ls_sort-tabname = 'I_HEADER'.
    ls_sort-up = 'X'.
    ls_sort-subtot = 'X'.
    append ls_sort to lt_sort.
    clear ls_sort.
    ls_sort-spos = 2.
    ls_sort-fieldname = 'LIFNR'.
    ls_sort-tabname = 'I_HEADER'.
    ls_sort-up = 'X'.
    ls_sort-subtot = 'X'.
    append ls_sort to lt_sort.
    clear ls_sort.
    p_fsort = lt_fsort.
    ENDFORM.
    FORM modify_key changing p_keyinfo type slis_keyinfo_alv.
    clear p_keyinfo.
    p_keyinfo-header01 = 'LIFNR'.
    p_keyinfo-item01 = 'LIFNR'.
    p_keyinfo-header02 = 'EBELN'.
    p_keyinfo-item02 = 'EBELN'.
    ENDFORM.
    Is there a way to meet the client's expected output?
    Thanks in advance for all the help and advises.
    Points will be rewarded.

    Sorry I didn't include that earlier. I'm using Citrix so copy-paste of codes outside Citrix is not allowed. I'll just type a shorter version of my it here.
    data: begin of i_item occurs 0,
               lifnr like ekko-lifnr,
               name1 like-lfa1-name1,
               ebeln like ekpo_ebeln,
               po_dat like ekko-bedat,
               rlwrt like ekko-rlwrt,
               waers like ekko-waers,
               dmbtr like ekko-dmbtr,
             end of i_item.
    data wa_item like line of i_item,
    data: begin of i_header occurs 0,
               lifnr like lfa1-lifnr,
               name1 like lfa1-name1,
               ebeln like ekpo-ebeln,
            end of i_header.
    data wa_header like line of i_header.

  • Alv Hierarchy currency subtotals = 'X'.

    Hi experts,
    I have a problem with a summarization in a alv grid hierseq.
    I already implemented the do_sum and subtotal in fieldcat and sort structure.
    But if I have 2 currency (ex. USD & EUR) type for the same customer related to the open FI items, the alv is not able to do the subtotal for currency but it write at the and of the sort a X.
    If, thru debug, I change the USD in EUR (or inverse) the sum goes to end correctly.
    I don't know where is the problem.
    Help me fast if u can because i'm in a post go live and for me this is an issue.
    Thanks a lot.

    For hierarchical sequential lists, it is not possible (for technical reasons) to total amounts with different currencies or units of measure. If you total using such a column, an 'X' appears instead of the total.
    Within the ALV grid and the single-level list, the different currencies/measures are displayed separately in the totals formation.

  • Help needed Displaying ALV  Secondary list without using oops concept

    Hi Experts
    Help needed Displaying ALV  Secondary list without using oops concept.
    its urgent
    regds
    rajasekhar

    hi chk this code
    ******************TABLES DECLARATION*****************
    TABLES : VBAP,MARA.
    *****************TYPE POOLS**************************
    TYPE-POOLS : SLIS.
    ****************INTERNAL TABLES**********************
    DATA : BEGIN OF IT_VBAP OCCURS 0,
    VBELN LIKE VBAP-VBELN, "SALES DOCUMENT
    POSNR LIKE VBAP-POSNR, "SALES DOCUMENT ITEM
    MATNR LIKE VBAP-MATNR, "MATERIAL NUMBER
    END OF IT_VBAP.
    ****************TEMPORARY VARIABLES******************
    DATA : V_VBELN LIKE VBAP-VBELN."SALES DOCUMENT
    DATA : V_MTART LIKE MARA-MTART. "MATERIAL TYPE
    *****************FIELD CATALOG***********************
    DATA : IT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
           WA_FIELDCAT TYPE SLIS_FIELDCAT_ALV.
    ****************LAYOUT*******************************
    DATA : WA_LAYOUT TYPE SLIS_LAYOUT_ALV.
    ***************VARIANT*******************************
    DATA : G_VARIANT LIKE DISVARIANT.
    ****************SAVE*********************************
    DATA : G_SAVE(1) TYPE C.
    *****************EVENTS******************************
    DATA : XS_EVENTS TYPE SLIS_ALV_EVENT,
           G_EVENTS TYPE SLIS_T_EVENT.
    ******************PF STATUS**************************
    DATA : PF_STATUS TYPE SLIS_FORMNAME VALUE 'SET_PF_STATUS'.
    ******************USER COMMAND************************
    DATA : USER_COMMAND TYPE SLIS_FORMNAME VALUE 'SET_USER_COMMAND',
           R_UCOMM LIKE SY-UCOMM.
    ****************SELECTION SCREEN************************
    SELECT-OPTIONS : S_VBELN FOR VBAP-VBELN.
    ***************AT SELECTION SCREEN*********************
    AT SELECTION-SCREEN.
      PERFORM VALIDATE.
    **************START-OF-SELECTION**************************
    START-OF-SELECTION.
      PERFORM GET_DETAILS.
      PERFORM FIELDCAT.
      PERFORM LAYOUT.
      PERFORM VARIANT.
      PERFORM SAVE.
      PERFORM EVENTS.
      PERFORM ALV_DISPLAY.
    *********************FORMS*******************************************
    *&      Form  validate
          text
    -->  p1        text
    <--  p2        text
    FORM VALIDATE .
      SELECT SINGLE VBELN
                    FROM VBAP
                    INTO V_VBELN
                    WHERE VBELN IN S_VBELN.
      IF SY-SUBRC <> 0.
        MESSAGE E000 WITH 'enter valid vbeln'.
      ENDIF.
    ENDFORM.                    " validate
    *&      Form  get_details
          text
    -->  p1        text
    <--  p2        text
    FORM GET_DETAILS .
      SELECT VBELN
             POSNR
             MATNR
             FROM VBAP
             INTO TABLE IT_VBAP
             WHERE VBELN IN S_VBELN.
      IF SY-SUBRC <> 0.
        MESSAGE E000 WITH 'no details found'.
      ENDIF.
    ENDFORM.                    " get_details
    *&      Form  fieldcat
          text
    -->  p1        text
    <--  p2        text
    FORM FIELDCAT .
      WA_FIELDCAT-TABNAME = 'IT_VBAP'.
      WA_FIELDCAT-FIELDNAME = 'VBELN'.
      WA_FIELDCAT-OUTPUTLEN = 10.
      WA_FIELDCAT-SELTEXT_L = 'SALES DOC'.
      APPEND WA_FIELDCAT TO IT_FIELDCAT.
      CLEAR WA_FIELDCAT.
      WA_FIELDCAT-TABNAME = 'IT_VBAP'.
      WA_FIELDCAT-FIELDNAME = 'POSNR'.
      WA_FIELDCAT-OUTPUTLEN = 6.
      WA_FIELDCAT-SELTEXT_L = 'ITEM'.
      APPEND WA_FIELDCAT TO IT_FIELDCAT.
      CLEAR WA_FIELDCAT.
      WA_FIELDCAT-TABNAME = 'IT_VBAP'.
      WA_FIELDCAT-FIELDNAME = 'MATNR'.
      WA_FIELDCAT-OUTPUTLEN = 18.
      WA_FIELDCAT-SELTEXT_L = 'MATERIAL NO'.
      APPEND WA_FIELDCAT TO IT_FIELDCAT.
      CLEAR WA_FIELDCAT.
    ENDFORM.                    " fieldcat
    *&      Form  LAYOUT
          text
    -->  p1        text
    <--  p2        text
    FORM LAYOUT .
      WA_LAYOUT-ZEBRA = 'X'.
    ENDFORM.                    " LAYOUT
    *&      Form  VARIANT
          text
    -->  p1        text
    <--  p2        text
    FORM VARIANT .
      CLEAR G_VARIANT.
      G_VARIANT-REPORT = SY-REPID.
    ENDFORM.                    " VARIANT
    *&      Form  SAVE
          text
    -->  p1        text
    <--  p2        text
    FORM SAVE .
      CLEAR G_SAVE.
      G_SAVE = 'A'.
    ENDFORM.                    " SAVE
    *&      Form  EVENTS
          text
    -->  p1        text
    <--  p2        text
    FORM EVENTS .
      CLEAR XS_EVENTS.
      XS_EVENTS-NAME = SLIS_EV_TOP_OF_PAGE.
      XS_EVENTS-FORM = 'TOP_OF_PAGE'.
      APPEND XS_EVENTS TO G_EVENTS.
    ENDFORM.                    " EVENTS
    *&      Form  TOP_OF_PAGE
          text
    FORM TOP_OF_PAGE.
      WRITE :/ ' INTELLI GROUP'.
    ENDFORM.                    "TOP_OF_PAGE
    *&      Form  ALV_DISPLAY
          text
    -->  p1        text
    <--  p2        text
    FORM ALV_DISPLAY .
      CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
       EXPORTING
      I_INTERFACE_CHECK              = ' '
      I_BYPASSING_BUFFER             =
      I_BUFFER_ACTIVE                = ' '
         I_CALLBACK_PROGRAM             = SY-REPID
         I_CALLBACK_PF_STATUS_SET       = PF_STATUS
         I_CALLBACK_USER_COMMAND        = USER_COMMAND
      I_STRUCTURE_NAME               =
         IS_LAYOUT                      = WA_LAYOUT
         IT_FIELDCAT                    = IT_FIELDCAT
      IT_EXCLUDING                   =
      IT_SPECIAL_GROUPS              =
      IT_SORT                        =
      IT_FILTER                      =
      IS_SEL_HIDE                    =
      I_DEFAULT                      = 'X'
         I_SAVE                         = G_SAVE
         IS_VARIANT                     = G_VARIANT
         IT_EVENTS                      = G_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
    IMPORTING
      E_EXIT_CAUSED_BY_CALLER        =
      ES_EXIT_CAUSED_BY_USER         =
        TABLES
          T_OUTTAB                       = IT_VBAP
       EXCEPTIONS
         PROGRAM_ERROR                  = 1
         OTHERS                         = 2
      IF SY-SUBRC <> 0.
        MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    ENDFORM.                    " ALV_DISPLAY
    *&      Form  SET_PF_STATUS
          text
    FORM SET_PF_STATUS USING EXTAB TYPE SLIS_T_EXTAB.
      SET PF-STATUS 'Z50651_PFSTATUS' EXCLUDING EXTAB.
    ENDFORM.                    "SET_PF_STATUS
    *&      Form  SET_USER_COMMAND
          text
    FORM SET_USER_COMMAND USING R_UCOMM
                                RS_SELFIELD TYPE SLIS_SELFIELD.
      CASE R_UCOMM.
        WHEN 'DC'.
          READ TABLE IT_VBAP INDEX RS_SELFIELD-TABINDEX.
          IF SY-SUBRC = 0.
            SELECT SINGLE MTART
                          FROM MARA
                          INTO V_MTART
                          WHERE MATNR = IT_VBAP-MATNR.
            IF SY-SUBRC <> 0.
       MESSAGE E000 WITH 'NO MATERIAL DESCRIPTION FOR SELECTED MATERIAL NO'.
            ELSE.
              WRITE :/ 'MATERIAL NO :',IT_VBAP-MATNR.
              WRITE :/ 'MATERIAL TYPE :' , V_MTART.
            ENDIF.
          ENDIF.
        WHEN 'BACK'.
          LEAVE TO SCREEN 0.
        WHEN 'EXIT'.
          LEAVE TO SCREEN 0.
        WHEN 'CLOSE'.
          CALL TRANSACTION 'SE38'.
      ENDCASE.
    REPORT  Z_ALV_INTERACTIVE  MESSAGE-ID ZMSG_50651
                                    LINE-SIZE 100
                                    LINE-COUNT 60
                                    NO STANDARD PAGE HEADING.
    ******************TABLES DECLARATION*****************
    TABLES : VBAP,MARA.
    *****************TYPE POOLS**************************
    TYPE-POOLS : SLIS.
    ****************INTERNAL TABLES**********************
    DATA : BEGIN OF IT_VBAP OCCURS 0,
    VBELN LIKE VBAP-VBELN, "SALES DOCUMENT
    POSNR LIKE VBAP-POSNR, "SALES DOCUMENT ITEM
    MATNR LIKE VBAP-MATNR, "MATERIAL NUMBER
    END OF IT_VBAP.
    ****************TEMPORARY VARIABLES******************
    DATA : V_VBELN LIKE VBAP-VBELN."SALES DOCUMENT
    DATA : V_MTART LIKE MARA-MTART. "MATERIAL TYPE
    *****************FIELD CATALOG***********************
    DATA : IT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
           WA_FIELDCAT TYPE SLIS_FIELDCAT_ALV.
    ****************LAYOUT*******************************
    DATA : WA_LAYOUT TYPE SLIS_LAYOUT_ALV.
    ***************VARIANT*******************************
    DATA : G_VARIANT LIKE DISVARIANT.
    ****************SAVE*********************************
    DATA : G_SAVE(1) TYPE C.
    *****************EVENTS******************************
    DATA : XS_EVENTS TYPE SLIS_ALV_EVENT,
           G_EVENTS TYPE SLIS_T_EVENT.
    ******************PF STATUS**************************
    DATA : PF_STATUS TYPE SLIS_FORMNAME VALUE 'SET_PF_STATUS'.
    ******************USER COMMAND************************
    DATA : USER_COMMAND TYPE SLIS_FORMNAME VALUE 'SET_USER_COMMAND',
           R_UCOMM LIKE SY-UCOMM.
    ****************SELECTION SCREEN************************
    SELECT-OPTIONS : S_VBELN FOR VBAP-VBELN.
    ***************AT SELECTION SCREEN*********************
    AT SELECTION-SCREEN.
      PERFORM VALIDATE.
    **************START-OF-SELECTION**************************
    START-OF-SELECTION.
      PERFORM GET_DETAILS.
      PERFORM FIELDCAT.
      PERFORM LAYOUT.
      PERFORM VARIANT.
      PERFORM SAVE.
      PERFORM EVENTS.
      PERFORM ALV_DISPLAY.
    *********************FORMS*******************************************
    *&      Form  validate
          text
    -->  p1        text
    <--  p2        text
    FORM VALIDATE .
      SELECT SINGLE VBELN
                    FROM VBAP
                    INTO V_VBELN
                    WHERE VBELN IN S_VBELN.
      IF SY-SUBRC <> 0.
        MESSAGE E000 WITH 'enter valid vbeln'.
      ENDIF.
    ENDFORM.                    " validate
    *&      Form  get_details
          text
    -->  p1        text
    <--  p2        text
    FORM GET_DETAILS .
      SELECT VBELN
             POSNR
             MATNR
             FROM VBAP
             INTO TABLE IT_VBAP
             WHERE VBELN IN S_VBELN.
      IF SY-SUBRC <> 0.
        MESSAGE E000 WITH 'no details found'.
      ENDIF.
    ENDFORM.                    " get_details
    *&      Form  fieldcat
          text
    -->  p1        text
    <--  p2        text
    FORM FIELDCAT .
      WA_FIELDCAT-TABNAME = 'IT_VBAP'.
      WA_FIELDCAT-FIELDNAME = 'VBELN'.
      WA_FIELDCAT-OUTPUTLEN = 10.
      WA_FIELDCAT-SELTEXT_L = 'SALES DOC'.
      APPEND WA_FIELDCAT TO IT_FIELDCAT.
      CLEAR WA_FIELDCAT.
      WA_FIELDCAT-TABNAME = 'IT_VBAP'.
      WA_FIELDCAT-FIELDNAME = 'POSNR'.
      WA_FIELDCAT-OUTPUTLEN = 6.
      WA_FIELDCAT-SELTEXT_L = 'ITEM'.
      APPEND WA_FIELDCAT TO IT_FIELDCAT.
      CLEAR WA_FIELDCAT.
      WA_FIELDCAT-TABNAME = 'IT_VBAP'.
      WA_FIELDCAT-FIELDNAME = 'MATNR'.
      WA_FIELDCAT-OUTPUTLEN = 18.
      WA_FIELDCAT-SELTEXT_L = 'MATERIAL NO'.
      APPEND WA_FIELDCAT TO IT_FIELDCAT.
      CLEAR WA_FIELDCAT.
    ENDFORM.                    " fieldcat
    *&      Form  LAYOUT
          text
    -->  p1        text
    <--  p2        text
    FORM LAYOUT .
      WA_LAYOUT-ZEBRA = 'X'.
    ENDFORM.                    " LAYOUT
    *&      Form  VARIANT
          text
    -->  p1        text
    <--  p2        text
    FORM VARIANT .
      CLEAR G_VARIANT.
      G_VARIANT-REPORT = SY-REPID.
    ENDFORM.                    " VARIANT
    *&      Form  SAVE
          text
    -->  p1        text
    <--  p2        text
    FORM SAVE .
      CLEAR G_SAVE.
      G_SAVE = 'A'.
    ENDFORM.                    " SAVE
    *&      Form  EVENTS
          text
    -->  p1        text
    <--  p2        text
    FORM EVENTS .
      CLEAR XS_EVENTS.
      XS_EVENTS-NAME = SLIS_EV_TOP_OF_PAGE.
      XS_EVENTS-FORM = 'TOP_OF_PAGE'.
      APPEND XS_EVENTS TO G_EVENTS.
    ENDFORM.                    " EVENTS
    *&      Form  TOP_OF_PAGE
          text
    FORM TOP_OF_PAGE.
      WRITE :/ ' INTELLI GROUP'.
    ENDFORM.                    "TOP_OF_PAGE
    *&      Form  ALV_DISPLAY
          text
    -->  p1        text
    <--  p2        text
    FORM ALV_DISPLAY .
      CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
       EXPORTING
      I_INTERFACE_CHECK              = ' '
      I_BYPASSING_BUFFER             =
      I_BUFFER_ACTIVE                = ' '
         I_CALLBACK_PROGRAM             = SY-REPID
       I_CALLBACK_PF_STATUS_SET         = PF_STATUS
         I_CALLBACK_USER_COMMAND        = USER_COMMAND
      I_STRUCTURE_NAME               =
         IS_LAYOUT                      = WA_LAYOUT
         IT_FIELDCAT                    = IT_FIELDCAT
      IT_EXCLUDING                   =
      IT_SPECIAL_GROUPS              =
      IT_SORT                        =
      IT_FILTER                      =
      IS_SEL_HIDE                    =
      I_DEFAULT                      = 'X'
         I_SAVE                         = G_SAVE
        IS_VARIANT                      = G_VARIANT
         IT_EVENTS                      = G_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
    IMPORTING
      E_EXIT_CAUSED_BY_CALLER        =
      ES_EXIT_CAUSED_BY_USER         =
        TABLES
          T_OUTTAB                       = IT_VBAP
       EXCEPTIONS
         PROGRAM_ERROR                  = 1
         OTHERS                         = 2
      IF SY-SUBRC <> 0.
        MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    ENDFORM.                    " ALV_DISPLAY
    *&      Form  SET_PF_STATUS
          text
    FORM SET_PF_STATUS USING EXTAB TYPE SLIS_T_EXTAB.
      SET PF-STATUS 'STANDARD' EXCLUDING EXTAB.
    ENDFORM.                    "SET_PF_STATUS
    *&      Form  SET_USER_COMMAND
          text
    FORM SET_USER_COMMAND USING R_UCOMM
                                RS_SELFIELD TYPE SLIS_SELFIELD.
      CASE R_UCOMM.
        WHEN 'DC'.
          READ TABLE IT_VBAP INDEX RS_SELFIELD-TABINDEX.
          IF SY-SUBRC = 0.
            SELECT SINGLE MTART
                          FROM MARA
                          INTO V_MTART
                          WHERE MATNR = IT_VBAP-MATNR.
            IF SY-SUBRC <> 0.
       MESSAGE E000 WITH 'NO MATERIAL DESCRIPTION FOR SELECTED MATERIAL NO'.
            ELSE.
              WRITE :/ 'MATERIAL NO :',IT_VBAP-MATNR.
              WRITE :/ 'MATERIAL TYPE :' , V_MTART.
      SUBMIT SLIS_DUMMY WITH P_MATNR EQ IT_VBAP-MATNR
                        WITH P_MTART EQ V_MTART.
            ENDIF.
          ENDIF.
        WHEN 'BACK'.
          LEAVE TO SCREEN 0.
        WHEN 'EXIT'.
          LEAVE TO SCREEN 0.
        WHEN 'CLOSE'.
          CALL TRANSACTION 'SE38'.
      ENDCASE.
    plz reward if useful

Maybe you are looking for