Problem in cell content of alv grid ...

hi all,
     i want to get the cell content of alv grid in the handle method of event data_changed of cl_gui_alv_grid,
i using the following code ...
METHOD on_data_changed.
DATA : lv_value(30) TYPE c.
CALL METHOD ER_DATA_CHANGED->GET_CELL_VALUE
  EXPORTING
    I_ROW_ID    = 3
   I_TABIX     =
    I_FIELDNAME = 'cname'                                                                                "" my column table
  IMPORTING
    E_VALUE     = lv_value.
MESSAGE lv_value TYPE 'I'.
    ENDMETHOD.
endclass.           
but i cant get the value of cell content
Edited by: parashuram on Oct 21, 2011 3:49 PM

Try this way
    method handle_data_changed.
      perform handle_data_changed using er_data_changed.
    endmethod.
form handle_data_changed using p_data_changed type ref to
                               cl_alv_changed_data_protocol.
  data: ls_mod_cell  type lvc_s_modi,
          lv_value_dni type lvc_value.
  loop at p_data_changed->mt_mod_cells into ls_mod_cell.
    call method p_data_changed->get_cell_value
      exporting
        i_row_id    = ls_mod_cell-row_id
        i_fieldname = 'FINI_SUST' <== Your field
      importing
        e_value     = lv_value_dni .
  endloop.
endform.

Similar Messages

  • Centering table cell content in panel grid

    How can I center the content of the cells in a table grid so it would end up something like this:
    <table>
    <tr>
    <td align="center">

    You can do that using stylesheet. You can look at the
    repeater demo example for ideas. The corresponding
    stylesheet class is components/web/stylesheet.css .
    Hope this helps.
    -JayashriI think we need more powerfull layout oriented components.
    XAML, XUL, ADF all of them have powerfull layout components library.
    Maybe it's time start working in this direction.
    I'm sure that JSF must provide in near future more powerfull layout related components library, no doubt here!
    After that it will be possible to remove from styles classes and jsp code everything that was used for layout.
    Layout components will take care about align components, preferred size and etc.
    We need minimize number of style classes.
    That possible if you will make them more universal.
    But no way to make universal style classes with layout related attributes inside them.
    Take a look on simple layout case:
    <s:row align="opposite" styleClass="footerPage">
         <h:outputText value="#{bundle.copyright}"/>
         <h:outputText value="#{bundle.terms}"/>
    </s:row>
    public class RowRenderer extends HtmlBasicRenderer {
    public RowRenderer() {
    super();
    public boolean getRendersChildren() {
    return true;
    public void encodeBegin(FacesContext context, UIComponent component) throws IOException {
    if (!component.isRendered())
    return;
    ResponseWriter writer = context.getResponseWriter();
    writer.startElement("div", component);
    writeIdAttributeIfNecessary(context, writer, component);
    String styleClass = (String) component.getAttributes().get("styleClass");
    if (styleClass != null) {
    writer.writeAttribute("class", styleClass, "styleClass");
    Util.renderPassThruAttributes(writer, component);
    public void encodeChildren(FacesContext context, UIComponent component) throws IOException {
    if (!component.isRendered())
    return;
    Iterator kids = null;
    String style = null;
    int i = 0;
    String align = (String) component.getAttributes().get("align");
    if (align == null) align = "start";
    if (null != (kids = getChildren(component))) {
    while (kids.hasNext()) {
    UIComponent child = (UIComponent) kids.next();
    if (!child.isRendered())continue;
    style = (String) child.getAttributes().get("style");
    style = (style != null) ? style + ";" : "";
    if ( (align == "start") || (align == "left"))
    style += "float: left;";
    else
    if ( (align == "end") || (align == "right"))
    style += "float: right;";
    else
    if (align == "opposite") {
    if ((i % 2) == 0)
    style += "float: left;";
    else
    style += "float: right;";
    child.getAttributes().put("style", style);
    encodeRecursive(context, child);
    i++;
    public void encodeEnd(FacesContext context, UIComponent component) throws IOException {
    if (context == null || component == null) {
    throw new NullPointerException(Util.getExceptionMessageString(
    Util.NULL_PARAMETERS_ERROR_MESSAGE_ID));
    if (!component.isRendered())
    return;
    ResponseWriter writer = context.getResponseWriter();
    writer.endElement("div");
    It's good idea in many layout situations to use tableless layout.
    Row component just simple demonstration how it work.
    There are some problems with implementation and using tableless layout
    but at least in some cases it's good choise.
    I'm ready to provide plenty suggestions in area of creating and using layout components.
    Just don't know if you have interest to discuss that matter.
    Vladimir

  • Create deep structure to disable some cells in Dynamic ALV GRID

    Hi,
    I want to disable some cells in a Dynamic ALV Grid before calling "SET_tABLE_Display" Method.
    I check the BCALV_EDIT_02, where some cells are grayed out by assign the  CL_GUI_ALV_GRID-MC_STYLE_DISABLED  to the field name.
    But I want the same using Field symbol.
    I'm creating Dynamic table and dynamic structure based on the Dynamic field catalog.
    Example: <FT_TAB> TYPE STANDARD TABLE,
                    <FS_TAB> TYPE ANY,            
    DATA: INT_TAB  is my dynamic table values.
    For the INT_TAB internal table, I created dynamic Structure and dynamic field symbol table.
    LOOP AT INT_TAB.
    ASSIGN COMPONENT 'MATNR'  OF STRUCTURE <FS_TAB> TO <F_VALUE>
    <F_VALUE> = INT_TAB-MATNR.
    APPEND <FS_TAB> TO <FT_TAB>
    "Here is the problem occurs, I want to grayed out the MATNR value based on some condition.
    ENDLOOP.
    I would like to set the 'MATNR' value to be grayed out by passing the CL_GUI_ALV_GRID-MC_STYLE_DISABLED.
    and update into <FT_TAB>(       <FT_TAB> structure will have 2 structures)
    Finally the fieldsymbol should have two structure ( <F_TAB> = DYNAMIC STRUCTURE + LVC_S_STYLE )
    Display alv grid by passing <FT_TAB> to set_table_display method.
    Thanks in advance,
    Kumar.

    Hi,
    I am  not sure whether I really understand your request. Let me try to help.
    > Example: <FT_TAB> TYPE STANDARD TABLE,
    >                 <FS_TAB> TYPE ANY,            
    >
    > DATA: INT_TAB  is my dynamic table values.
    >
    >
    > LOOP AT INT_TAB.
    >  ASSIGN COMPONENT 'MATNR'  OF STRUCTURE <FS_TAB> TO <F_VALUE>
    > <F_VALUE> = INT_TAB-MATNR.
    >  APPEND <FS_TAB> TO <FT_TAB>
    Here <FT_TAB> must already be assigned to some internal table with a given (dynamic) structure. Did this happen before this piece of code?
    What I would do is to create a dynamic table (see documentation to CREATE DATA) with MATNR and the STYLE field (LVC_T_STYL). See the documentation for CREATE DATA - creation of internal tables. When collection the field descriptions for that internal table I would also build the field catalogue for the ALV.
    Then assign <FT_TAB> to that newly created internal table, <FS_TAB> to a newly created structure (same as a table line).
    Move the MATNR to component 1 (or component 'MATNR') of the table and fill the style table according to your needs. Then insert the <FS_TAB> into <FT_TAB>.
    Finally call the ALV SET_TABLE... method with your dynamic table and your field catalogue.
    Regards,
    Gerd Rother

  • Problem While Saving the editable ALV GRID

    Dear Experts,
    I have a scenario in which i am display the ALV(using class) with some data in the custom container of module pool screen in the non-editable mode.Also i have save and edit buttons.If i click the edit button i have written the code to edit the some columns in the ALV grid, it is working fine.After editing it,when i click the save button then ALV has to refreshed with edited data and then it should go to non editable mode but it is not working.I have written the code for changing the editable ALv to non editable mode as follows :
      call method c_alvgd->set_ready_for_input
        exporting
          i_ready_for_input = 0.
    *****Row and column of the alv are refreshed after changing values
      stable-row = 'X'.
      stable-col = 'X'.
    *REfreshed ALV display with the changed values
    *This ALV is non editable and contains new values
      call method c_alvgd->refresh_table_display
        exporting
          is_stable = stable
        exceptions
          finished  = 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.
    Could you Suggest me solution for this issue ?
    Thanks & Regards,
    R.Dhineshraj.

    Dhinesh,
    I suppose that you are able to get your changes values on screen but not able to get your field in DISPLAY mode from editable mode, let me know if this is not your problem.
    When you press SAVE, after the PAI, again PBO will run and hence the editable code for that field will overwrite which will keep it editable.
    So, do something like this.
    data: gv_edit value 'X'.....  "global variable in TOP include
    PBO....
    loop at ...
    if gv_edit = 'X'.
    CALL METHOD lo_alv->set_ready_for_input
      EXPORTING
        i_ready_for_input = 1.
    else.
    CALL METHOD lo_alv->set_ready_for_input
      EXPORTING
        i_ready_for_input = 0.
    endif.
    endloop.
    PAI.
    when 'SAVE'.
    gv_edit =  space.
    When 'EDIT'.
    gv_edit = 'X'.
    Regards,
    Diwakar

  • SAP GUI Java 7.10 rev 5: Copy cells content from ALV does not work (OSX)

    Hi all,
    I'm trying rev 5 for OSX. ALV aesthetics is really great but: copy cells content is not possible anymore.
    Nothing happens with command+C.
    I cannot copy anymore just a part of the cell content.
    Trying all possible key combinations, something is copied with Ctrl+C. When I paste it, the pasted content is something like this:
    (0100),RID(),CID(),RIDN(0),E(true),RO(false),CTL(-1)     (0000012338),RID(),CID(),RIDN(0),E(true),RO(false),CTL(-1)     (),RID(),CID(),RIDN(0),E(true),RO(false),CTL(-1)     (),RID(),CID(),RIDN(0),E(true),RO(false),CTL(-1)     (),RID(),CID(),RIDN(0),E(true),RO(false),CTL(-1)     (),RID(),CID(),RIDN(0),E(true),RO(false),CTL(-1)
    where "0000012338" is the content I wanted to copy.
    Any suggestion?
    Thanks,
    Lorenzo

    Hello Lorenzo,
    thanks for the feedback. We are working on it and if all goes well, a solution will be provided with 7.10 rev 6.
    Best regards
    Rolf-Martin

  • Exporting content of ALV grid in Web Dynpro for ABAP

    Hello Experts
    I have a following request which seems to be giving some headaches.
    I need to export results from one of the Web Dynpro reports (ABAP) I have developed to the Excel spreadsheet. Results are stored on ALV component. Request is to add header to export file with additional information like report title, selection criteria, date when report has been executed. By default export file contains only column names and data. I have set the header for ALV grid with all extra information I need to be passed to Excel file but it does not seem to be transferred at all.
    At the moment I see 2 possible solutions: 1) write my own Excel export 2) use PDF export where it is possible to set header/footer text. None of these solutions are ideal, I'd rather set header in standard Excel export. Is that even possible? Please help.
    Regards
    Michael
    Edited by: Soltuion Manager on Apr 20, 2009 10:08 AM
    Edited by: Soltuion Manager on Apr 20, 2009 10:26 AM

    Hello Michael,
    I haven't tried using the builtin functionality of ALV to achieve a similar fnctionality as yours but can suggest you a workaround for that. As how you might be already knowing you can try using the CL_WD_RUNTIME_SERVICES=>attach_file_to_response to download the contents into Excel/notepad/word. So just can modify the internal table to contain the extra information that you need. You can use the approach below for using the attach_file_to_response method:
    1) First read the table's data into an internal table.
    2) Convert the internal table data to STRING format.
    3) Now convert it into tab separated format as how desired.
    4) Convert this STRING format to XSTRING format
    5) Make use of the attach_file_to_response method.
    Regards,
    Uday
    METHOD onactionon_submit .
      DATA: lv_node TYPE REF TO if_wd_context_node,
            lt_mara TYPE if_main=>elements_mara,
            wa_mara TYPE if_main=>element_mara,
            lead_selection_index TYPE i,
            mara_string  TYPE string,
            mara_xstring TYPE xstring.
      lv_node = wd_context->get_child_node( name = 'MARA' ).
      CALL METHOD lv_node->get_static_attributes_table
        IMPORTING
          table = lt_mara.
      LOOP AT lt_mara INTO wa_mara.
        CONCATENATE mara_string
                    wa_mara-matnr
                    wa_mara-ersda
                    wa_mara-ernam
                    wa_mara-matkl
                    wa_mara-meins
                    cl_abap_char_utilities=>cr_lf INTO mara_string
                                            SEPARATED BY cl_abap_char_utilities=>horizontal_tab.
      ENDLOOP.
    ** Now you need to add the column headers & the desired extra information through coding to
    ** mara_string
      CALL FUNCTION 'SCMS_STRING_TO_XSTRING'
        EXPORTING
          text   = mara_string
        IMPORTING
          buffer = mara_xstring.
      CL_WD_RUNTIME_SERVICES=>attach_file_to_response(  i_filename  = 'TEMP.XLS'
                                                        i_content   = mara_xstring
                                                        i_mime_type = 'EXCEL' ).
    ENDMETHOD.

  • Problem creating an excel with ALV GRID

    Hi all,
    this is my problem:
    i have an ALV GRID in which I display several columns in a proper order, es : A B C D E F G
    when i create an excel from this display i obtain a different order of the columns!
    in particular the 3 columns which represent numeric values (es C D E) are the last 3 colums in the excel, instead in the alv grid this 3 comuns stay in the middle!
    so in the excel i obtain : A B F G C D E!!!!
    please can anyone help me to fix this problem?

    hi,
    if you do a debugging it will go into the function module alv_xxl_call.
    in this we can find  the code as below.
    catch system-exceptions import_mismatch_errors = 1.
        import l_xxl_toggle_date from database ltdx(XL) id
                                    'bcalv_xxl_toggle_date'.
      endcatch.
    here place a break point and check what value is it coming for this variable l_xxl_toggle_date.
    if it is coming as X. then this problem will arrive.
    here manually change the variable to space and check , the output will be coming perfectly.
    if value is coming as X.
    THEN WE CAN DO ONE THING.
    HERE we are having a report bcalv_toggle_date which MUST EXECUTED ONCE ONLY.
    WHEN IT IS EXECUTED IT DOES NOT DISPLAY ANYTHING.
    after executing once the variable will be changed from X TO SPACE.
    but we must run this report as other program excel sheet download order  might get disturbed.
    my might suggestion copy thwe standard gui  to custom one and right a code for that excel icon in your code as shown below.
    we need to copy the function module alv_xxl_call and comment the code
    catch system-exceptions import_mismatch_errors = 1.
        import l_xxl_toggle_date from database ltdx(XL) id
                                    'bcalv_xxl_toggle_date'.
      endcatch.
      if l_xxl_toggle_date is initial.
      and endif of the above if.
    WHEN 'XXL'.
          DATA : v_fieldcat TYPE STANDARD TABLE OF kkblo_fieldcat.
          DATA : wa_fieldcat TYPE kkblo_fieldcat.
          DATA : w_fieldcat LIKE LINE OF gt_fieldcat.
          DATA : g_sort TYPE slis_t_sortinfo_alv.
          DATA : g_filter TYPE slis_t_filter_alv.
          DATA : a_fieldcat TYPE slis_t_fieldcat_alv.
          CALL FUNCTION 'REUSE_ALV_GRID_LAYOUT_INFO_GET'
            IMPORTING
              es_layout   = gs_layout
              et_fieldcat = a_fieldcat[]
              et_sort     = g_sort
              et_filter   = g_filter
              es_variant  = gs_variant.
          DELETE a_fieldcat WHERE no_out = 'X'.
          LOOP AT a_fieldcat INTO w_fieldcat.
            MOVE-CORRESPONDING w_fieldcat TO wa_fieldcat.
            APPEND wa_fieldcat TO v_fieldcat.
          ENDLOOP.
          CALL FUNCTION 'ZALV_XXL_CALL'
            EXPORTING
              i_tabname                    = 'IT_FINAL'
            IS_LAYOUT                    =
              it_fieldcat                  = v_fieldcat[]
            I_CALLBACK_TOP_OF_PAGE       =
            I_TITLE                      =
            I_MODE                       =
            TABLES
              it_outtab                    = it_final
           EXCEPTIONS
             FATAL_ERROR                  = 1
             NO_DISPLAY_POSSIBLE          = 2
             OTHERS                       = 3.

  • Refreshing contents of ALV grid

    I am displaying 2 ALV grids in a splitter container on screen 100. There is an option for refresh on this screen to refresh the entries in both the grids (if any change). This refresh works fine using method REFRESH_TABLE_DISPLAY for both top and bottom grid contents.
    After processing the contents in screen 100, the user can navigate to screen 200 to view results of the current run. This screen also holds an ALV grid display of results on a custom container. When returning to screen 100 from 200, the results in top grid of screen 100 are fixed. The refresh option now only works with the grid on bottom container and not the top. I have tried using both REFRESH_TABLE_DISPLAY and SET_TABLE_FOR_FIRST_DISPLAY options and neither worked.
    How do I refresh the ALV to use the contents from the new dataset?
    Regards,
    Suri.

    Are you used refresh in PBO of 100 ?
    Like
        call method g_grid->refresh_table_display.   " Top grid
        call method g_grid1->refresh_table_display. " bottom grid

  • REGARDING READING THE SCREEN CONTENTS IN ALV GRID

    HI ALL,
    i have to transfer contents from one grid display to another grid.
    internal table has :
    internal- table name: itab
    chkbx
    v_lights
    matnr
    maktx
    dline(longtext of the material)
    alv grid is having following contents:
    1. chkbx which will get the user command.
    2. v_lights to display the different colors of light according to the contents of the longtext which i am fetching using the read_text function.
    3. matnr
    4. maktx
    5. longtext of the material.
    after the display of the first grid display.
    if user changes contents of the check box .. i have to read the screen and  and modify my internal table(itab) so that i can fetch data from the internal table to another internal table which i can use for the next screen.
    can anyone of you tell me how can i do this.
    and some help contents so that i can understand the whole concept.
    regards
    vamsi

    Hi vamsi,
      Do this way:
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
       EXPORTING
        I_CALLBACK_PROGRAM                = W_REPID
        I_CALLBACK_PF_STATUS_SET          = 'PF_STATUS'
        I_CALLBACK_USER_COMMAND           = 'USER_COMMAND'
    FORM USER_COMMAND USING P_UCOMM TYPE SY-UCOMM
                            P_SELFLD TYPE SLIS_SELFIELD.
    case p_ucomm.
    when 'SAVE'.
      Data ref1 type ref to cl_gui_alv_grid.
    CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
    IMPORTING
    E_GRID = ref1.
    call method ref1->check_changed_data.
    Now your internal table will have the latest values.
    loop at itab where check = 'X'. "Assuming the first fieldname for the check box is 'CHECK'.
    move-corresponding itab to itab2.
    append itab2.
    clear itab2.
    endcase.
    Build anothe r field catalog
    Display another grid.
    ENDFORM.
    Regards,
    Ravi

  • Problem with print preview in alv grid

    Hello all,
    I have to display base unit of measure(meins) in alv grid output. i am using a conversion routine to convert it from ST TO PC before display.After executing the report i am getting the correct data. the problem is when i select the print preview
    alv list is displayed. in that the unit of measure pc is not displayed, it is comming as '*******. what i came to know is the same conversion routine is triggered in the standard program for the display. so it canot convert that.
    so please help me out in solving this.
    Thanks in advance,
    Sarat

    hi sarath,
        this is an example code try using the statement before displaying, i think it works.
    *example cdoe.
    LOOP AT i_grp1 INTO wa_grp1.
    AT NEW tknum.
    READ TABLE i_grp1 intto wa_grp1 index sy-tabix.
    SUM.
    MOVE-CORRESPONDING wa_grp1 TO wa_grp2.
    APPEND wa_grp2 TO i_grp2.
    ENDAT.
    ENDLOOP.

  • Hide some cells while displaying ALV GRID !

    Hi guyz!
        Back with lill query,
        While displaying ALV GRID using REUSE_ALV_GRID... FMs ,i need to hide
        some cells by default, when the lists is generated.But those cells should
        be  availble to be displayed by the user from ALV layout settings.
        Please advise
    Thanks
    jahan

    Hi, Check for fm documentation.
    Only relevant if layout parameter
    LAYOUT-GET_SELINFOS of IMPORTING structure IS_LAYOUT is set.
    Complex type for modifying information displayed on the selection dialog box:
    mode:              'R' = Only entries passed in internal table
                              IS_SEL_HIDE-T_ENTRIES are output on
                              the dialog box. Selection information
                              obtained by the list tool by reading the
                              selection screen again (only if the report
                              is called with selection screen) are
                              replaced by the entries passed.
                       'S' = The selection information obtained by the
                              list tool by reading the selection screen
                              of the calling report again, are modified
                              by the entries of table
                              IS_SEL_HIDE-T_ENTRIES.
    t_entries:         Table with selection information
    t_entries-mode:   'A' = Display selection information of the current
                             table row on the information dialog box.
                      'D' = Do not display selection information of the
                             the Select option or of parameter SELNAME
                             on the dialog box.
    t_entries-selname: (required only if t_entries-mode = 'D')
                       name of Select option or parameter
    The following table fields are only required if t_entries-mode = 'A'. They contain the selection information to be added.
    t_entries-field:  DDIC field name of the field for which selection
                       information is to be displayed
    t_entries-table:  DDIC table name of t_entries-field.
    t_entries-stext:  Field description on the information dialog box.
                      If t_entries-field and t_entries-table were
                      filled, this text is taken from the DDIC.
    t_entries-valuf:  Selection condition from-value (external format)
    t_entries-valut:  Selection condition to-value (external format)
    t_entries-sign0:  (I)nclusive (E)xclusive
    t_entries-optio:  All values of the option field of the Select
                      option are allowed.
    The remaining fields are used internally and are irrelevant to the caller.
    aRs

  • Problem in pf status in alv grid

    Hi ,
    In alv grid in fm reuse_alv_grid_display under parameter   I_CALLBACK_PF_STATUS_SET   = STATUS
    FORM STATUS_SET USING LS_EXTAB TYPE SLIS_T_EXTAB.
      SET PF-STATUS 'XYZ' EXCLUDING EXTAB.
    ENDFORM.
    Now i have to set back & exit button in my std toolbar.
    I double clicked on XYZ & then control moves to menu painter & i defined all above mentioned button in application toolbar.
    I activated but the mentioned buttons are not displaying in output.
    Anybody will suggest me what i have to do in this case??

    hi
    good
    go through this links
    http://sap.ittoolbox.com/code/archives.asp?i=10&d=3603&a=s
    http://sap.ittoolbox.com/code/archives.asp?i=10&d=1917&a=s
    this ll give you complete idea about the pf status in alv.
    thanks
    mrutyun^

  • Background Execution Problem-Docking Container with 2 ALV Grids in one scre

    Hi Friends,
    I have created 2 ALV Grids in one screen - one below another using DOCKING CONTAINER.
    The objects are 'g_dock_cont' and 'g_dock_cont1'.
    I am getting the foreground output as expected with 2 ALV Grids.
    While executing in background (F9), I am getting only output of first ALV grid. Second ALV is not getting displayed in BACKGROUND(F9) mode.
    How to solve this.
    FORM create_objects.
    * Materials with data
      IF   g_dock_cont IS INITIAL.
       IF sy-batch NE 'X'.
    *CREATE THE OBJECT FOR DOCKING CONTAINER
        CREATE OBJECT g_dock_cont
          EXPORTING
            side                  = cl_gui_docking_container=>dock_at_top
            extension             = 300.
        ENDIF.
    *CREATE THE OBJECT FOR ALV GRID
        CREATE OBJECT g_alvgrid
               EXPORTING i_parent = g_dock_cont.
        wa_layout-grid_title =
              'Materials with Data'.
      ENDIF.
    IF NOT I_DETAIL[] IS INITIAL.
    CALL METHOD g_alvgrid->set_table_for_first_display
      EXPORTING
        IS_VARIANT                    = WA_VARIANT_STX
        IS_LAYOUT                     = wa_layout
      CHANGING
        it_outtab                     = I_DETAIL
        IT_FIELDCATALOG               = LIT_FIELDCATALOG[]
      EXCEPTIONS
        INVALID_PARAMETER_COMBINATION = 1
        PROGRAM_ERROR                 = 2
        TOO_MANY_LINES                = 3
        others                        = 4
    IF sy-subrc <> 0.
    ENDIF.
    ENDIF.
    *MATERIALS WITHOUT DATA
      IF   g_dock_cont1 IS INITIAL.
       IF sy-batch NE 'X'.
    *CREATE THE OBJECT FOR DOCKING CONTAINER
        CREATE OBJECT g_dock_cont1
          EXPORTING
            side                  = cl_gui_docking_container=>dock_at_bottom
            extension             = 300.
       ENDIF.
    *CREATE THE OBJECT FOR ALV GRID
        CREATE OBJECT g_alvgrid1
               EXPORTING i_parent = g_dock_cont1.
        wa_layout1-grid_title =
              'Materials without Data'.
      ENDIF.
    IF NOT I_MARA[] IS INITIAL.
    CALL METHOD g_alvgrid1->set_table_for_first_display
      EXPORTING
        IS_LAYOUT                     = wa_layout1
      CHANGING
        it_outtab                     = I_MARA
        IT_FIELDCATALOG               = i_fieldcat[]
      EXCEPTIONS
        INVALID_PARAMETER_COMBINATION = 1
        PROGRAM_ERROR                 = 2
        TOO_MANY_LINES                = 3
        others                        = 4
    IF sy-subrc <> 0.
    ENDIF.
    ENDIF.
    ENDFORM.                    " create_objects
    Regards,
    Viji.

    Hi,
    What i was saying is that you need to code again for background mode of execution.
    AT END OF SELECTION.
    IF SY-BATCH EQ 'X'.
      PERFORM DISPLAY1.
      PERFORM DISPLAY2.
    In DISPLAY1 use REUSE_ALV_LIST_DISPLAY to display data from outtab1.
    In DISPLAY2 use REUSE_ALV_LIST_DISPLAY to display data from outtab2.
    For example : execute this report in background mode.this will not execute in online mode.
    After execution you will get two spools one for KNA1 and one for LFA1 data. Spool can be controlled via IS_PRINT structure.
    report  zrbackground.
    data gt_lfa1 type standard table of lfa1.
    data gt_kna1 type standard table of kna1.
    start-of-selection.
      select * from lfa1 into table gt_lfa1 up to 10 rows.
      select * from kna1 into table gt_kna1 up to 20 rows.
    end-of-selection.
      if sy-batch eq 'X'.
        perform display_lfa1.
        perform display_kna1.
      endif.
    *&      Form  DISPLAY_LFA1
          text
    -->  p1        text
    <--  p2        text
    form display_lfa1 .
      call function 'REUSE_ALV_LIST_DISPLAY'
        exporting
          i_callback_program = sy-repid
          i_structure_name   = 'LFA1'
        tables
          t_outtab           = gt_lfa1
        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_LFA1
    *&      Form  DISPLAY_KNA1
          text
    -->  p1        text
    <--  p2        text
    form display_kna1 .
      call function 'REUSE_ALV_LIST_DISPLAY'
        exporting
          i_callback_program = sy-repid
          i_structure_name   = 'KNA1'
        tables
          t_outtab           = gt_kna1
        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_KNA1
    Please let me know if its not clear or you need more info.
    Thanks,
    Abhishek
    Edited by: abhishek sinha on May 8, 2009 7:42 PM
    Edited by: abhishek sinha on May 8, 2009 8:45 PM

  • Problem with check box in ALV Grid Display

    I am Displaying Material Master Data in ALV Grid Display with Check Box for each record and if i checked check box then i am processing Update operation in Database,  my question is after perform update operation check box should be clear.
    Kindly help me!!!!

    Hello Raj
    Given the fact that you do not tell us the most important piece of information (namely whether you are using OO-based ALV or not) I assume you are using fm-based ALV lists.
    In this case you probably have defined a USER_COMMAND routine as described in the documentation of the fm.
    FORM user_command  USING r_ucomm LIKE sy-ucomm
                             rs_selfield TYPE slis_selfield.
    * define local data
      DATA: ls_outtab  LIKE LINE OF gt_outtab,
                ld_idx       TYPE i.
      LOOP AT gt_outtab INTO ls_outtab
                     WHERE ( chkbox = 'X' ).
        ld_idx = syst-tabix.
        " Call your update function / method / perform
       ls_outtab-chkbox = space.
       MODIFY gt_outtab FROM ls_outtab INDEX ld_Idx
          TRANSPORTING chkbox.
      ENDLOOP.
    " And now trigger refresh of the ALV display:
      rs_selfield-refresh = 'X'.  " <<< !!!
    ENDFORM.
    Regards
      Uwe

  • Problem with Excel button in ALV Grid...URGENT

    Hi All,
    I have developed a report in ALV Grid. As we all know that by default we get few buttons in ALV Grid, like summation, sorting download, etc.. In that we have one excel button. When i click that excel button the output of the report should give the output in excel sheet. But this is not working.
    The report is running fine except the excel button.
    Do anyone of u have any idea how to do that?
    Its very urgent...
    Regards,
    Parvez.

    Go through the code and Execute it on your system, I think this will do for you.
    In this code I used 3 radio buttons in my selection screen:
    If u selects the first radio button your out put shows into to the Excel sheet.
    If u selects the second radio button your out put shows the in the Editor screen.
    If u clicks the third radio button your output shows into the Excel as well as in the Editor.
    *&                       DATA DECLARATION                              *
    TABLES: MARA,                      "GENERAL MASTER DATA
            MARC,                      "PLANT DATA FOR MATERIAL
            MARD,                      "STORAGE LOCATION DATA FOR MATERIAL
            MBEW,                      "MATERIAL VALUATION
            MVKE,                      "SALES DATA FOR MATERIAL
            MAKT,                      "MATERIAL DESCRIPTION
            EKKO,                      "PURCHASING DOCUMENT HEADER
            EKPO,                      "PURCHASING DOCUMENT ITEM
            VBAK,                      "SALES DOCUMENT HEADER DATA
            VBAP.                      "SALES DOCUMENT ITEM DATA
    TYPE-POOLS : SLIS.
    DATA: VT_FIELDCAT1 TYPE SLIS_T_FIELDCAT_ALV,
          V_FIELDCAT TYPE SLIS_FIELDCAT_ALV,
          V_LAYOUT TYPE SLIS_LAYOUT_ALV,
          BDCDATA LIKE BDCDATA OCCURS 0 WITH HEADER LINE,
          BEGIN OF I_MARA OCCURS 0,
             MATNR LIKE MARA-MATNR,  "MATERIAL NUMBER
             MBRSH LIKE MARA-MBRSH,  "INDUSTRY SECTOR
             MEINS LIKE MARA-MEINS,  "BASE UNIT OF MEASURE
             MATKL LIKE MARA-MATKL,  "MATERIAL GROUP
          END OF I_MARA,
          BEGIN OF I_MARC OCCURS 0,
             MATNR LIKE MARC-MATNR,  "MATERIAL NUMBER
             WERKS LIKE MARC-WERKS,  "PLANT
             LVORM LIKE MARC-LVORM,  "FLAG MATERIAL FOR DELETION AT PLANT
                                      "LEVEL
             DISPO LIKE MARC-DISPO,  "MRP CONTROLLER
          END OF I_MARC,
          BEGIN OF I_MAKT OCCURS 0,
             MATNR LIKE MAKT-MATNR,  "MATERIAL NUMBER
             MAKTX LIKE MAKT-MAKTX,  "MATERIAL DESCRIPTION
             SPRAS LIKE MAKT-SPRAS,  "LANGUAGE KEY
          END OF I_MAKT,
          BEGIN OF I_MVKE OCCURS 0,
             MATNR LIKE MVKE-MATNR,  "MATERIAL NUMBER
             VKORG LIKE MVKE-VKORG,  "SALES ORGANIZATION
             VTWEG LIKE MVKE-VTWEG,  "DISTRIBUTION CHANNEL
          END OF I_MVKE,
          BEGIN OF I_MARD OCCURS 0,
            MATNR LIKE MARD-MATNR,  "MATERIAL NUMBER
            LGORT LIKE MARD-LGORT,  "STORAGE LOCATION
            LABST LIKE MARD-LABST,  "VALUATED STOCK WITH UNRESTRICTED USE
          END OF I_MARD,
          BEGIN OF I_EKPO OCCURS 0,
            EBELN LIKE EKPO-EBELN,  "PURCHASING DOCUMENT NUMBER
            EBELP LIKE EKPO-EBELP,  "ITEM NUMBER OF PURCHASING DOCUMENT
            MATNR LIKE EKPO-MATNR,  "MATERIAL NUMBER
          END OF I_EKPO,
          BEGIN OF I_VBAP OCCURS 0,
            VBELN LIKE VBAP-VBELN,  "SALES DOCUMENT
            POSNR LIKE VBAP-POSNR,  "SALES DOCUMENT ITEM
            MATNR LIKE VBAP-MATNR,  "MATERIAL NUMBER
          END OF I_VBAP,
          BEGIN OF I_OUT OCCURS 0,
            MATNR LIKE MARC-MATNR,
            WERKS LIKE MARC-WERKS,
            LVORM LIKE MARC-LVORM,
            DISPO LIKE MARC-DISPO,
            MBRSH LIKE MARA-MBRSH,
            MEINS LIKE MARA-MEINS,
            MATKL LIKE MARA-MATKL,
            VKORG LIKE MVKE-VKORG,
            VTWEG LIKE MVKE-VTWEG,
            SPRAS LIKE MAKT-SPRAS,
            MAKTX LIKE MAKT-MAKTX,
            LGORT LIKE MARD-LGORT,
            LABST LIKE MARD-LABST,
            EBELN LIKE EKPO-EBELN,
            EBELP LIKE EKPO-EBELP,
            VBELN LIKE VBAP-VBELN,
            POSNR LIKE VBAP-POSNR,
          END OF I_OUT,
          BEGIN OF I_HEADING OCCURS 0,
            TEXT1(20),
            TEXT2(20),
            TEXT3(20),
            TEXT4(20),
            TEXT5(20),
            TEXT6(20),
            TEXT7(20),
            TEXT8(20),
            TEXT9(20),
            TEXT10(20),
            TEXT11(40),
            TEXT12(20),
            TEXT13(20),
            TEXT14(20),
            TEXT15(20),
            TEXT16(20),
            TEXT17(20),
          END OF I_HEADING.
    *&                   S E L E C T I O N - S C R E E N                   *
    SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-100.
    SELECT-OPTIONS: S_MATNR FOR MARA-MATNR. "OBLIGATORY.
    PARAMETERS: P_WERKS LIKE MARC-WERKS. "OBLIGATORY.
    SELECT-OPTIONS: S_LGORT FOR MARD-LGORT,
                    S_DISPO FOR MARC-DISPO,
                    S_EBELN FOR EKPO-EBELN .
    SELECTION-SCREEN END OF BLOCK B1.
    SELECTION-SCREEN BEGIN OF BLOCK B2 WITH FRAME TITLE TEXT-101.
    PARAMETERS : RB1 RADIOBUTTON GROUP G1,
                 RB2 RADIOBUTTON GROUP G1,
                 RB3 RADIOBUTTON GROUP G1.
    SELECTION-SCREEN END OF BLOCK B2.
    *&             S T A R T - O F - S E L E C T I O N                     *
    START-OF-SELECTION.
      SELECT MATNR WERKS LVORM DISPO FROM MARC
      INTO CORRESPONDING FIELDS OF TABLE I_MARC
                          WHERE MATNR IN S_MATNR
                          AND DISPO IN S_DISPO
                          AND WERKS = P_WERKS.
      IF I_MARC[] IS INITIAL.
        WRITE:/ 'NO MATCHING DATA AVAILABLE FROM MARC'.
        EXIT.
      ENDIF.
      PERFORM PURCHASEDATA_VALIDATION.
      PERFORM SALESDATA_VALIDATION.
      SELECT MATNR LGORT LABST FROM MARD INTO TABLE  I_MARD
                          FOR ALL ENTRIES IN I_MARC
                          WHERE MATNR = I_MARC-MATNR
                          AND WERKS EQ P_WERKS
                          AND LGORT IN S_LGORT.
      IF I_MARD[] IS INITIAL.
        WRITE:/ 'NO MATCHING DATA AVAILABLE FROM MARD'.
        EXIT.
      ENDIF.
      SELECT MATNR VKORG VTWEG FROM MVKE INTO TABLE I_MVKE
                          FOR ALL ENTRIES IN I_MARC
                          WHERE MATNR = I_MARC-MATNR.
      IF I_MVKE[] IS INITIAL.
        WRITE:/ 'NO MATCHING DATA AVAILABLE FROM MVKE'.
        EXIT.
      ENDIF.
      LOOP AT I_MARC.
        MOVE-CORRESPONDING I_MARC TO I_OUT.
        CLEAR MARC.
        SELECT SINGLE MATNR MBRSH MEINS MATKL FROM MARA
                          INTO CORRESPONDING FIELDS OF MARA
                          WHERE MATNR = I_OUT-MATNR.
        IF SY-SUBRC = 0.
          MOVE: MARA-MBRSH TO I_OUT-MBRSH,
                MARA-MEINS TO I_OUT-MEINS,
                MARA-MATKL TO I_OUT-MATKL.
        ELSE.
          CONTINUE.
        ENDIF.
        SELECT SINGLE MATNR MAKTX SPRAS FROM MAKT
                        INTO  CORRESPONDING FIELDS OF MAKT
                        WHERE  MATNR = I_OUT-MATNR.
        IF SY-SUBRC = 0.
          MOVE: MAKT-MAKTX TO I_OUT-MAKTX,
                MAKT-SPRAS TO I_OUT-SPRAS.
        ELSE.
          CONTINUE.
        ENDIF.
        LOOP AT I_EKPO WHERE MATNR =  I_MARC-MATNR.
          MOVE: I_EKPO-EBELN TO I_OUT-EBELN,
                I_EKPO-EBELP TO I_OUT-EBELP.
        ENDLOOP.
        LOOP AT I_VBAP WHERE MATNR =  I_MARC-MATNR.
          MOVE: I_VBAP-VBELN TO I_OUT-VBELN,
                I_VBAP-POSNR TO I_OUT-POSNR.
        ENDLOOP.
        LOOP AT I_MARD WHERE MATNR = I_MARC-MATNR.
          MOVE: I_MARD-LABST TO I_OUT-LABST,
                I_MARD-LGORT TO I_OUT-LGORT.
        ENDLOOP.
        LOOP AT I_MVKE WHERE MATNR = I_MARC-MATNR.
          MOVE: I_MVKE-VKORG TO I_OUT-VKORG,
                I_MVKE-VTWEG TO I_OUT-VTWEG.
          APPEND I_OUT.
        ENDLOOP.
        CLEAR I_OUT.
      ENDLOOP.
      PERFORM OPTIONS.
                         FORM  OPTIONS                                *
    FORM OPTIONS.
      IF RB2 = 'X'.
        PERFORM FIELDCAT.
        PERFORM OUTPUT.
      ELSE.
        IF RB1 = 'X'.
          PERFORM HEADINGS.
          PERFORM DLOAD.
        ELSE.
          IF RB3 = 'X'.
            PERFORM HEADINGS.
            PERFORM DLOAD.
            PERFORM FIELDCAT.
            PERFORM OUTPUT.
          ENDIF.
        ENDIF.
      ENDIF.
    ENDFORM.                    "OPTIONS
                         FORM  HEADINGS                               *
    FORM HEADINGS.
      I_HEADING-TEXT1 = 'MATNR'.
      I_HEADING-TEXT2 = 'WERKS'.
      I_HEADING-TEXT3 = 'LVORM'.
      I_HEADING-TEXT4 = 'DISPO'.
      I_HEADING-TEXT5 = 'MBRSH'.
      I_HEADING-TEXT6 = 'MEINS'.
      I_HEADING-TEXT7 = 'MATKL'.
      I_HEADING-TEXT8 = 'VKORG'.
      I_HEADING-TEXT9 = 'VTWEG'.
      I_HEADING-TEXT10 = 'SPRAS'.
      I_HEADING-TEXT11 = 'MAKTX'.
      I_HEADING-TEXT12 = 'LGORT'.
      I_HEADING-TEXT13 = 'LABST'.
      I_HEADING-TEXT14 = 'EBELN'.
      I_HEADING-TEXT15 = 'EBELP'.
      I_HEADING-TEXT16 = 'VBELN'.
      I_HEADING-TEXT17 = 'POSNR'.
      APPEND I_HEADING.
    ENDFORM.                    "HEADINGS
                         FORM  DLOAD                                  *
    FORM DLOAD.
      CALL FUNCTION 'GUI_DOWNLOAD'
        EXPORTING
          FILENAME              = 'C:\MATSTK.XLS'
          FILETYPE              = 'DAT'
          WRITE_FIELD_SEPARATOR = 'X'
        TABLES
          DATA_TAB              = I_HEADING
        EXCEPTIONS
          FILE_WRITE_ERROR      = 1.
      CALL FUNCTION 'GUI_DOWNLOAD'
        EXPORTING
          FILENAME              = 'C:\MATSTK.XLS'
          FILETYPE              = 'DAT'
          APPEND                = 'X'
          WRITE_FIELD_SEPARATOR = 'X'
        TABLES
          DATA_TAB              = I_OUT.
    ENDFORM.                    "DLOAD
                              FORM  FIELDCAT                          *
    FORM FIELDCAT.
      V_FIELDCAT-COL_POS = '1'.
      V_FIELDCAT-FIELDNAME     = 'MATNR'.
      V_FIELDCAT-TABNAME = 'I_OUT'.
      V_FIELDCAT-HOTSPOT = 'X'.
      V_FIELDCAT-REF_FIELDNAME = 'MATNR'.
      V_FIELDCAT-REF_TABNAME   = 'MARC'.
      APPEND V_FIELDCAT TO VT_FIELDCAT1.
      CLEAR  V_FIELDCAT.
      V_FIELDCAT-COL_POS = '2'.
      V_FIELDCAT-FIELDNAME     = 'WERKS'.
      V_FIELDCAT-TABNAME = 'I_OUT'.
      V_FIELDCAT-REF_FIELDNAME = 'WERKS'.
      V_FIELDCAT-REF_TABNAME   = 'MARC'.
      APPEND V_FIELDCAT TO VT_FIELDCAT1.
      CLEAR  V_FIELDCAT.
      V_FIELDCAT-COL_POS = '3'.
      V_FIELDCAT-FIELDNAME     = 'LVORM'.
      V_FIELDCAT-TABNAME = 'I_OUT'.
      V_FIELDCAT-REF_FIELDNAME = 'LVORM'.
      V_FIELDCAT-REF_TABNAME   = 'MARC'.
      APPEND V_FIELDCAT TO VT_FIELDCAT1.
      CLEAR  V_FIELDCAT.
      V_FIELDCAT-COL_POS = '4'.
      V_FIELDCAT-FIELDNAME     = 'DISPO'.
      V_FIELDCAT-TABNAME = 'I_OUT'.
      V_FIELDCAT-REF_FIELDNAME = 'DISPO'.
      V_FIELDCAT-REF_TABNAME   = 'MARC'.
      APPEND V_FIELDCAT TO VT_FIELDCAT1.
      CLEAR  V_FIELDCAT.
      V_FIELDCAT-COL_POS = '5'.
      V_FIELDCAT-FIELDNAME     = 'MBRSH'.
      V_FIELDCAT-TABNAME = 'I_OUT'.
      V_FIELDCAT-REF_FIELDNAME = 'MBRSH'.
      V_FIELDCAT-REF_TABNAME   = 'MARA'.
      APPEND V_FIELDCAT TO VT_FIELDCAT1.
      CLEAR  V_FIELDCAT.
      V_FIELDCAT-COL_POS = '6'.
      V_FIELDCAT-FIELDNAME     = 'MEINS'.
      V_FIELDCAT-TABNAME = 'I_OUT'.
      V_FIELDCAT-REF_FIELDNAME = 'MEINS'.
      V_FIELDCAT-REF_TABNAME   = 'MARA'.
      APPEND V_FIELDCAT TO VT_FIELDCAT1.
      CLEAR  V_FIELDCAT.
      V_FIELDCAT-COL_POS = '7'.
      V_FIELDCAT-FIELDNAME     = 'MATKL'.
      V_FIELDCAT-TABNAME = 'I_OUT'.
      V_FIELDCAT-REF_FIELDNAME = 'MATKL'.
      V_FIELDCAT-REF_TABNAME   = 'MARA'.
      APPEND V_FIELDCAT TO VT_FIELDCAT1.
      CLEAR  V_FIELDCAT.
      V_FIELDCAT-COL_POS = '8'.
      V_FIELDCAT-FIELDNAME     = 'VKORG'.
      V_FIELDCAT-TABNAME = 'I_OUT'.
      V_FIELDCAT-REF_FIELDNAME = 'VKORG'.
      V_FIELDCAT-REF_TABNAME   = 'MVKE'.
      APPEND V_FIELDCAT TO VT_FIELDCAT1.
      CLEAR  V_FIELDCAT.
      V_FIELDCAT-COL_POS = '9'.
      V_FIELDCAT-FIELDNAME     = 'VTWEG'.
      V_FIELDCAT-TABNAME = 'I_OUT'.
      V_FIELDCAT-REF_FIELDNAME = 'VTWEG'.
      V_FIELDCAT-REF_TABNAME   = 'MVKE'.
      APPEND V_FIELDCAT TO VT_FIELDCAT1.
      CLEAR  V_FIELDCAT.
      V_FIELDCAT-COL_POS = '10'.
      V_FIELDCAT-FIELDNAME     = 'SPRAS'.
      V_FIELDCAT-TABNAME = 'I_OUT'.
      V_FIELDCAT-REF_FIELDNAME = 'SPRAS'.
      V_FIELDCAT-REF_TABNAME   = 'MAKT'.
      APPEND V_FIELDCAT TO VT_FIELDCAT1.
      CLEAR  V_FIELDCAT.
      V_FIELDCAT-COL_POS = '11'.
      V_FIELDCAT-FIELDNAME     = 'MAKTX'.
      V_FIELDCAT-TABNAME = 'I_OUT'.
      V_FIELDCAT-REF_FIELDNAME = 'MAKTX'.
      V_FIELDCAT-REF_TABNAME   = 'MAKT'.
      APPEND V_FIELDCAT TO VT_FIELDCAT1.
      CLEAR  V_FIELDCAT.
      V_FIELDCAT-COL_POS = '12'.
      V_FIELDCAT-FIELDNAME     = 'LGORT'.
      V_FIELDCAT-TABNAME = 'I_OUT'.
    V_FIELDCAT-REF_FIELDNAME = 'LGORT'.
    V_FIELDCAT-REF_TABNAME   = 'MARD'.
      V_FIELDCAT-SELTEXT_L = 'STRG LOCT'.
      V_FIELDCAT-OUTPUTLEN = 10.
      APPEND V_FIELDCAT TO VT_FIELDCAT1.
      CLEAR  V_FIELDCAT.
      V_FIELDCAT-COL_POS = '13'.
      V_FIELDCAT-FIELDNAME     = 'LABST'.
      V_FIELDCAT-TABNAME = 'I_OUT'.
      V_FIELDCAT-SELTEXT_M = 'STOCK'.
      V_FIELDCAT-OUTPUTLEN = 15.
    V_FIELDCAT-REF_FIELDNAME = 'LABST'.
    V_FIELDCAT-REF_TABNAME   = 'MARD'.
      V_FIELDCAT-DO_SUM = 'X'.
      V_LAYOUT-TOTALS_TEXT = 'TOTAL STOCK:'.
      V_FIELDCAT-HOTSPOT = 'X'.
      APPEND V_FIELDCAT TO VT_FIELDCAT1.
      CLEAR  V_FIELDCAT.
      V_FIELDCAT-COL_POS = '14'.
      V_FIELDCAT-FIELDNAME     = 'EBELN'.
      V_FIELDCAT-TABNAME = 'I_OUT'.
      V_FIELDCAT-HOTSPOT = 'X'.
      V_FIELDCAT-REF_FIELDNAME = 'EBELN'.
      V_FIELDCAT-REF_TABNAME   = 'EKPO'.
      APPEND V_FIELDCAT TO VT_FIELDCAT1.
      CLEAR  V_FIELDCAT.
      V_FIELDCAT-COL_POS = '15'.
      V_FIELDCAT-FIELDNAME     = 'EBELP'.
      V_FIELDCAT-TABNAME = 'I_OUT'.
      V_FIELDCAT-REF_FIELDNAME = 'EBELP'.
      V_FIELDCAT-REF_TABNAME   = 'EKPO'.
      APPEND V_FIELDCAT TO VT_FIELDCAT1.
      CLEAR  V_FIELDCAT.
      V_FIELDCAT-COL_POS = '16'.
      V_FIELDCAT-FIELDNAME     = 'VBELN'.
      V_FIELDCAT-TABNAME = 'I_OUT'.
      V_FIELDCAT-HOTSPOT = 'X'.
      V_FIELDCAT-REF_FIELDNAME = 'VBELN'.
      V_FIELDCAT-REF_TABNAME   = 'VBAP'.
      APPEND V_FIELDCAT TO VT_FIELDCAT1.
      CLEAR  V_FIELDCAT.
      V_FIELDCAT-COL_POS = '17'.
      V_FIELDCAT-FIELDNAME     = 'POSNR'.
      V_FIELDCAT-TABNAME = 'I_OUT'.
      V_FIELDCAT-REF_FIELDNAME = 'POSNR'.
      V_FIELDCAT-REF_TABNAME   = 'VBAP'.
      APPEND V_FIELDCAT TO VT_FIELDCAT1.
      CLEAR  V_FIELDCAT.
    ENDFORM.                      "FIELDCAT
                              FORM  OUTPUT                            *
    FORM OUTPUT.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          I_CALLBACK_PROGRAM      = SY-REPID
          I_CALLBACK_TOP_OF_PAGE  = 'TOP-OF-PAGE'
          I_GRID_TITLE = 'CLICK ON MATERIAL/PURDOC/SALESDOC FOR DETAILS'
          I_CALLBACK_USER_COMMAND = 'DISPLAYDETAILS'
          IS_LAYOUT               = V_LAYOUT
          IT_FIELDCAT             = VT_FIELDCAT1
        TABLES
          T_OUTTAB                = I_OUT.
      IF SY-SUBRC <> 0.
      ENDIF.
    ENDFORM.                    "OUTPUT
                            FORM  TOP-OF-PAGE                         *
    FORM TOP-OF-PAGE.
      DATA: T_HEADER TYPE SLIS_T_LISTHEADER,
            WA_HEADER TYPE SLIS_LISTHEADER.
      WA_HEADER-TYP = 'H'.
      WA_HEADER-INFO = 'REPORT FOR : '.
      APPEND WA_HEADER TO T_HEADER.
      CLEAR WA_HEADER.
      WA_HEADER-TYP = 'S'.
      WA_HEADER-INFO = 'MATERIAL DETAILS'.
      APPEND WA_HEADER TO T_HEADER.
      CLEAR WA_HEADER.
      WA_HEADER-TYP = 'S'.
      WA_HEADER-INFO = 'PURCHASE ORDER DETAILS'.
      APPEND WA_HEADER TO T_HEADER.
      CLEAR WA_HEADER.
      WA_HEADER-TYP = 'S'.
      WA_HEADER-INFO = 'SALES ORDER DETAILS'.
      APPEND WA_HEADER TO T_HEADER.
      CLEAR WA_HEADER.
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
        EXPORTING
          I_LOGO             = 'GEAR'
          IT_LIST_COMMENTARY = T_HEADER.
    ENDFORM.                    "TOP-OF-PAGE
    *&                  FORM  PURCHASEDATA_VALIDATION                      *
    FORM PURCHASEDATA_VALIDATION.
      SELECT EBELN EBELP MATNR
                 FROM EKPO
                 INTO TABLE I_EKPO
                 FOR ALL ENTRIES IN I_MARC
                 WHERE MATNR = I_MARC-MATNR
                 AND EBELN IN S_EBELN
                 AND WERKS EQ P_WERKS.
      IF I_EKPO[] IS INITIAL.
        WRITE:/ 'NO MATCHING DATA IS SELECTED FROM TABLE EKPO'.
        EXIT.
      ENDIF.
      DATA: T_EKPO LIKE I_EKPO OCCURS 0 WITH HEADER LINE.
      T_EKPO[] = I_EKPO[].
      REFRESH I_EKPO.
      FREE I_EKPO.
      LOOP AT T_EKPO.
        SELECT SINGLE EBELN FROM EKKO INTO EKPO-EBELN
        WHERE EBELN = T_EKPO-EBELN.
        IF SY-SUBRC = 0.
          MOVE-CORRESPONDING T_EKPO TO I_EKPO.
          APPEND I_EKPO.
          CLEAR I_EKPO.
        ELSE.
          CONTINUE.
        ENDIF.
      ENDLOOP.
      SORT I_EKPO.
    ENDFORM.                    "PURCHASEDATA_VALIDATION
    *&                  FORM  SALESDATA_VALIDATION                         *
    FORM SALESDATA_VALIDATION.
      SELECT VBELN POSNR MATNR
              FROM VBAP
              INTO CORRESPONDING FIELDS OF TABLE
              I_VBAP FOR ALL ENTRIES IN I_MARC
              WHERE MATNR = I_MARC-MATNR.
      DATA: T_VBAP LIKE I_VBAP OCCURS 0 WITH HEADER LINE.
      T_VBAP[] = I_VBAP[].
      REFRESH I_VBAP.
      FREE I_VBAP.
      LOOP AT T_VBAP.
        SELECT SINGLE VBELN FROM VBAK INTO VBAK-VBELN
        WHERE VBELN = T_VBAP-VBELN.
        IF SY-SUBRC = 0.
          MOVE-CORRESPONDING T_VBAP TO I_VBAP.
          APPEND I_VBAP.
          CLEAR I_VBAP.
        ELSE.
          CONTINUE.
        ENDIF.
      ENDLOOP.
      SORT I_VBAP.
    ENDFORM.                    "SALESDATA_VALIDATION

Maybe you are looking for