Dynamically select multiple rows in web dynpro table

Hi All,
I am populating rows in a table by calling BAPI.
I set the selection property to 1..n for the context model node in view and custom controller.
I set the selectionmode property to multi for the table.
I have a "Select All" button in my view.
When i click this button, i want to select all the records in the table.
Then i want to loop thru the selected rows.
How can i do this?
Please give me some sample code or reference documents.
Thanks.

Hi Tiruna,
To select all elements in the node you can use following code (created by Valery Silaev) where select parameters indicate to "select" or "unselect":
     public static void selectElements(final IWDNode node, final boolean select)
          final int leadSelection;
          if ( select )
               leadSelection = Math.min
                    Math.max( 0, node.getLeadSelection() ), node.size() - 1
          else
               leadSelection = IWDNode.NO_SELECTION;
          for (int i = node.size() - 1; i >= 0; i--)
               node.setSelected( i, select );
          if ( 0 < node.size())
               node.setLeadSelection( leadSelection );
to iterate selected elements you can use:
for (int j = 0, n = wdContext.nodeRows().size(); j < n; ++j)
  if (wdContext.nodeRows().getLeadSelection() == j
    || wdContext.nodeRows().isMultiSelected(j)
    /* row at index j is selected */
Best regards, Maksim Rashchynski.

Similar Messages

  • Dynamic selection screen with ABAP web dynpro

    Hi all.
        How can I create dynamic selection screen with ABAP web dynpro? Thank you in advance.

    hi yinglak.....
             this is possible........ all the ui elelments has the property called visible and enabled.... just assign an attribute of type wdui_visibility to the visible property....
    in the wddomodify method..... check for the radio button value and pass the value true or false to this attribute and it gets changed automatically.
    ---regards,
       alex b justin

  • How to use EVS with different data in each row, in a Java Web Dynpro table?

    Hi all,
    I am using EVS in a column of java web dynpro table.
    Let's say the name, and context attribute, of this column is column1.
    It's filled dynamically using an RFC, that uses as input parameter the value of another column, and related context attribute, from the same table (Let's call it column2).  Obviously, from the same row. So, in other words: the values of the EVS in column1 of row1, are dependent of the value of column2 of row1. And the values of the EVS in column1 of row2, are dependent of the value of column2 of row2. And so on... Hope i could explain myself ok.
    The code I'm using works great for filling the EVS dynamically:
    IWDAttributeInfo attrInfo = wdContext.nodeDetail().getNodeInfo().getAttribute(nodeElement.COLUMN1);
    ISimpleTypeModifiable siType = attrInfo.getModifiableSimpleType();
    IModifiableSimpleValueSet<String> value = siType.getSVServices().getModifiableSimpleValueSet();
    value.clear();
    if(this.initRFC_Input(nodeElement.getColumn2())){
         for (int i = 0; i < wdContext.nodeRFCresult().size(); i++){
              value.put(wdContext.nodeRFCresult().getRFCresultElementAt(i).getLgort()
                 , wdContext.nodeRFCresult().getRFCresultElementAt(i).getLgobe());
    In this code, nodeElement is the context row of the table that is passed dynamically to the method when the value of colum2 is changed.
    HOWEVER, the problem I'm having is that after executing this code, EACH NEW ROW that is added to the table has by default the same values as the first row, in the column1 EVS. And, for example, if I refresh the values of the column1 EVS in row 2, all EVS values in the other rows are also refreshed with the same values as the ones of EVS in row 2.
    How can I make sure each row EVS has its own set of independent values, so they don't mess with each other?
    Hope you guys can help me. And please, let me know if I didn't explain myself correctly!
    Thanks!

    I just did as you said (I think), but it's still having the same behaviour as before (same data for all EVS in the table).
    Here´s what I did:
    I
    In node "Detail" (cardinality 0...n, singleton set to true), which is binded to the table, I created a child node named "Column1Values" wth cardinality 1...1 and singleton set to false.
    "Column1Values" node has an attribute called "column1", of type String.
    I did the binding between attribute "column1" and the column1 inputfield celleditor in the table.
    I created an event called Column2Changed and binded it to the column2 celleditor of the table. I added a parameter called nodeElement of type IPrivateCompView.IDetailElement to this event, and mapped it to the column2 editor in the table so that I can dynamically get the nodeElement that is being affected.
    I added the following code to the onActionColumn2Changed(wdEvent, nodeElement) method that gets created in the view:
    IWDAttributeInfo attrInfo = nodeElement.nodeColumn1Values().getNodeInfo().getAttribute("column1");
    ISimpleTypeModifiable siType = attrInfo.getModifiableSimpleType();
    IModifiableSimpleValueSet<String> value = siType.getSVServices().getModifiableSimpleValueSet();
    if(this.initRFC_Input(nodeElement.getColumn2())){
         for(int i =0; i < wdContext.nodeRFCresults().size(); i++){
              value.put(wdContext.nodeRFCresults().getRFCresultsElementAt(i).getId(),
                                  wdContext.nodeRFCresults().getRFCresultsElementAt(i).getDesc());
    And with this, I still get the original problem... When the EVS of one row is updated, ALL other EVS of the table get also updated with the same values.
    What am I missing? Sorry Govardan, I bet I'm not seeing something really obvious... hopefully you can point me in the right direction.
    Thanks!

  • Load and Display Multiple Images in a Web Dynpro Table

    I am new to Web Dynpro and I am wondering if anyone can help me with an application that I am currently developing. I have a particular requirement to store images in a database table (not MIME repository) and then display them in a WD table element. An image can be of JPEG, PNG or TIFF format and is associated with an employee record.
    I want to create a view in my application that displays multiple images in a table, one image per row. I want to do this using Web Dynpro for ABAP, not Java. I have looked into pretty much all examples available for Web Dynpro and came to the conclusion that Components such as WDR_TEST_EVENTS and WDR_TEST_UI_ELEMENTS do not have any examples of images being stored in a database table and viewed in/from a Web Dynpro table element. Programs such as RSDEMO_PICTURE_CONTROL, DEMO_PICTURE_CONTROL and SAP_PICTURE_DEMO do not show this either.
    The images to be displayed in the Dynpro table are to come from a z-type table, stored in a column of data type XSTRING (RAW STRING). So I would also like to know how to upload these images into this z-type table using ABAP code (not Java).
    Your help would be greatly appreciated.
    Kenn

    Hi,
    May be this is the is the correct place to post your query.
    Web Dynpro ABAP
    Regards,
    Swarna Munukoti.
    Edited by: Swarna Munukoti on Jul 16, 2009 3:52 PM

  • Selecting multiple rows in BW Web reports

    Hello Everyone,
    I am working on the BW web report where we want to give user interaction screen through BSP.
    We achived this for a single row in BW report where when user clicks on some link or button it opens up the BSP screen with the selected row value in BW report.
    Now we want to give multiple rows option where user can select multiple rows in BW report and the corresponding values should be available in BSP by clicking of some button in BW.
    has anyone done this before. thanks in advance.
    regards
    rajeev

    HI
    Int leadSelection = wdcontext.nodemodelnode.getLeadSelection();
      for(int i=0;i<wdcontext.nodeModelNode.size;i++)
        if(wdcontext.nodeModelNode.isMultiselected(i) || leadSelection ==i)
               String name = wdcontext.nodemodelnode.getnameelementatindex(i).getName();
               String  address = wdcontext.nodemodelnode.getaddresselementatindex(i).getAddress();
               String age = wdcontext.nodemodelnode.getAgeelementatindex(i).getAge();
            Create a method for the Table Property onLeadSelect() where you can open a popup window
             Create a value node and with attributes same as Table attributes and then set the values of the table
             to the value node attributes.
    Thanks

  • Select Multiple Rows in a Table without CTRL

    Expecting the user to press "Ctrl" when selecting multple rows is very unfriendly and unintuitive. We'd like the row selection to work as in ALV where you just select multiple rows by clicking on them.
    We've set the tables rowSelectable to true and selectionMode to 'multi' but we still cannot select multiple rows without the CTRL hotkey.
    This issue apparently [arose before|About selection in the table] but wasn't resolved.
    System Details
    SAP_ABA     701     0006     SAPKA70106
    SAP_BASIS     701     0006     SAPKB70106
    SAP_AP     700     0019     SAPKNA7019

    Hello Marc,
    you need to call IF_WD_CONTEXT_NODE->set_selected(index = lv_index) sorry for the typo in my previous comment.
    by calling IF_WD_CONTEXT_NODE->set_selected method wont remove the lead selection.
    to unselect the records, you can call the same method by passing the FLAG value as abap_false.
    so for your usecase the logic will be like this in the ON_SELECT event handler
    1. get the index of the new_lead_selection
    2. check whether this is already seleted in the context node by calling IF_WD_CONTEXT_NODE->IS_selected
    3. if already selected then call IF_WD_CONTEXT_NODE->set_selected( flag = abap_false index = lv_index)
       if not selected then call IF_WD_CONTEXT_NODE->set_selected( index = lv_index )
    Hope this solved your problem.
    BR, Saravanan
    Edited by: Saraa_n on Jul 6, 2011 11:52 AM

  • Selecting multiple rows in a table

    Hi All,
    I have one problem with selecting multiple rows in a table.I tried with setting table property-selectionMode as Multi, but i dinn't get the solution.
    please provide me solution for this.
    Thanks & Regards,
    Sreelakshmi.

    HI
    Int leadSelection = wdcontext.nodemodelnode.getLeadSelection();
      for(int i=0;i<wdcontext.nodeModelNode.size;i++)
        if(wdcontext.nodeModelNode.isMultiselected(i) || leadSelection ==i)
               String name = wdcontext.nodemodelnode.getnameelementatindex(i).getName();
               String  address = wdcontext.nodemodelnode.getaddresselementatindex(i).getAddress();
               String age = wdcontext.nodemodelnode.getAgeelementatindex(i).getAge();
            Create a method for the Table Property onLeadSelect() where you can open a popup window
             Create a value node and with attributes same as Table attributes and then set the values of the table
             to the value node attributes.
    Thanks

  • Select multiple row in a table that are not connected

    I want to be able to select multiple rows, but want to be able to select rows that are not next to each other. They maybe have one or two rows between. Is there anyway to do this in a table?
    Thanks

    So do a lot of other people, but you can’t.
    Tell Adobe here: https://www.adobe.com/cfusion/mmform/index.cfm?name=wishform
    Bob

  • Select multiple rows from dual table

    Is it possible to select multiple rows from dual table using a single select statement.
    i.e., i want the out put to be
    column_name
    1
    2
    3
    4
    Edited by: vidya.ramachandra on Dec 14, 2009 8:24 AM

    Aside from the fact you're responding to an old thread...
    1002424 wrote:
    While using CONNECT BY, I see it always leave behind one row.
    Suppose I have a condition based on which I have to generate constant rows like
    SELECT 1 FROM DUAL WHERE ROWNUM < N;
    Here if N = 0, still it gives out single row.... you are obviously doing something wrong in your code elsewhere, because that SQL statement does not always return a single row...
    SQL> SELECT 1 FROM DUAL WHERE ROWNUM < 0;
    no rows selected
    SQL>

  • How to select multiple row of table using check box?

    hi,
             i am having table on view having first field as checkbox. what i want, when i click on checkboxes in multiple rows, and i click on any button i need to use those content to next view...
              my problem is if i select only one row , i can use onlead select property of table..but when i select multiple rows  through check box how should i read contents of table....?
    Plz solve it.
    Thanks,
    Saurin Shah

    Hello Saurin,
    You are right using LeadSelection you can select only 1 row at a time. You will have to make use of Selection for achieving this. First you will have to change the selection mode of the table to multiple & also change the selection property for the related context to 0..n . Please find a code extract which might help you. (However this facility is only available from SP 14.) The main part is using the set_selected method of if_wd_context_node.
    data: node_zcourse_details type ref to if_wd_context_node,
             node_course_assign type ref to if_wd_context_node,
             elem_course_assign type ref to if_wd_context_element,
             stru_course_assign type if_v_details=>element_course_assign ,
             item_popin_selected like stru_course_assign-popin_selected.
    "     navigate from <CONTEXT> to <ZCOURSE_DETAILS> via lead selection
    node_zcourse_details = wd_context->get_child_node( name = if_v_details=>wdctx_zcourse_details ).
    "     navigate from <ZCOURSE_DETAILS> to <COURSE_ASSIGN> via lead selection
    node_course_assign = node_zcourse_details->get_child_node( name = if_v_details=>wdctx_course_assign ).
    "     @TODO handle not set lead selection
    if ( node_course_assign is initial ).
    exit.
    endif.
    data elem_set type wdr_context_element_set.
    field-symbols <wa_elem> like line of elem_set.
    elem_set = node_course_assign->get_elements( ).
    loop at elem_set assigning <wa_elem>.
       <wa_elem>->set_selected( TRUE OR FALSE ). " Supply either TRUE/FALSE in here
    endloop.

  • Selecting multiple rows of a table

    Hi Forum,
    How to select multiple rows of a table at a time? Please help me..
    Thanks
    Swapna

    Hi Swapna,
    To select more then one row in table, just set the selectionmode property of table to 'multi' or 'auto' and also change the selection property of the node (to which table is binded) to  0:n.
    I hope it helps.
    Regards
    Arjun
    Edited by: Arjun on Feb 4, 2009 11:52 AM

  • Insert multiple records from web dynpro

    Hi,
    How to insert multiple records from web dynpro applications to SAP backend system ?
    Thanks,
    sowmya

    Hi soumya..
       if want to multiple row selected  then save into the Sap back End..
       value node--table.
    Backend value node=table_bapi_input;
       back end internal table --tableback.
    int size=wdcontext.nodeTable().size();
    int lead=wdcontext.nodeTable().getLeadSelection();
    table_bapi_input in=new table_bapi_input();
    wdcontext.nodetable_bapi_input().bind(in);
       for(int i=size-1;i>0;i--){
    tableback set=new tableback()
    if(lead==i || wdcontext.nodeTable().ismultiSelection(i)){
    set.setName(wdContext.nodeTable().getTableElementAt(i).getName();
    in.addZc_input(set);
    wdContext.currenttable_bapi_inputElement().modelobject().excute();
    wdContext.nodeOutput().invalidate();
    thanks
    jati

  • Integration of a Tree Structure in a Web Dynpro Table

    Hi,
    I am implementing an Integration of a Tree Structure in a Web Dynpro Table.
    The Tree-Table os working as required, but I can not work with the OnLeadSelect Action of the table.
    The Action does not work as required, meanning, it returns all the time the first row and not the "lead select".
    As far as I read I should add some code to the wdDoModifyView method, but I did not figure out exactly what...
    Thanks in advance,
    Aviad

    check this URL:
    /people/valery.silaev/blog/2005/06/20/master-of-columns-part-ii

  • Selecting multiple rows of an alv

    Hi All,
    I have a requirement where in i have to select multiple rows of an alv and when i click a button i should get the data of all the selected rows, i am able to select only one row by default , how to select multiple rows or records,i am new to this Web dynpro alv , can aynbody please help me on this.
    Thanks,
    Praveen.

    hi, praveen kumar.
    About how to make "Multiple-select" of ALV available, you can take a reference of the following coding. Just one example:
    ****ALV Config****
      DATA:
          lr_salv_wd_table TYPE REF TO iwci_salv_wd_table,
          l_value TYPE REF TO cl_salv_wd_config_table,
          lr_table_settings TYPE REF TO if_salv_wd_table_settings.
       lr_salv_wd_table = wd_this->wd_cpifc_alv_child( ).  "Your statically declared ALV component usage
       l_value = lr_salv_wd_table->get_model( ).
    * tabel setting
      lr_table_settings ?= l_value .
      lr_table_settings->set_selection_mode( cl_wd_table=>e_selection_mode-MULTI ).
    About how to get your selected records of ALV, you can make use of the context node bound to your ALV component. For example,
    ****get selected elements****
    lt_elems = lo_node->GET_SELECTED_ELEMENTS(
          INCLUDING_LEAD_SELECTION = abap_true ).
    These are just examples. For detail, you can search them.
    Thanks.Best wishes.

  • Selecting Multiple rows in an ALV

    Hi Experts,
    Using 'REUSE_ALV_GRID_DISPLAY' is it possible to select multiple rows, WITHOUT using CTRL OR SHIFT keys ?
    thanks in advance.

    I have done an application for multiple selection in ALV using check box concept. Please find that code below.
    *& Report  ZATL_DELIVERY
    REPORT  zatl_delivery.
    INCLUDE zatl_delivery_declarations.
    SELECTION-SCREEN BEGIN OF BLOCK a WITH FRAME TITLE text-001.
    SELECT-OPTIONS:  s_vbeln FOR vbak-vbeln OBLIGATORY.
    SELECTION-SCREEN END OF BLOCK a.
    INITIALIZATION.
    AT SELECTION-SCREEN.
    START-OF-SELECTION .
    SET PF-STATUS 'ABC'.
    SET PF-STATUS 'BCD'.
    get the sales order numbers thru given
    selection-screen parameters
      SELECT vbeln FROM vbak INTO TABLE it_data
              WHERE vbeln IN s_vbeln.
              AND  ERDAT = P_DATE.
      IF NOT it_data[] IS INITIAL.
        SELECT vbeln vstel FROM vbap INTO TABLE it_vstel
                 FOR ALL ENTRIES IN it_data
                   WHERE vbeln = it_data-vbeln.
      ENDIF.
      LOOP AT it_data INTO wa_data.
        CALL FUNCTION 'ZBAPI_GET_MATERIAL_PLANT_DTL'
          EXPORTING
            v_vbeln = wa_data-vbeln
          TABLES
            it_bapi = it_result.
        LOOP AT it_result INTO wa_result.
          READ TABLE it_vstel INTO wa_vstel WITH KEY
                           vbeln = wa_result-vbeln.
          wa_final-vbeln = wa_result-vbeln. " SALES ORDER NO
          wa_final-matnr = wa_result-matnr.
          wa_final-vstel = wa_vstel-vstel.
          wa_final-werks = wa_result-werks.
          wa_final-labst = wa_result-kwmeng.
          APPEND wa_final TO it_final.
          CLEAR wa_result.
        ENDLOOP.
        REFRESH it_result.
        CLEAR wa_data.
      ENDLOOP.
      PERFORM build_fldcat.
      PERFORM disp_output.
    *SET PF-STATUS 'ABC'.
    *&      Form  ABC
          text
         -->EXTAB      text
    FORM abc USING extab TYPE slis_t_extab.
      SET PF-STATUS 'ABC'. " excluding extab.
    ENDFORM.                    "ABC
    read
    *&      Form  build_fldcat
          text
    -->  p1        text
    <--  p2        text
    FORM build_fldcat .
      wa_fldcat-col_pos = '1'.
      wa_fldcat-fieldname = 'MARK'.
      wa_fldcat-checkbox = 'X'.
      wa_fldcat-edit = 'X'.
      wa_fldcat-seltext_m     = 'MARK'.
      APPEND wa_fldcat TO i_fldcat.
      CLEAR wa_fldcat.
      wa_fldcat-col_pos = '2'.
      wa_fldcat-fieldname = 'VBELN'.
      wa_fldcat-tabname = 'IT_FINAL'.
      wa_fldcat-seltext_m     = 'SALES ORD NO'.
      APPEND wa_fldcat TO i_fldcat.
      wa_fldcat-col_pos = '3'.
      wa_fldcat-fieldname = 'MATNR'.
      wa_fldcat-tabname = 'IT_FINAL'.
      wa_fldcat-seltext_m     = 'MAT NO'.
      APPEND wa_fldcat TO i_fldcat.
      wa_fldcat-col_pos = '4'.
      wa_fldcat-fieldname = 'WERKS'.
      wa_fldcat-tabname = 'IT_FINAL'.
      wa_fldcat-seltext_m     = 'PLANT'.
      APPEND wa_fldcat TO i_fldcat.
      wa_fldcat-col_pos = '5'.
      wa_fldcat-fieldname = 'LABST'.
      wa_fldcat-tabname = 'IT_FINAL'.
      wa_fldcat-seltext_m     = 'QNTY'.
      APPEND wa_fldcat TO i_fldcat.
    ENDFORM.                    " build_fldcat
    *&      Form  disp_output
          text
    -->  p1        text
    <--  p2        text
    FORM disp_output .
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          i_callback_program       = sy-repid
          i_callback_pf_status_set = 'ABC'
          it_fieldcat              = i_fldcat
          i_callback_user_command  = 'CHECKED'
        TABLES
          t_outtab                 = it_final
        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.                    " disp_output
    *&      Form  CHECKED
          text
         -->R_UCOMM      text
         -->RS_SELFIELD  text
    FORM checked USING r_ucomm LIKE sy-ucomm
                  rs_selfield TYPE slis_selfield.
      DATA: gd_repid LIKE sy-repid, "Exists
      ref_grid TYPE REF TO cl_gui_alv_grid.
      IF ref_grid IS INITIAL.
        CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
          IMPORTING
            e_grid = ref_grid.
      ENDIF.
      IF NOT ref_grid IS INITIAL.
        CALL METHOD ref_grid->check_changed_data .
      ENDIF.
      CASE r_ucomm.
        WHEN 'DELIVERY'.
          IF rs_selfield-fieldname = 'MARK'.
            DATA : date_external(10) TYPE c.
            DATA: temp_date TYPE sy-datum.
            temp_date = sy-datum.
            temp_date = temp_date + 1.
            CALL FUNCTION 'CONVERT_DATE_TO_EXTERNAL'
              EXPORTING
                date_internal            = sy-datum
              IMPORTING
                date_external            = date_external
              EXCEPTIONS
                date_internal_is_invalid = 1
                OTHERS                   = 2.
            LOOP AT it_final INTO wa_final WHERE mark EQ 'X'.
              PERFORM bdc_dynpro      USING 'SAPMV50A' '0100'.
              PERFORM bdc_field       USING 'BDC_CURSOR'
                                            'LV50C-VBELN'.
              PERFORM bdc_field       USING 'BDC_OKCODE'
                                            '/00'.
              PERFORM bdc_field       USING 'LIKP-VSTEL'
                                            wa_final-vstel. " 'HLL'.
              PERFORM bdc_field       USING 'LV50C-DATBI'
                                            date_external. "
              PERFORM bdc_field       USING 'LV50C-VBELN'
                                            wa_final-vbeln.     " '34'.
              PERFORM bdc_dynpro      USING 'SAPMV50A' '0200'.
              PERFORM bdc_field       USING 'BDC_CURSOR'
                                            'LIPS-MATNR(02)'.
              PERFORM bdc_field       USING 'BDC_OKCODE'
                                            '=SICH'.
              PERFORM bdc_field       USING 'LIKP-BLDAT'
                                            date_external. " '19.09.2008'.
                CLEAR date_external.
              CALL FUNCTION 'CONVERT_DATE_TO_EXTERNAL'
                EXPORTING
                  date_internal            = temp_date
                IMPORTING
                  date_external            = date_external
                EXCEPTIONS
                  date_internal_is_invalid = 1
                  OTHERS                   = 2.
              PERFORM bdc_field       USING 'LIKP-WADAT'
                                            date_external ." '19.09.2008'.
                CLEAR date_external.
              PERFORM bdc_field       USING 'LIKP-BTGEW'
                                            wa_final-labst.     " -'12'.
              PERFORM bdc_field       USING 'LIKP-GEWEI'
                                            'wa_likp-GEWEI'.
              PERFORM bdc_transaction USING 'VL01'.
              PERFORM msg_get  TABLES it_msg.
              CLEAR wa_final.
              REFRESH it_msg.
            ENDLOOP.
            PERFORM disp_msg.
          ENDIF.
      ENDCASE.
    ENDFORM.                    "CHECKED
    *&      Form  BDC_DYNPRO
          text
         -->P_0443   text
         -->P_0444   text
    FORM bdc_dynpro  USING    value(p_0443)
                              value(p_0444).
      wa_bdc-program = p_0443.
      wa_bdc-dynpro =  p_0444.
      wa_bdc-dynbegin = 'X'.
      APPEND wa_bdc TO it_bdc.
      CLEAR wa_bdc.
    ENDFORM.                    " BDC_DYNPRO
    *&      Form  BDC_FIELD
          text
         -->P_0448   text
         -->P_0449   text
    FORM bdc_field  USING    value(p_0448)
                             value(p_0449).
      wa_bdc-fnam = p_0448.
      wa_bdc-fval =  p_0449.
      APPEND wa_bdc TO it_bdc.
      CLEAR wa_bdc.
    ENDFORM.                    " BDC_FIELD
    *&      Form  BDC_TRANSACTION
          text
         -->P_0508   text
    FORM bdc_transaction  USING    value(p_0508).
      CALL TRANSACTION p_0508 USING it_bdc
                           MODE 'N'
                           UPDATE 'S'
                           MESSAGES INTO it_msg.
    ENDFORM.                    " BDC_TRANSACTION
    *&      Form  msg_get
          text
         -->P_IT_MSG  text
    FORM msg_get  TABLES   p_it_msg STRUCTURE bdcmsgcoll.
      LOOP AT p_it_msg INTO wa_msg.
        v_msgid = wa_msg-msgid.
        v_msgnr = wa_msg-msgnr.
        v_msgv1 = wa_msg-msgv1.
        v_msgv2 = wa_msg-msgv2.
        v_msgv3 = wa_msg-msgv3.
        v_msgv4 = wa_msg-msgv4.
        IF wa_msg-msgtyp = 'E' OR
           wa_msg-msgtyp = 'A' OR
           wa_msg-msgtyp = 'X'.
          PERFORM build_msg USING v_msgid
                            v_msgnr
                            v_msgv1
                            v_msgv2
                            v_msgv3
                            v_msgv4
                      CHANGING msg_text_e.
      Build the text for successful records getting created
        ELSEIF wa_msg-msgtyp = 'S' OR
               wa_msg-msgtyp = 'W' OR
               wa_msg-msgtyp = 'I'.
          PERFORM build_msg USING v_msgid
                                  v_msgnr
                                  v_msgv1
                                  v_msgv2
                                  v_msgv3
                                  v_msgv4
                             CHANGING msg_text_s.
        ENDIF.
      ENDLOOP.
    ENDFORM.                    " msg_get
    *&      Form  build_msg
          text
         -->P_V_MSGID  text
         -->P_V_MSGNR  text
         -->P_V_MSGV1  text
         -->P_V_MSGV2  text
         -->P_V_MSGV3  text
         -->P_V_MSGV4  text
         <--P_MSG_TEXT_E  text
    FORM build_msg  USING    p_v_msgid
                             p_v_msgnr
                             p_v_msgv1
                             p_v_msgv2
                             p_v_msgv3
                             p_v_msgv4
                    CHANGING p_msg_text_s.
      CALL FUNCTION 'TB_MESSAGE_BUILD_TEXT'
        EXPORTING
          langu = sy-langu
          msgid = p_v_msgid
          msgno = p_v_msgnr " wa_msgcoll-msgnr
          msgv1 = p_v_msgv1
          msgv2 = p_v_msgv2
          msgv3 = p_v_msgv3
          msgv4 = p_v_msgv4
        IMPORTING
          text  = p_msg_text_s.
      wa_mess-v_msg = p_msg_text_s .
      APPEND wa_mess TO i_mess.
      CLEAR wa_mess.
    ENDFORM.                    " build_msg
    *&      Form  disp_msg
          text
    -->  p1        text
    <--  p2        text
    FORM disp_msg .
      PERFORM build_fieldcat_secandary.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          i_callback_program       = sy-repid
          i_callback_pf_status_set = 'BCD'
          it_fieldcat              = i_fldcat1
          i_callback_user_command  = 'SECANDARY'
        TABLES
          t_outtab                 = i_mess
        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.                    " disp_msg
    *&      Form  build_fieldcat_secandary
          text
    -->  p1        text
    <--  p2        text
    FORM build_fieldcat_secandary .
      wa_fldcat1-col_pos = '1'.
      wa_fldcat1-fieldname = 'V_MSG'.
      wa_fldcat1-tabname = 'I_MESS'.
      wa_fldcat1-seltext_m     = 'MESSAGE'.
      APPEND wa_fldcat1 TO i_fldcat1.
    ENDFORM.                    " build_fieldcat_secandary
    *&      Form  SECANDARY
          text
         -->R_UCOMM    text
    FORM secandary USING r_ucomm LIKE sy-ucomm rs_selfield TYPE slis_selfield.
      CASE r_ucomm.
        WHEN 'BCK'.
          LEAVE TO SCREEN 0.
      ENDCASE.
    ENDFORM.                    "SECANDARY
    *&      Form  ABC
          text
         -->EXTAB      text
    FORM bcd USING extab TYPE slis_t_extab.
      SET PF-STATUS 'BCD'. " excluding extab.
    ENDFORM.                    "ABC
    Hope this will help you,
    Murthy.

Maybe you are looking for