ALV Grid/Tree in Dialog Popup

Hi,
I have requirement whereby I display an partially filled ALV Grid.
To populate a specific field of the ALV I need to pop-up a dialog form on which is displayed either another ALV Grid or preferably an ALV Tree.
The data behind the Dilog ALV/Tree is a table of Parent-Child relationships.
The user will either navigate the ALV Grid by clicking on a 'Parent' and refreshing the ALV with the Children etc or do the same by expanding nodes on the ALV Tree.
When the user has reached the lowest level of the 'hierarchy' this value is returned to the initial ALV Grid.
I have had a look around the ABAP and OO Demo's and in the Weblogs etc on SDN.
However I cannot seem to 'manipulate' these into my specific requirements.
Ideally, I need to create either a FM or Class/Method which takes as input the above table of relationships, displays the dilog and then returns the selected child.
My questions are:
  Can this be done?
  Which is the best way for me to approach this?
Thanks,
Martin

Hi,
I have requirement whereby I display an partially filled ALV Grid.
To populate a specific field of the ALV I need to pop-up a dialog form on which is displayed either another ALV Grid or preferably an ALV Tree.
The data behind the Dilog ALV/Tree is a table of Parent-Child relationships.
The user will either navigate the ALV Grid by clicking on a 'Parent' and refreshing the ALV with the Children etc or do the same by expanding nodes on the ALV Tree.
When the user has reached the lowest level of the 'hierarchy' this value is returned to the initial ALV Grid.
I have had a look around the ABAP and OO Demo's and in the Weblogs etc on SDN.
However I cannot seem to 'manipulate' these into my specific requirements.
Ideally, I need to create either a FM or Class/Method which takes as input the above table of relationships, displays the dilog and then returns the selected child.
My questions are:
  Can this be done?
  Which is the best way for me to approach this?
Thanks,
Martin

Similar Messages

  • How can I get the selected rows from two ALV grids at the same time?

    I have a program that uses two ALV grids in one dialog screen. I'm using the OO ALV model (SALV* classes).
    The user can select any number of rows from each grid. Then, when a toolbar pushbutton is pressed, I'd have to retrieve the selected rows from both grids and start some processing with these rows.
    It is no problem to assign event handlers to both grids, and use the CL_SALV_TABLE->GET_SELECTIONS and CL_SALV_SELECTIONS->GET_SELECTED_ROWS methods to find out which rows were marked by the user. Trouble is, this only works when I raise an event in each grid separately, for instance via an own function that I added to the grid's toolbar. So, I can only see the selected rows of the same grid where such an event was raised.
    If I try to do this in the PBO of the dialog screen (that contains the two grids), the result of CL_SALV_SELECTIONS->GET_SELECTED_ROWS will be empty, as the program does not recognize the marked entries in the grids. Also, an event for grid1 does not see the selected rows from grid2 either.
    As it is right now, I can have an own button in both grid's toolbar, select the rows, click on the extra button in each grid (this will tell me what entries were selected per grid). Then, I'd have to click on a third button (the one in the dialog screen's toolbar), and process the selected rows from both grids.
    How can I select the rows, then click on just one button, and process the marked entries from both grids?
    Is it somehow possible to raise an event belonging to each grid programmatically, so that then the corresponding CL_SALV_SELECTIONS->GET_SELECTED_ROWS will work?
    Thanks.

    Hello Tamas ,
    If I try to do this in the PBO of the dialog screen (that contains the two grids), the result of CL_SALV_SELECTIONS->GET_SELECTED_ROWS will be empty, as the program does not recognize the marked entries in the grids. Also, an event for grid1 does not see the selected rows from grid2 either.--->
    is it possible to  have a check box in each grid  & get the selected lines in PAI of the screen ?
    regards
    prabhu

  • Dynamic ALV GRID screen in a class? Possible?

    I have created a class(I have done it locally as to be able to use it for mutiple clients) that I include in programs that I want to implement the alv grid for using the FM approach. Doing this allows me to easily implement the ALV quickly. However, I am wanting to use the OO ALV grid approach since there is more flexibility and control doing it this way. But I do not want to have to create a screen for every program that I want to do this for, I would like to just have a method in my existing class that would call a screen and then be able to control it like normal. I know that screens can not be called from a method so I was thinking of doing something similiar to another post using a FM to call the screen. I realize that this could be complicated because certain methods for the ALV GRID are called in the  PBO/PAI events. Any help or suggestions would be appreciated.
    Note: I am on 6.20 and have searched all over the web before posting.
    Thanks.

    Yes,  i have written a function module which calls a generice ALV grid in a dialog box.  Everything about the ALV grid is encapsulated in a function module.  In this case, all I need to do is send this function module a fieldcatalog and the data,  that's about it.  Doing this may limit the functionality of event handling  or you would just have to handle everything by doing more code for it..   This function module is very simple, not a whole lot to it.   You could do something like this only instead of using a model dialog box, you would throw a regular dynpro.
    function z_popup_with_alvgrid.
    *"*"Global interface:
    *"  IMPORTING
    *"     REFERENCE(ENDPOS_COL) TYPE  I DEFAULT 90
    *"     REFERENCE(ENDPOS_ROW) TYPE  I DEFAULT 22
    *"     REFERENCE(STARTPOS_COL) TYPE  I DEFAULT 10
    *"     REFERENCE(STARTPOS_ROW) TYPE  I DEFAULT 2
    *"     REFERENCE(TEXTLINE1) TYPE  C OPTIONAL
    *"     REFERENCE(TEXTLINE2) TYPE  C OPTIONAL
    *"     REFERENCE(TEXTLINE3) TYPE  C OPTIONAL
    *"     REFERENCE(TEXTLINE4) TYPE  C OPTIONAL
    *"     REFERENCE(TITLE) TYPE  C OPTIONAL
    *"     REFERENCE(FIELDCAT) TYPE  LVC_T_FCAT
    *"  TABLES
    *"      I_ALV
      call screen 0200 starting at startpos_col
                                   startpos_row
                         ending at endpos_col
                                   endpos_row.
    endfunction.
    *      Module  STATUS_0200  OUTPUT
    module status_0200 output.
      set pf-status '0200'.
      set titlebar  '0200' with title.
      data: alv_container  type ref to cl_gui_custom_container.
      data: alv_grid       type ref to cl_gui_alv_grid.
      data: xfieldcat type lvc_t_fcat.
      xfieldcat = fieldcat.
    * Create Controls
      create object:
         alv_container
                 exporting
                       container_name    = 'ALV_CONTAINER',
         alv_grid
                 exporting
                       i_parent          =  alv_container.
    *  Set grid for first display
      call method alv_grid->set_table_for_first_display(
          exporting
               i_structure_name       = 'I_ALV'
          changing
               it_outtab       = i_alv[]
               it_fieldcatalog = xfieldcat[] ).
    endmodule.
    *     Module  USER_COMMAND_0100  INPUT
    module user_command_0200 input.
      case sy-ucomm.
        when 'CONTINUE' or 'CANCEL'.
          set screen 0.
          leave screen.
      endcase.
    endmodule.
    Regards,
    Rich Heilman

  • BalanceSheet ALV to ALV grid

    Hiii experts..
    I have created one report program similar to RFBILA00 standard program...
    now all the information is present in my internal table IT... now what I want to create a ALV tree similar to the output of the this standard program when ALV grid tree control is selected...
    can any1 help me...
    thanks in advance..

    Hi,
    Please refer the program "BCALV_TREE_02".
    Hope this might help you to solve your problem.
    With Regards,
    Sumodh.p

  • Recording on ALV GRID

    Hi All,
    I have a requirement to update a custom field in customer (xd02) screen from a file. Xd01/xd02 are extended with custom screens. One of these screens holds a ALV grid. I have to change one of the record value. when i select a record and click on change button on Alv grid, a modal dialog box apprears, which allows me to change the value of it. Here is my concern, was not able to capture actions made on ALV grid in recording. Any suggestions...
    Thanks,
    Priya.

    Is the custom field in a custom table or has it been appended to a sttandard SAP table?
    Rob

  • How to suppress the protocol dialog screen in ALV grid ?

    To check the values in the ALV grid we make use of the method add_protocol_entry from the class interface CL_ALV_CHANGED_DATA_PROTOCOL. The coloring of the wrong cells in the ALV grid is a nice feature but the popup screen that appears on every entry that is incorrect is not so nice. Is there a possibility to suppress this dialog screen without stopping the coloring feature? Or is there an other way to get this coloring feature in the specific cells of the ALV grid. We have already tried the emphasize option in the field catalog but in this case the coloring of a cell disappears when the cursor is set on the colored field in the ALV grid.
    I hope somebody can help us.
    Thanks and greetings,
    Ad Pegels
    Suiker Unie
    Netherlands

    As I understand by adding the PROTOCOL you are trying to validate some fields and display those with a different color.
    Instead, if you can validate and can change the color manually I think the pop ups can be avoided. All you have to  do is to add a nested internal table to the main internal table that has the display data. This nested table will be of type LVC_T_STYLE. You can add rows, one for each field that you want to display in a different color and also spcify the style in which you want to display.
    Once you do that those fields should be displayed with different colors.
    Regards,
    Ravi
    Note : Please allocate points if you find this useful.

  • How to supress dialog while ALV Grid output is send to Spool

    Hi,
    I need to get the ALV grid output in spool.But when i am executing my program using ALV grid function module with print parameter passed,first its giving a popup with default printer and number of copies and when i press ok for the popup ,spool request is created.But i dont want this popup to come while executing my program.It should create the spool request directly. How to solve this issue.
    Regards
    Shibin

    Hi Shibin,
    Try the below parameter in IS_PRINT Structure:
    is_print-print = 'N'.
    This will Supress the Dialog and create a Spool with no Immeadiate Output.
    Hope This Helps you..
    Thanks & Regards,
    Suresh Karri

  • Popup instead of list when using WD4A ALV Grid Drop Down By Key

    I am develop a WD4A application and I am using an ALV grid.  I have set the cell editor for one column wiht the following code:
    CREATE OBJECT lr_ddbk
        EXPORTING
          SELECTED_KEY_FIELDNAME = 'ZCURRENCY'.
      Data: lv_key_visable TYPE abap_bool,
            lv_key_visible_fieldname TYPE string.
       lr_ddbk->set_type( if_salv_wd_c_uie_drdn_by_index=>type_key_value ).
    *  lv_key_visable = lr_ddbk->GET_KEY_VISIBLE( ).
    *  lv_key_visible_fieldname = lr_ddbk->GET_KEY_VISIBLE_FIELDNAME( ).
    *  lr_ddbk->SET_KEY_VISIBLE( abap_false ).
      lr_alv_column->SET_CELL_EDITOR( lr_ddbk ).
    This code works fine.  I then fill the drop down with the following code:
    *...Build the currency drop down list
      DATA lv_default_currency TYPE wdr_context_attr_value.
      DATA lv_currency_count TYPE STRING.
      DATA ls_tcurt TYPE tcurt.
      CLEAR ls_contextvalue_set.
      CLEAR lt_contextvalue_set. REFRESH lt_contextvalue_set.
      CLEAR lv_default_currency.
      loop at it_ac_attr into ls_ac_attr.
        if ls_ac_attr-attr_id eq 'CUR'.
          select single * from tcurt into ls_tcurt
               Where spras = 'EN' AND
                     waers = ls_ac_attr-value.
          If sy-subrc = 0.
            ls_contextvalue_set-value = ls_ac_attr-value.
         ls_contextvalue_set-value = ls_ac_attr-value.
            ls_contextvalue_set-text = ls_tcurt-ktext.
            IF ls_ac_attr-DFT_FLAG = 'X'.
              lv_default_currency = ls_contextvalue_set.
            ENDIF.
            append ls_contextvalue_set to lt_contextvalue_set.
          endif.
        Endif.
      endloop.
      lo_nd_zebuy_describe_item_info = lo_nd_zebuy_describe_item->get_node_info( ).
      lo_nd_zebuy_describe_item_info->set_attribute_value_set(
                                    exporting
                                       name = 'ZCURRENCY'
                                      value_set = lt_contextvalue_set ).
    *...End build currency drop down list
    This code works fine.  The issue I am having is that the drop down is behaving like a search help field rather than a drop down list.  Meaning a popup comes when I drop down the list.  The popup has the values I have set.  I don't want a popup I want a drop down list.  Additionallly the field is editable (meaning I can type a value into the field as well as select a value).  I want the user to only be able to select values from the list.  Any help with this issue would be appreciated.

    I fugured out what I was doing wrong.  I was setting the cell editor to cl_salv_wd_uie_input_field later in the code by mistake.

  • ALV Grid with Popup Window

    Hey @all,
    I want to make a ALV Grid with a Popup Window. The idea is that there is a field for notes and when you click on this field a popup window should be opened where you can insert more text or if text already exists only the first column of the text is shown in field until you click on the field.
    Is there any possibility to do it this way? Do I have to make a second Grid for this Popup Window? Do anybody have an example how to solve this problem?
    Thank you in advance for your answers!
    Greetings,
    Alexander

    *& Report  Z_VISHVAS_ALV1
    report  z_vishvas_alv1.
    type-pools: slis.
    data: begin of i_outtab occurs 0.
            include structure sflight.
    data:   w_chk type c.                  "For multiple selection
    data: end of i_outtab.
          I_OUTTAB TYPE SFLIGHT OCCURS 0,
    data: i_private type slis_data_caller_exit,
          i_selfield type slis_selfield,
          w_exit(1) type c.
    parameters: p_title type sy-title.
    start-of-selection.
      select * from sflight into table i_outtab.
      call function 'REUSE_ALV_POPUP_TO_SELECT'
           exporting
                i_title                 = p_title
                i_selection             = 'X'
                i_zebra                 = 'X'
              I_SCREEN_START_COLUMN   = 0
              I_SCREEN_START_LINE     = 0
              I_SCREEN_END_COLUMN     = 0
              I_SCREEN_END_LINE       = 0
                i_checkbox_fieldname    = 'W_CHK'
              I_LINEMARK_FIELDNAME    =
              I_SCROLL_TO_SEL_LINE    = 'X'
                i_tabname               = 'I_OUTTAB'
                i_structure_name        = 'SFLIGHT'
              IT_FIELDCAT             =
              IT_EXCLUDING            =
              I_CALLBACK_PROGRAM      =
              I_CALLBACK_USER_COMMAND =
               IS_PRIVATE             = I_PRIVATE
         importing
                es_selfield             = i_selfield
                e_exit                  = w_exit
           tables
                t_outtab                = i_outtab
           exceptions
                program_error           = 1
                others                  = 2.
      if sy-subrc <> 0.
       MESSAGE i000(0k) WITH sy-subrc.
      endif.
    *****the internal table is modified with a cross sign for marking the
    ***rows selected
      loop at i_outtab where w_chk = 'X'.
        write: /  i_outtab-carrid, i_outtab-price.
      endloop.

  • Problem with same layout (variant) for two ALV Grid and ALV Tree

    Hello!
    I have two docking containers on the screen. On the left i have cl_gui_alv_tree, on the right cl_salv_table.
    When a user set a default layout for ALV Grid (or ALV Tree), raport starts and sets this layout in both objects (tree and grid).
    How to avoid this?

    Hi,
    Take Two radio buttons.
    First radion button display the two containers in grid format,
    second radio button display the two containers in tree format base on user selection.
    CREATE OBJECT G_DOCING_CONTAINER
        EXPORTING PARENT = G_CUSTOM_CONTAINER."G_CONTAINER.
    DISPLAY THE DATA IN GRID FORMATA
    CREATE OBJECT r_grid
        EXPORTING
          i_parent          = G_DOCING_CONTAINER
    CALL METHOD g_docing_container->set_width
          EXPORTING
            width      = 1300.
    DISPLAY THE GRID DATA IN SECOND CONTAINER
    CREATE OBJECT r_grid1
        EXPORTING
          i_parent          = G_DOCING_CONTAINER
    CALL METHOD g_docing_container->set_width
          EXPORTING
            width      = 1300.
    OTHERWISE WE CAN DISPLAY THE TWO CONTAINERS DATA IN A GRID FORMAT
    CREATE OBJECT g_tree
        EXPORTING
          parent                = g_docing_container"g_custom_container
    IF R1 = 'X'.  "FOR GRID DISPLAY
    CALL METHOD r_grid1->set_table_for_first_display
    CALL METHOD r_grid2->set_table_for_first_display
    ELSE.
    ************TREE DISPLAY
    ENDIF.
    regards,
    muralii

  • To display a popup message alongwith ALV grid

    Hi Experts,
    I have a requirement where I need to display data using ALV Grid. Also, in case there are any errors encountered during the data extraction I need to inform the user about it by using either a popup message or a status message stating that he needs to check the error log. To display the error log I have provided a push button which will take the user to another screen where he can see all the errors encountered.
    Can anyone please let me know as to how to accomplish the task of displaying a status message alongwith a ALV grid display?
    Looking forward to your reply.
    -Warm regards,
    Prajakta K.

    use exception handling and pop up.........
    try following in grid..
    *--Exception handling
    ENDIF .
    ENDIF .
    WHEN 'EU' .
    READ TABLE gt_list INDEX ls_selected_row-row_id .
    IF sy-subrc = 0 .
    CALL FUNCTION 'ZPOPUP_CONV_CURR_AND_DISPLAY'
    EXPORTING monun = 'EU'
    quant = gt_list-paymentsum.
    ENDIF .
    ENDCASE .
    ENDFORM .

  • Dialog program that lists an ALV Grid

    Hello Experts,
    i want to create a <b>screen divided in two parts</b>. The <b>upper side</b> shows general(Header) information and the <b>lower side</b> shows detail information using ALV grid.
    When i select a record in the header of the Upper side grid , then the lower side grid will display the corresponding details.
    ( Initially the first record should be selected and the details for that first record will be displayed . Later user can choose any other record .........)
    Could anyone pls tell me the detailed procedure for developing this..i need help.
    Thanks & Best Regards
    Sudhansu

    This example is implemented using docking containers on a selection screen to give you a cut and paste example.  Simply copy and past the code into a test program and run it.  double click on any line item from the grid at the top.  the grid at the bottom will change.
    report  zrich_0001.
    data: imara type table of mara.
    data: xmara like line of imara.
    data: imarc type table of marc.
    data: dockingbottom type ref to cl_gui_docking_container,
          dockingtop  type ref to cl_gui_docking_container,
          alv_bottom    type ref to cl_gui_alv_grid,
          alv_top     type ref to cl_gui_alv_grid,
          repid type syrepid.
    *       CLASS lcl_event_handler DEFINITION
    class lcl_event_handler definition.
      public section.
        class-methods handle_double_click
                   for event double_click of cl_gui_alv_grid
                                  importing e_row e_column.
    endclass.
    *       CLASS lcl_event_handler IMPLEMENTATION
    class lcl_event_handler implementation.
      method handle_double_click.
        read table imara into xmara index e_row-index.
        select * into table imarc from marc
                      where matnr = xmara-matnr.
        call method alv_bottom->refresh_table_display( ).
      endmethod.
    endclass.
    parameters: p_check type c.
    start-of-selection.
    at selection-screen output.
      repid = sy-repid.
      select * into corresponding fields of table imara
                  from mara up to 100 rows.
      read table imara into xmara index 1.
      check dockingbottom is initial.
      create object dockingtop
                  exporting repid     = repid
                            dynnr     = sy-dynnr
                            side      = dockingtop->dock_at_top
                            extension = 200.
      create object alv_top
                  exporting i_parent = dockingtop.
      call method alv_top->set_table_for_first_display
         exporting
              i_structure_name       = 'MARA'
         changing
              it_outtab       = imara[].
    *   handler for ALV grid
      set handler lcl_event_handler=>handle_double_click for alv_top.
      create object dockingbottom
                  exporting repid     = repid
                            dynnr     = sy-dynnr
                            side      = dockingbottom->dock_at_bottom
                            extension = 200.
      create object alv_bottom
                    exporting i_parent = dockingbottom.
      select * into table imarc from marc
                   where matnr = xmara-matnr.
      call method alv_bottom->set_table_for_first_display
          exporting
               i_structure_name       = 'MARC'
          changing
               it_outtab       = imarc[].
    The implementation in a dialog program is pretty much the same, you do the logic in the PBO and use custom containers instead of docking containers.
    Regards,
    RIch Heilman

  • 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 Grid to Tree Hirarchy

    Hi all,
    Please guid me how to change the ALV grid output of a report to ALV Tree Hirarchical display.Requirement is to change the output from ALV Grid to Tree Hirarchy.
    Thanks in advance.
    Pavan

    Hi,
    Hope this sample code will help:
    *& Report  Z_50657_ALV_EX4                                             *
    *& Program Name: Test Program for ALV                                  *
    Developer Name: ADCDEV (Rahul Kavuri )                              *
    Description: This program demonstrates Hierarchical List Display
    *&              using VBAP and VBAK as Item and Header Tables          *
    *& Date:12th April 2006
    REPORT  Z_50657_ALV_EX4
            NO STANDARD PAGE HEADING
            LINE-COUNT 65(3)
            LINE-SIZE 220
            MESSAGE-ID ZZ.
                                Type Pools                               *
    TYPE-POOLS: SLIS.
                                 Tables                                  *
    TABLES: VBAK, "Sales Document: Header Data
            VBAP. "Sales Document: Item Data
                            Internal Tables                              *
    Internal table to hold data from VBAK
    DATA: BEGIN OF IT_VBAK OCCURS 0,
          VBELN LIKE VBAK-VBELN,  "Sales Document
          AUDAT LIKE VBAK-AUDAT,  "Document date
          AUART LIKE VBAK-AUART,  "Sales Document Type
          NETWR LIKE VBAK-NETWR,  "Net Value of the Sales Order
          EXPAND TYPE C,
          END OF IT_VBAK.
    Internal table to hold data from VBAP
    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
          PSTYV LIKE VBAP-PSTYV,  "Sales document item category
          CHARG LIKE VBAP-CHARG,  "Batch Number
          END OF IT_VBAP.
                          Data Declarations and Variables                *
    work area to retain fieldcatalog values and internal table for catalog
    DATA: X_FIELDCAT_VBAK TYPE SLIS_FIELDCAT_ALV,
          IT_FIELDCAT_VBAK TYPE SLIS_T_FIELDCAT_ALV.
    DATA: X_FIELDCAT_VBAP TYPE SLIS_FIELDCAT_ALV,
          IT_FIELDCAT_VBAP TYPE SLIS_T_FIELDCAT_ALV.
    DATA: IT_KEYINFO TYPE SLIS_KEYINFO_ALV.
    DATA: IT_HEADER TYPE SLIS_TABNAME,
          IT_ITEM TYPE SLIS_TABNAME.
    DATA: X_SORT TYPE SLIS_SORTINFO_ALV,
          IT_SORT TYPE SLIS_T_SORTINFO_ALV.
    DATA: L_LAYOUT TYPE SLIS_LAYOUT_ALV.
                          Selection-Screen                               *
    SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
    *Sales Document and Sales Document Type as input fields
    SELECT-OPTIONS : S_VBELN FOR VBAK-VBELN,
                     S_AUART FOR VBAK-AUART.
    SELECTION-SCREEN END OF BLOCK B1.
                        INITIALIASATION                             *
    INITIALIZATION.
    Assigning Internal Table Names
      IT_HEADER = 'IT_VBAK'.
      IT_ITEM = 'IT_VBAP'.
      CLEAR IT_KEYINFO.
      IT_KEYINFO-HEADER01 = 'VBELN'.
    comparing the keys and relating the header and item internal tables
      IT_KEYINFO-ITEM01 = 'VBELN'.
      IT_KEYINFO-HEADER02 = SPACE.
      IT_KEYINFO-ITEM02 = 'POSNR'.
                        At  Selection-Screen                             *
    AT SELECTION-SCREEN.
      PERFORM VALIDATION.
                          Start of Selection                             *
    START-OF-SELECTION.
    *POPULATION OF DATA INTO INTERNAL TABLE ITAB
      PERFORM GET_DATA.
    *MERGE FIELDCATALOGUES OF IT_VBAP AND IT_VBAK
      PERFORM FIELDCATALOG_MERGE.
    *CHANGE LAYOUT ACCORDING TO THE REQUIREMENTS
      PERFORM LAYOUT_CHG.
    *USE SORT FUNCTION SO AS TO GET SUBTOTALS AND GRAND TOTAL
      PERFORM SORT_FUNC.
    *FINAL DISPLAY ACCORDING TO THE HIERARCHY
      PERFORM FINAL_DISPLAY.
                          End of Selection                               *
    FORM VALIDATION.
      SELECT SINGLE VBELN
             FROM VBAK
             INTO VBAK-VBELN
             WHERE VBELN IN S_VBELN.
      IF SY-SUBRC <> 0.
        MESSAGE I000 WITH 'NO SALES DOCUMENT RECORD FOUND'.
        STOP.
      ENDIF.
      SELECT SINGLE AUART
             FROM VBAK
             INTO VBAK-AUART
             WHERE AUART IN S_AUART.
      IF SY-SUBRC <> 0.
        MESSAGE I000 WITH 'THE MENTIONED DATE HAS NO RECORDS'.
        STOP.
      ENDIF.
    ENDFORM.                    "VALIDATION
    *&      Form  GET_DATA
          text
    FORM GET_DATA.
      SELECT VBELN
             AUDAT
             AUART
             NETWR FROM VBAK
             INTO TABLE IT_VBAK
             WHERE VBELN IN S_VBELN AND AUART IN S_AUART.
      SORT IT_VBAK BY VBELN.
      SELECT VBELN
             POSNR
             MATNR
             PSTYV
             CHARG FROM VBAP
             INTO TABLE IT_VBAP
             FOR ALL ENTRIES IN IT_VBAK
             WHERE VBELN = IT_VBAK-VBELN.
    ENDFORM.                    "GET_DATA
    *&      Form  FIELDCATALOG_MERGE
          text
    FORM FIELDCATALOG_MERGE.
      X_FIELDCAT_VBAK-FIELDNAME = 'NETWR'.
      X_FIELDCAT_VBAK-TABNAME = 'IT_VBAK'.
      X_FIELDCAT_VBAK-DO_SUM = 'X'.
      APPEND X_FIELDCAT_VBAK TO IT_FIELDCAT_VBAK.
      CLEAR X_FIELDCAT_VBAK.
      X_FIELDCAT_VBAK-FIELDNAME = 'AUART'.
      X_FIELDCAT_VBAK-TABNAME = 'IT_VBAK'.
      APPEND X_FIELDCAT_VBAK TO IT_FIELDCAT_VBAK.
      CLEAR X_FIELDCAT_VBAK.
      CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
        EXPORTING
          I_PROGRAM_NAME     = SY-REPID
          I_INTERNAL_TABNAME = 'IT_VBAK'
          I_INCLNAME         = SY-REPID
        CHANGING
          CT_FIELDCAT        = IT_FIELDCAT_VBAK.
      IF SY-SUBRC <> 0.
        MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
        EXPORTING
          I_PROGRAM_NAME     = SY-REPID
          I_INTERNAL_TABNAME = 'IT_VBAP'
          I_INCLNAME         = SY-REPID
        CHANGING
          CT_FIELDCAT        = IT_FIELDCAT_VBAK.
      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.                    "FIELDCATALOG_MERGE
    *&      Form  LAYOUT_CHG
          text
    FORM LAYOUT_CHG.
      L_LAYOUT-ZEBRA = 'X'.
      L_LAYOUT-SUBTOTALS_TEXT = 'SUBTOTAL'.
      L_LAYOUT-TOTALS_TEXT = 'TOTAL'.
      L_LAYOUT-EXPAND_FIELDNAME = 'EXPAND'.
    L_LAYOUT-EXPAND_ALL = 'X'.
    ENDFORM.                    "LAYOUT_CHG
    *&      Form  SORT_FUNC
          text
    FORM SORT_FUNC.
      X_SORT-SPOS = 1.
      X_SORT-FIELDNAME = 'AUART'.
      X_SORT-TABNAME = 'IT_VBAK'.
      X_SORT-UP = 'X'.
      APPEND X_SORT TO IT_SORT.
      CLEAR X_SORT.
      X_SORT-SPOS = 2.
      X_SORT-FIELDNAME = 'NETWR'.
      X_SORT-TABNAME = 'IT_VBAK'.
      X_SORT-UP = 'X'.
      X_SORT-SUBTOT = 'X'.
      APPEND X_SORT TO IT_SORT.
      CLEAR X_SORT.
    ENDFORM.                    "SORT_FUNC
    *&      Form  FINAL_DISPLAY
          text
    FORM FINAL_DISPLAY.
      CALL FUNCTION 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'
        EXPORTING
          I_CALLBACK_PROGRAM = SY-REPID
          IS_LAYOUT          = L_LAYOUT
          IT_FIELDCAT        = IT_FIELDCAT_VBAK
          IT_SORT            = IT_SORT
          I_TABNAME_HEADER   = IT_HEADER
          I_TABNAME_ITEM     = IT_ITEM
          IS_KEYINFO         = IT_KEYINFO
        TABLES
          T_OUTTAB_HEADER    = IT_VBAK
          T_OUTTAB_ITEM      = 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.                    "FINAL_DISPLAY
    Reward points if found helpful…..
    Cheers,
    Chandra Sekhar.

  • Hi, coding to display popup window after first alv grid display

    hi
    can anybody please send coding to display popup window after first alv grid display i.e.  first the prog shows grid display and from grid display the user select the field and on the basis of field value i need to show pop up window in the first secondary window and then third popup window.
    thanx
    rocky

    Hi rocky,
    here is the sample code .hope this helps you.
    TYPE-POOLS : SLIS.
    DATA : GT_OUTTAB TYPE VBAK OCCURS 0,
           GS_PRIVATE TYPE SLIS_DATA_CALLER_EXIT,
           GS_SELFIELD TYPE SLIS_SELFIELD.
    DATA : IT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
           WA_FIELDCAT TYPE SLIS_FIELDCAT_ALV.
    DATA : ITAB TYPE TABLE OF SLIS_SELFIELD,
           WA_ITAB LIKE LINE OF ITAB.
    START-OF-SELECTION.
    PERFORM POPULATE_GT_OUTTAB.
    PERFORM GET_POPUP.
    PERFORM POPULATE_ITAB.
    PERFORM FIELDCAT.
    PERFORM DISPLAY_DETAILS.
    *&      Form  FIELDCAT
          text
    -->  p1        text
    <--  p2        text
    FORM FIELDCAT .
    LOOP AT ITAB INTO WA_ITAB.
    WA_FIELDCAT-FIELDNAME = 'TABINDEX'.
    WA_FIELDCAT-TABNAME = 'WA_ITAB'.
    WA_FIELDCAT-COL_POS = 1.
    WA_FIELDCAT-SELTEXT_L = 'TABLE INDEX'.
    APPEND WA_FIELDCAT TO IT_FIELDCAT.
    WA_FIELDCAT-FIELDNAME = 'SEL_TAB_FIELD'.
    WA_FIELDCAT-TABNAME = 'WA_ITAB'.
    WA_FIELDCAT-COL_POS = 2.
    WA_FIELDCAT-OUTPUTLEN = 20.
    WA_FIELDCAT-SELTEXT_L = 'FIELD NAME'.
    APPEND WA_FIELDCAT TO IT_FIELDCAT.
    WA_FIELDCAT-FIELDNAME = 'VALUE'.
    WA_FIELDCAT-TABNAME = 'WA_ITAB'.
    WA_FIELDCAT-COL_POS = 3.
    WA_FIELDCAT-SELTEXT_L = 'FIELD VALUE'.
    APPEND WA_FIELDCAT TO IT_FIELDCAT.
    ENDLOOP.
    ENDFORM.                    " FIELDCAT
    *&      Form  POPULATE_GT_OUTTAB
          text
    -->  p1        text
    <--  p2        text
    FORM POPULATE_GT_OUTTAB .
    SELECT * FROM VBAK
           UP TO 10 ROWS
           INTO TABLE GT_OUTTAB.
    ENDFORM.                    " POPULATE_GT_OUTTAB
    *&      Form  GET_POPUP
          text
    -->  p1        text
    <--  p2        text
    FORM GET_POPUP .
    CALL FUNCTION 'REUSE_ALV_POPUP_TO_SELECT'
      EXPORTING
       I_TITLE                       = 'SALES ORDER'
      I_SELECTION                   = 'X'
      I_ALLOW_NO_SELECTION          =
       I_ZEBRA                       = 'X'
      I_SCREEN_START_COLUMN         = 0
      I_SCREEN_START_LINE           = 0
      I_SCREEN_END_COLUMN           = 0
      I_SCREEN_END_LINE             = 0
      I_CHECKBOX_FIELDNAME          =
      I_LINEMARK_FIELDNAME          =
      I_SCROLL_TO_SEL_LINE          = 'X'
        I_TABNAME                     = 'SALES ORDER'
        I_STRUCTURE_NAME              = 'VBAK'
      IT_FIELDCAT                   =
      IT_EXCLUDING                  =
      I_CALLBACK_PROGRAM            =
      I_CALLBACK_USER_COMMAND       =
       IS_PRIVATE                    = GS_PRIVATE
    IMPORTING
       ES_SELFIELD                   = GS_SELFIELD
      E_EXIT                        = G_EXIT
      TABLES
        T_OUTTAB                      = GT_OUTTAB
    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.                    " GET_POPUP
    *&      Form  POPULATE_ITAB
          text
    -->  p1        text
    <--  p2        text
    FORM POPULATE_ITAB .
    WA_ITAB-TABNAME = GS_SELFIELD-TABNAME.
    WA_ITAB-TABINDEX = GS_SELFIELD-TABINDEX.
    WA_ITAB-SEL_TAB_FIELD = GS_SELFIELD-SEL_TAB_FIELD.
    WA_ITAB-VALUE = GS_SELFIELD-VALUE.
    APPEND WA_ITAB TO ITAB.
    ENDFORM.                    " POPULATE_ITAB
    *&      Form  DISPLAY_DETAILS
          text
    -->  p1        text
    <--  p2        text
    FORM DISPLAY_DETAILS .
    CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
    EXPORTING
      I_INTERFACE_CHECK              = ' '
      I_BYPASSING_BUFFER             =
      I_BUFFER_ACTIVE                = ' '
      I_CALLBACK_PROGRAM             = ' '
      I_CALLBACK_PF_STATUS_SET       = ' '
      I_CALLBACK_USER_COMMAND        = ' '
      I_STRUCTURE_NAME               =
      IS_LAYOUT                      =
       IT_FIELDCAT                    = IT_FIELDCAT
      IT_EXCLUDING                   =
      IT_SPECIAL_GROUPS              =
      IT_SORT                        =
      IT_FILTER                      =
      IS_SEL_HIDE                    =
      I_DEFAULT                      = 'X'
      I_SAVE                         = ' '
      IS_VARIANT                     =
      IT_EVENTS                      =
      IT_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                       = ITAB
    EXCEPTIONS
       PROGRAM_ERROR                  = 1
       OTHERS                         = 2
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
             WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    ENDFORM.                    " DISPLAY_DETAILS
    award points if helpful.
    regards,
    deepthi reddy

Maybe you are looking for

  • Albums with the same name

    I have albums by Boney James and Estelle and they both happened to be named Shine. The songs from Estelles album have synched to my Boney album. Would anyone happen to know how to seperate. I have erased and redownloaded in Artist only mode and the a

  • Dynamic Cascading Parameters - cannot select/enter parameter value

    I am rather new working with Crystal Reports and am having problems with Dynamic Cascading Parameters. I am using CR 2008 SP2, Version 12.2.0.290.  Data is from SQL server. I have a report to print labels for parts in an order.  I want to be able to

  • ECC 6.0 & Portal Implementation

    Hi, Is it possible to do all the R/3 transactions through web via SAP Portal Kindly reply.. Thanks. Edited by: Jayanta Deb on Nov 4, 2009 8:44 AM

  • "Startup disk full" - I have at least 15 GB left - after restart back to OK

    Hi all ! I'm starting to get these error messages that my +"startup disk is almost full"+ even though there is at least 15 GB left, for sure... After rebooting things go back to normal but I need to take care of this... Any ideas what to do ??? Thanx

  • Urgent 802.1x and MAC-Authentication Problem

    Hi all I want to deploy the mac- authentication in my network. and I have 3000 users. In the lab the authenticatoion for the machine takes: Vista : 15 - 20 seconds XP : 30 - 35 seconds Is there any way to reduce this time less than 10 seconds. My use