UI5 Table control Cellclick event exception

Hi,
I have rendered "Table" control with the data. After populating the data when I clicked on Table Cell getting the below error in the Chrome browser console. (In the code I haven't hook CellClick event to the table control)
Uncaught Error: Syntax error, unrecognized expression: unsupported pseudo: tabbable sap-ui-core.js:27
i4.errorsap-ui-core.js:27
i4.selectors.filter.PSEUDOsap-ui-core.js:27
y4sap-ui-core.js:27
i4.compilesap-ui-core.js:27
B4sap-ui-core.js:27
i4sap-ui-core.js:27
$.findjquery-mobile-custom.js:15
$.find.matchesSelectorjquery-mobile-custom.js:15
Q.extend.filtersap-ui-core.js:27
A1sap-ui-core.js:27
Q.fn.extend.filtersap-ui-core.js:27
sap.ui.table.Table._enterActionModeTable.js:107
sap.ui.table.Table.onmouseupTable.js:70
a._callEventHandlessap-ui-core.js:134
a._handleEventsap-ui-core.js:134
U._handleEventsap-ui-core.js:134
psap-ui-core.js:16
Q.event.dispatchsap-ui-core.js:27
v3.handle
When I tried to add the attachCellClick event to the table control getting the following error, and data also not populating.
Uncaught TypeError: Object [object Object] has no method 'attachCellClick' First.view.js:66
sap.ui.jsview.createContentFirst.view.js:66
(anonymous function)JSView.js:6
d.runWithPreprocessorssap-ui-core.js:134
sap.ui.core.mvc.JSView.onControllerConnectedJSView.js:6
sap.ui.core.mvc.View._initCompositeSupportView.js:6
E.extend.constructorsap-ui-core.js:134
M.extend.constructorsap-ui-core.js:134
E.extend.constructorsap-ui-core.js:134
fsap-ui-core.js:122
fsap-ui-core.js:122
osap-ui-core.js:116
sap.ui.viewView.js:6
o.(anonymous function)sap-ui-core.js:116
(anonymous function)
Can someone advice on this.
Thanks,
Rakesh

Hi,
There's no cellClick event in Table, because of which you are getting the error.
Regards,
Kiran

Similar Messages

  • DS1.3 : SDK UI5 Table Control with Column Grouping

    Hello,
    Have anybody successfully implemented the "grouped" property of "sap.ui.table.Column" in Design Studio 1.3? This property seems to fail the complete page load.
    We are on Design Studio 1.3 SP01.
    Thanks
    Arun

    Hello,
    I think you need to attach the output of your table to the input of the form that contains your button, so that this form "is aware" that you have changed the selected line.
    Then you assign an action to the mapping and to the column so that when you click on a line of the table it "calls" the form.
    You can give it a try, but I'm not sure of this.
    Fabien.

  • Mouse down event handling of table control in subvi

    Hello Everyone.......
    I have created a vi which has a table control and xy graph... the function of the vi is to plot the data of two particular column of table into xy-graph after user selects the data from table....  In this vi , I have used mouse down event for selecting data set so that the color of selected row get changed for user reference.......  the vi is working fine..... 
    My problem is that this vi is a part of main vi.. and I want to use this vi as a subvi.... So, in my main vi I have a table control which is connected as input to the subvi...  I come to know that I need to register event for triggering a event in a subvi.......
    (1) How to register Mouse down event of table control which is on Main Vi to trigger mouse down event of table in subvi.... Another Important thing is... how to link every property of table control of subvi to the table control of main vi... so it just act as single control adapting every property like when user selects a particular row its color changes in subvi....so it should be reflected even if user selects a row in main vi... I mean table control of main vi and subvi should be a single control...is it possible?
    I hope I am clear......Thanks ..

    See the modified version of the VI. I use the 'Point to Row Column' method to get the cell that was clicked on - your method also worked using 'Selection Start' but I thought I'd show you an alternative.
    I've used a single event structure to update two table controls - the point is that if you have the references to the controls you can update the control from anywhere. You can also 'register for events' to allow you to register for events from a different VI (again, using the references) that doesn't have the control on the front panel.
    Couple of things about your VI:
    You don't need to put a wait node if you have a timeout on your event structure.
    You don't need the for loop for the columns/rows - if you look at the help for the 'Active Cell' property you can use a value of -2 for the row/column to select all cells in the row/column.
    Certified LabVIEW Architect, Certified TestStand Developer
    NI Days (and A&DF): 2010, 2011, 2013, 2014
    NI Week: 2012, 2014
    Knowledgeable in all things Giant Tetris and WebSockets
    Attachments:
    Highlight Selected Row in Table Control_lv2009.vi ‏13 KB

  • The PAI Event Code to search for a record in Table Control

    Logic
    1. I have a position button and entry text field (search content) for a table control in my screen. Position button has the function code 'PBUT'.
    2. Content of table control will be in an internal table. The entry text field  is to be used for positioning.
    3. I enter the search (key) field in text field & Click the position button.
    4. The PAI event of button click (Module user_command) of that screen is as under.
    Case sy_ucomm.
    When 'PBUT'.
    What will be the code to bring the row as selected in table control, that I have to write here, for this case-value.
    Endcase.
    Regards,

    Hi Alok,
    Excuse me, couldn`t catch u yesterday. Ok i`ve the code which will set the cursor on the selected entry.
    Reward points if convinced.
    *& Report  Y131_TC_TEST                                                *
    REPORT  y131_tc_test NO STANDARD PAGE HEADING.
    TABLES: vbak.
    DATA : BEGIN OF str_tc,
           vbeln LIKE vbak-vbeln,
           erdat LIKE vbak-erdat,
           END OF str_tc,
           it_tc LIKE TABLE OF str_tc WITH HEADER LINE,
           loopc LIKE sy-loopc,
           flag,
           lin TYPE i.
    CONTROLS : my_tc TYPE TABLEVIEW USING SCREEN 9000.
    CALL SCREEN 9000.
    *&      Module  STATUS_9000  OUTPUT
    *       text
    MODULE status_9000 OUTPUT.
    *  SET PF-STATUS 'xxxxxxxx'.
    *  SET TITLEBAR 'xxx'.
      IF it_tc[] IS INITIAL.
        SELECT vbeln erdat INTO TABLE it_tc UP TO 10
        ROWS FROM vbak.
        DESCRIBE TABLE it_tc LINES lin.
        my_tc-top_line = loopc.
      ENDIF.
    ENDMODULE.                 " STATUS_9000  OUTPUT
    *&      Module  USER_COMMAND_9000  INPUT
    *       text
    MODULE user_command_9000 INPUT.
      CASE sy-ucomm.
        WHEN 'EXIT'.
          LEAVE PROGRAM.
       <b> WHEN 'PBUT'.</b>
    **** Now this event is triggerred when the user uses the ****Position Push button to locate the field value.
          CALL SCREEN 9001 STARTING AT 10 15.
      ENDCASE.
    ENDMODULE.                 " USER_COMMAND_9000  INPUT
    *&      Module  USER_COMMAND_9001  INPUT
    *       text
    MODULE user_command_9001 INPUT.
      CASE sy-ucomm.
        WHEN 'OKAY' OR ' ' or 'EXIT'.
    <b>**** When the user selects values from the search help on **** position button, the itab is read and index is *****assigned</b>
          READ TABLE it_tc WITH KEY vbeln = vbak-vbeln.
          IF sy-subrc = 0.
            loopc = sy-tabix.
            flag = 'X'.
    **** the cursor is set here
           <b> my_tc-top_line = loopc.</b>
             SET SCREEN 0.
          LEAVE SCREEN.
          ENDIF.
      ENDCASE.
    ENDMODULE.                 " USER_COMMAND_9001  INPUT
    *&      Module  STATUS_9001  OUTPUT
    *       text
    MODULE status_9001 OUTPUT.
      SET PF-STATUS 'MODAL'.
    *  SET TITLEBAR 'xxx'.
    ENDMODULE.                 " STATUS_9001  OUTPUT
    Regards

  • Reg: table control values to be updated during POV event

    Hi all,
          i need to design the screen for table control. which should contain Four input fields and input should be selected by F4 help. So i have used POV event to handle this. Once the user selected values from the F4 help, Immediately it has to populate the Table control fields based on input selection. I have tried several ways but it was not successful.
    Please help me regarding this will be appreciated .
    Regards,
    Sreenivasa Sarma K.

    Hi,
    Make use of the 'SEARCH HELP' property of the fields in the table control.
    Just get the search help names for those 4 fields and place it to this property.
    Also change the 'Poss. Entries Key' property as 1 or 2.
    Regards,
    R.Nagarajan.

  • Use of loops in pbo and pai events when a table control is on the screen

    asap.

    Hi Feroz,
              What is the very purpose of using table controls and tab strips in module pool programming.
    Rgds,
    kha

  • Regarding PAI event display of data in table control

    Hi all,
    I have a drop down list in my module pool screen and based on my selection the value in not getting captured as i have to display table control data (or item level data ) based on the delivery that is selected from the drop down.
    The first level of items are getting displayed in the table control for the first time but after i select the delivery for the next time no delivery is getting captured in the screen field and so on no items are getting changed in the table control.
    Pls let me know how to capture the delivery number selected from the drop down list box and so on i can write the code for displaying the new set of items in the table control for the new delivery number selected.
    Thankyou for your help.
    Amar.

    Hi All,
    I have solved my problum of getting the values in the drop down list using the function module vrm_set_values.
    Earlier it dint capture the values in the list because i am not aware of the key field its having apart from the text field.
    I have passed some numberic value to the key field earlier and the actual text to be displayed in the TEXT field.
    Anyways i came to know that we need to pass the same field values in both key field and text field only then the values wud be captured. So my problum is solved.
    I have another question on the same now
    My requirement is on selecting a value in the dropdown list the delivery items shud come in the dropdown list which is coming.
    I have another drop down in the item level so i wrote the vrm set values in the item level for one field based on that value the other fields in the table control needs to get data.
    I have provided the drop down item level field also but the problum is let us say we have 3 items and in the table control has 15 items that can be displayed. The dropdown for that field shud come only upto 3 records but it is coming for the entire column as the screen field name is same for the entire column.
    example
    f1   f2  f3 are the fields
    and the table control can accomodate 10 records
    Let us say we have 3 line items
    now the drop down is appearing for all the 15 records for field f2 where it shud appear for only  3 records.
    pls let me know if there any option in such a way that we can restrict upto 3 records.
    Thanks in advance.
    Amar.

  • Baffling Table Control

    Hi,
    Currently using SAP 4.7 SAPKB62011
    The need was to develop a program, which based on a selection-criteria displays a table(editable) and some changes will be done in the table and data should get saved.
    The best approach I assumed was to
    a) Create a report, define the selection screen parameters
    b) Do validation in at selection-screen
    c) If all validations are proper, select values to be shown in table control
    d) call screen 9000
    Everything is working perfectly, except for adding new lines in table control.
    When I execute select query in AT SELECTION-SCREEN event before calling the screen 9000, then I am not able to add values to table control.
    But if I put the select query in the PBO of screen 9000, I am able to add new values. Only those values which are already present in table control can be changed. I am not able to add any new entries.
    In my opinion, there should not be a select query in PBO, because that query would hit the database in all possible events.
    Any particular reason, why.
    <b>AT SELECTION-SCREEN code</b>
    AT SELECTION-SCREEN.
      CASE sy-ucomm.
        WHEN 'ONLI'.
          lv_pernr = p_pernr.
          lv_lifnr = p_lifnr.
    *      SELECT *
    *        FROM zpersoninfo
    *        INTO TABLE lt_zpersoninfo
    *       WHERE personno = lv_pernr.
    *      IF sy-subrc <> 0.
    *      ENDIF.
    *      APPEND INITIAL LINE TO LT_ZPERSONINFO.
          CALL SCREEN 9000.
      ENDCASE.
    <b>Dynpro code</b>
    PROCESS BEFORE OUTPUT.
      MODULE pbo_9000.
    LOOP AT lt_zpersoninfo INTO zpersoninfo WITH CONTROL tablecontrol CURSOR
    tablecontrol-current_line.
        MODULE pbo_tc_9000.
      ENDLOOP.
    PROCESS AFTER INPUT.
      LOOP.
        MODULE pai_tc_9000.
      ENDLOOP.
      MODULE pai_9000.
    <b>PBO_9000</b>
    MODULE pbo_9000 OUTPUT.
      SET PF-STATUS lv_pfstatus.
      pa0315-pernr = lv_pernr.
      SELECT *
        FROM zpersoninfo
        INTO TABLE lt_zpersoninfo
       WHERE personno = lv_pernr.
      IF sy-subrc <> 0.
      ENDIF.
      APPEND INITIAL LINE TO LT_ZPERSONINFO.
    ENDMODULE.                 " PBO_9000  OUTPUT
    <b>PBO 9000 - Table Control Code</b>
    MODULE pbo_tc_9000 OUTPUT.
      LOOP AT SCREEN.
        IF lv_pfstatus = 'DISPLAY'.
          CASE screen-name.
            WHEN 'ZPERSONINFO-SERVICENO'.
              screen-input = '1'.
              screen-active = '1'.
            WHEN 'ZPERSONINFO-MANDATORY'.
              screen-input = '1'.
              screen-active = '1'.
          ENDCASE.
        ELSEIF lv_pfstatus = 'CHANGE'.
          CASE screen-name.
            WHEN 'ZPERSONINFO-SERVICENO'.
              screen-input = '0'.
            WHEN 'ZPERSONINFO-MANDATORY'.
              screen-input = '0'.
          ENDCASE.
        ENDIF.
        MODIFY SCREEN.
      ENDLOOP.
    ENDMODULE.
    Let me know if I have skipped some information, which you may find it useful to find the solution.
    Regards,
    Subramanian V.

    That is because I didn't upate the 'LINES' field in tablecontrol. How silly !!
    Regards,
    Subramanian V.

  • Need help in creating a dropdown box inside a table control

    Hi,
    I need to display a calender upon click event of a dropdown box placed inside my table control.
    Can any body help me out.
    Regards,
    Srinivas

    Try this ex
    TYPE-POOLS VRM.
    VALUES-KEY = 'D'.
      VALUES-TEXT = 'Double Crate'.
      APPEND VALUES.
      VALUES-KEY = 'S'.
      VALUES-TEXT = 'Single Crate'.
      APPEND VALUES.
      VALUES-KEY = 'C'.
      VALUES-TEXT = 'Carton Box'.
      APPEND VALUES.
      VALUES-KEY = 'P'.
      VALUES-TEXT = 'Pallet'.
      APPEND VALUES.
      VALUES-KEY = 'W'.
      VALUES-TEXT = 'Wood.Case'.
      APPEND VALUES.
      VALUES-KEY = 'L'.
      VALUES-TEXT = 'Loose'.
      APPEND VALUES.
      CLEAR VALUES.
      CALL FUNCTION 'VRM_SET_VALUES'
         EXPORTING
           ID                    = 'CRTYPE'
           VALUES                = VALUES[]
        EXCEPTIONS
          ID_ILLEGAL_NAME       = 1
          OTHERS                = 2
    hope it helps..
    Edited by: prabhu p on May 22, 2008 10:55 AM

  • 'how to code for table control wizard in module pool program

    Hi Gurus,
    Please provide me a sample code of table control wizard...
    Thanks in advance!!!!
    Regards,
    Kranthi

    Hi Kranti,
    check this code... it should be helpful
    *& Module pool       Z_TABLE_CONTROL_WIZARD_DEMO                       *
    PROGRAM  z_table_control_wizard_demo             .
    DATA: BEGIN OF lt_vbak OCCURS 0,
           flag  TYPE c,
           vbeln TYPE vbeln_va,
           netwr TYPE netwr,
           kunnr TYPE kunnr,
          END OF lt_vbak.
    DATA: sfkunnr TYPE kunnr.
    *&spwizard: declaration of tablecontrol 'TCONTROL' itself
    CONTROLS: tcontrol TYPE TABLEVIEW USING SCREEN 9000.
    *&spwizard: lines of tablecontrol 'TCONTROL'
    DATA:     g_tcontrol_lines  LIKE sy-loopc.
    DATA:     ok_code LIKE sy-ucomm.
    *&spwizard: output module for tc 'TCONTROL'. do not change this line!
    *&spwizard: update lines for equivalent scrollbar
    MODULE tcontrol_change_tc_attr OUTPUT.
      DESCRIBE TABLE lt_vbak LINES tcontrol-lines.
    ENDMODULE.                    "TCONTROL_change_tc_attr OUTPUT
    *&spwizard: output module for tc 'TCONTROL'. do not change this line!
    *&spwizard: get lines of tablecontrol
    MODULE tcontrol_get_lines OUTPUT.
      g_tcontrol_lines = sy-loopc.
    ENDMODULE.                    "TCONTROL_get_lines OUTPUT
    *&spwizard: input module for tc 'TCONTROL'. do not change this line!
    *&spwizard: modify table
    MODULE tcontrol_modify INPUT.
      MODIFY lt_vbak
        INDEX tcontrol-current_line.
    ENDMODULE.                    "TCONTROL_modify INPUT
    *&spwizard: input modul for tc 'TCONTROL'. do not change this line!
    *&spwizard: mark table
    MODULE tcontrol_mark INPUT.
      DATA: g_tcontrol_wa2 LIKE LINE OF lt_vbak.
      IF tcontrol-line_sel_mode = 1.
        LOOP AT lt_vbak INTO g_tcontrol_wa2
          WHERE flag = 'X'.
          g_tcontrol_wa2-flag = ''.
          MODIFY lt_vbak
            FROM g_tcontrol_wa2
            TRANSPORTING flag.
        ENDLOOP.
      ENDIF.
      MODIFY lt_vbak
        INDEX tcontrol-current_line
        TRANSPORTING flag.
    ENDMODULE.                    "TCONTROL_mark INPUT
    *&spwizard: input module for tc 'TCONTROL'. do not change this line!
    *&spwizard: process user command
    MODULE tcontrol_user_command INPUT.
      ok_code = sy-ucomm.
      PERFORM user_ok_tc USING    'TCONTROL'
                                  'LT_VBAK'
                                  'FLAG'
                         CHANGING ok_code.
      sy-ucomm = ok_code.
    ENDMODULE.                    "TCONTROL_user_command INPUT
    *   INCLUDE TABLECONTROL_FORMS                                         *
    *&      Form  USER_OK_TC                                               *
    FORM user_ok_tc USING    p_tc_name TYPE dynfnam
                             p_table_name
                             p_mark_name
                    CHANGING p_ok      LIKE sy-ucomm.
    *&SPWIZARD: BEGIN OF LOCAL DATA----------------------------------------*
      DATA: l_ok              TYPE sy-ucomm,
            l_offset          TYPE i.
    *&SPWIZARD: END OF LOCAL DATA------------------------------------------*
    *&SPWIZARD: Table control specific operations                          *
    *&SPWIZARD: evaluate TC name and operations                            *
      SEARCH p_ok FOR p_tc_name.
      IF sy-subrc <> 0.
        EXIT.
      ENDIF.
      l_offset = STRLEN( p_tc_name ) + 1.
      l_ok = p_ok+l_offset.
    *&SPWIZARD: execute general and TC specific operations                 *
      CASE l_ok.
        WHEN 'INSR'.                      "insert row
          PERFORM fcode_insert_row USING    p_tc_name
                                            p_table_name.
          CLEAR p_ok.
        WHEN 'DELE'.                      "delete row
          PERFORM fcode_delete_row USING    p_tc_name
                                            p_table_name
                                            p_mark_name.
          CLEAR p_ok.
        WHEN 'P--' OR                     "top of list
             'P-'  OR                     "previous page
             'P+'  OR                     "next page
             'P++'.                       "bottom of list
          PERFORM compute_scrolling_in_tc USING p_tc_name
                                                l_ok.
          CLEAR p_ok.
    *     WHEN 'L--'.                       "total left
    *       PERFORM FCODE_TOTAL_LEFT USING P_TC_NAME.
    *     WHEN 'L-'.                        "column left
    *       PERFORM FCODE_COLUMN_LEFT USING P_TC_NAME.
    *     WHEN 'R+'.                        "column right
    *       PERFORM FCODE_COLUMN_RIGHT USING P_TC_NAME.
    *     WHEN 'R++'.                       "total right
    *       PERFORM FCODE_TOTAL_RIGHT USING P_TC_NAME.
        WHEN 'MARK'.                      "mark all filled lines
          PERFORM fcode_tc_mark_lines USING p_tc_name
                                            p_table_name
                                            p_mark_name   .
          CLEAR p_ok.
        WHEN 'DMRK'.                      "demark all filled lines
          PERFORM fcode_tc_demark_lines USING p_tc_name
                                              p_table_name
                                              p_mark_name .
          CLEAR p_ok.
    *     WHEN 'SASCEND'   OR
    *          'SDESCEND'.                  "sort column
    *       PERFORM FCODE_SORT_TC USING P_TC_NAME
    *                                   l_ok.
      ENDCASE.
    ENDFORM.                              " USER_OK_TC
    *&      Form  FCODE_INSERT_ROW                                         *
    FORM fcode_insert_row
                  USING    p_tc_name           TYPE dynfnam
                           p_table_name             .
    *&SPWIZARD: BEGIN OF LOCAL DATA----------------------------------------*
      DATA l_lines_name       LIKE feld-name.
      DATA l_selline          LIKE sy-stepl.
      DATA l_lastline         TYPE i.
      DATA l_line             TYPE i.
      DATA l_table_name       LIKE feld-name.
      FIELD-SYMBOLS <tc>                 TYPE cxtab_control.
      FIELD-SYMBOLS <table>              TYPE STANDARD TABLE.
      FIELD-SYMBOLS <lines>              TYPE i.
    *&SPWIZARD: END OF LOCAL DATA------------------------------------------*
      ASSIGN (p_tc_name) TO <tc>.
    *&SPWIZARD: get the table, which belongs to the tc                     *
      CONCATENATE p_table_name '[]' INTO l_table_name. "table body
      ASSIGN (l_table_name) TO <table>.                "not headerline
    *&SPWIZARD: get looplines of TableControl                              *
      CONCATENATE 'G_' p_tc_name '_LINES' INTO l_lines_name.
      ASSIGN (l_lines_name) TO <lines>.
    *&SPWIZARD: get current line                                           *
      GET CURSOR LINE l_selline.
      IF sy-subrc <> 0.                   " append line to table
        l_selline = <tc>-lines + 1.
    *&SPWIZARD: set top line                                               *
        IF l_selline > <lines>.
          <tc>-top_line = l_selline - <lines> + 1 .
        ELSE.
          <tc>-top_line = 1.
        ENDIF.
      ELSE.                               " insert line into table
        l_selline = <tc>-top_line + l_selline - 1.
        l_lastline = <tc>-top_line + <lines> - 1.
      ENDIF.
    *&SPWIZARD: set new cursor line                                        *
      l_line = l_selline - <tc>-top_line + 1.
    *&SPWIZARD: insert initial line                                        *
      INSERT INITIAL LINE INTO <table> INDEX l_selline.
      <tc>-lines = <tc>-lines + 1.
    *&SPWIZARD: set cursor                                                 *
      SET CURSOR LINE l_line.
    ENDFORM.                              " FCODE_INSERT_ROW
    *&      Form  FCODE_DELETE_ROW                                         *
    FORM fcode_delete_row
                  USING    p_tc_name           TYPE dynfnam
                           p_table_name
                           p_mark_name   .
    *&SPWIZARD: BEGIN OF LOCAL DATA----------------------------------------*
      DATA l_table_name       LIKE feld-name.
      FIELD-SYMBOLS <tc>         TYPE cxtab_control.
      FIELD-SYMBOLS <table>      TYPE STANDARD TABLE.
      FIELD-SYMBOLS <wa>.
      FIELD-SYMBOLS <mark_field>.
    *&SPWIZARD: END OF LOCAL DATA------------------------------------------*
      ASSIGN (p_tc_name) TO <tc>.
    *&SPWIZARD: get the table, which belongs to the tc                     *
      CONCATENATE p_table_name '[]' INTO l_table_name. "table body
      ASSIGN (l_table_name) TO <table>.                "not headerline
    *&SPWIZARD: delete marked lines                                        *
      DESCRIBE TABLE <table> LINES <tc>-lines.
      LOOP AT <table> ASSIGNING <wa>.
    *&SPWIZARD: access to the component 'FLAG' of the table header         *
        ASSIGN COMPONENT p_mark_name OF STRUCTURE <wa> TO <mark_field>.
        IF <mark_field> = 'X'.
          DELETE <table> INDEX syst-tabix.
          IF sy-subrc = 0.
            <tc>-lines = <tc>-lines - 1.
          ENDIF.
        ENDIF.
      ENDLOOP.
    ENDFORM.                              " FCODE_DELETE_ROW
    *&      Form  COMPUTE_SCROLLING_IN_TC
    *       text
    *      -->P_TC_NAME  name of tablecontrol
    *      -->P_OK       ok code
    FORM compute_scrolling_in_tc USING    p_tc_name
                                          p_ok.
    *&SPWIZARD: BEGIN OF LOCAL DATA----------------------------------------*
      DATA l_tc_new_top_line     TYPE i.
      DATA l_tc_name             LIKE feld-name.
      DATA l_tc_lines_name       LIKE feld-name.
      DATA l_tc_field_name       LIKE feld-name.
      FIELD-SYMBOLS <tc>         TYPE cxtab_control.
      FIELD-SYMBOLS <lines>      TYPE i.
    *&SPWIZARD: END OF LOCAL DATA------------------------------------------*
      ASSIGN (p_tc_name) TO <tc>.
    *&SPWIZARD: get looplines of TableControl                              *
      CONCATENATE 'G_' p_tc_name '_LINES' INTO l_tc_lines_name.
      ASSIGN (l_tc_lines_name) TO <lines>.
    *&SPWIZARD: is no line filled?                                         *
      IF <tc>-lines = 0.
    *&SPWIZARD: yes, ...                                                   *
        l_tc_new_top_line = 1.
      ELSE.
    *&SPWIZARD: no, ...                                                    *
        CALL FUNCTION 'SCROLLING_IN_TABLE'
             EXPORTING
                  entry_act             = <tc>-top_line
                  entry_from            = 1
                  entry_to              = <tc>-lines
                  last_page_full        = 'X'
                  loops                 = <lines>
                  ok_code               = p_ok
                  overlapping           = 'X'
             IMPORTING
                  entry_new             = l_tc_new_top_line
             EXCEPTIONS
    *              NO_ENTRY_OR_PAGE_ACT  = 01
    *              NO_ENTRY_TO           = 02
    *              NO_OK_CODE_OR_PAGE_GO = 03
                  OTHERS                = 0.
      ENDIF.
    *&SPWIZARD: get actual tc and column                                   *
      GET CURSOR FIELD l_tc_field_name
                 AREA  l_tc_name.
      IF syst-subrc = 0.
        IF l_tc_name = p_tc_name.
    *&SPWIZARD: et actual column                                           *
          SET CURSOR FIELD l_tc_field_name LINE 1.
        ENDIF.
      ENDIF.
    *&SPWIZARD: set the new top line                                       *
      <tc>-top_line = l_tc_new_top_line.
    ENDFORM.                              " COMPUTE_SCROLLING_IN_TC
    *&      Form  FCODE_TC_MARK_LINES
    *       marks all TableControl lines
    *      -->P_TC_NAME  name of tablecontrol
    FORM fcode_tc_mark_lines USING p_tc_name
                                   p_table_name
                                   p_mark_name.
    *&SPWIZARD: EGIN OF LOCAL DATA-----------------------------------------*
      DATA l_table_name       LIKE feld-name.
      FIELD-SYMBOLS <tc>         TYPE cxtab_control.
      FIELD-SYMBOLS <table>      TYPE STANDARD TABLE.
      FIELD-SYMBOLS <wa>.
      FIELD-SYMBOLS <mark_field>.
    *&SPWIZARD: END OF LOCAL DATA------------------------------------------*
      ASSIGN (p_tc_name) TO <tc>.
    *&SPWIZARD: get the table, which belongs to the tc                     *
      CONCATENATE p_table_name '[]' INTO l_table_name. "table body
      ASSIGN (l_table_name) TO <table>.                "not headerline
    *&SPWIZARD: mark all filled lines                                      *
      LOOP AT <table> ASSIGNING <wa>.
    *&SPWIZARD: access to the component 'FLAG' of the table header         *
        ASSIGN COMPONENT p_mark_name OF STRUCTURE <wa> TO <mark_field>.
        <mark_field> = 'X'.
      ENDLOOP.
    ENDFORM.                                          "fcode_tc_mark_lines
    *&      Form  FCODE_TC_DEMARK_LINES
    *       demarks all TableControl lines
    *      -->P_TC_NAME  name of tablecontrol
    FORM fcode_tc_demark_lines USING p_tc_name
                                     p_table_name
                                     p_mark_name .
    *&SPWIZARD: BEGIN OF LOCAL DATA----------------------------------------*
      DATA l_table_name       LIKE feld-name.
      FIELD-SYMBOLS <tc>         TYPE cxtab_control.
      FIELD-SYMBOLS <table>      TYPE STANDARD TABLE.
      FIELD-SYMBOLS <wa>.
      FIELD-SYMBOLS <mark_field>.
    *&SPWIZARD: END OF LOCAL DATA------------------------------------------*
      ASSIGN (p_tc_name) TO <tc>.
    *&SPWIZARD: get the table, which belongs to the tc                     *
      CONCATENATE p_table_name '[]' INTO l_table_name. "table body
      ASSIGN (l_table_name) TO <table>.                "not headerline
    *&SPWIZARD: demark all filled lines                                    *
      LOOP AT <table> ASSIGNING <wa>.
    *&SPWIZARD: access to the component 'FLAG' of the table header         *
        ASSIGN COMPONENT p_mark_name OF STRUCTURE <wa> TO <mark_field>.
        <mark_field> = space.
      ENDLOOP.
    ENDFORM.                                          "fcode_tc_mark_lines
    *&      Module  STATUS_9000  OUTPUT
    *       text
    MODULE status_9000 OUTPUT.
      SET PF-STATUS 'S9000'.
      SET TITLEBAR 'T9000'.
    ENDMODULE.                 " STATUS_9000  OUTPUT
    *&      Module  USER_COMMAND_9000  INPUT
    *       text
    MODULE user_command_9000 INPUT.
      CASE sy-ucomm.
        WHEN 'BACK' OR 'EXIT' OR 'CANCEL'.
          LEAVE TO SCREEN 0.
        WHEN 'DISP'.
          SELECT vbeln netwr kunnr INTO CORRESPONDING FIELDS OF TABLE lt_vbak
          FROM vbak
          WHERE kunnr = sfkunnr.
    *    LEAVE TO LIST-PROCESSING [AND RETURN TO SCREEN <nnnn>].
    *    By default, the dialog processor returns to the PBO processing of
    *    the screen from which the list processor was called. The optional
    *    addition AND RETURN TO SCREEN allows you to specify a different
    *    screen in the current screen sequence at whose PBO event you want
    *    to resume processing.
        when 'LIST'.
        LEAVE TO LIST-PROCESSING.
        WRITE:/ 'Time  :', SY-UZEIT.
        LOOP AT LT_VBAK.
        WRITE:/ LT_VBAK-VBELN,
                LT_VBAK-NETWR,
                LT_VBAK-KUNNR.
        ENDLOOP.
        WHEN 'SUBM'.
    *& You can call executable programs from other ABAP programs using the
    *& following statement:
    *& SUBMIT <rep>|(<field>) [AND RETURN] [<options>].
          SUBMIT z_submit_report VIA SELECTION-SCREEN AND RETURN.
      ENDCASE.
    ENDMODULE.                 " USER_COMMAND_9000  INPUT
                                                     TABLE CONTROL WIZARD SE51 CODE
    PROCESS BEFORE OUTPUT.
    *&spwizard: pbo flow logic for tablecontrol 'TCONTROL'
      module TCONTROL_change_tc_attr.
    *&spwizard: module TCONTROL_change_col_attr.
      loop at   LT_VBAK
           with control TCONTROL
           cursor TCONTROL-current_line.
        module TCONTROL_get_lines.
    *&spwizard:   module TCONTROL_change_field_attr
      endloop.
    MODULE STATUS_9000.
    PROCESS AFTER INPUT.
    *&spwizard: pai flow logic for tablecontrol 'TCONTROL'
      loop at LT_VBAK.
        chain.
          field LT_VBAK-VBELN.
          field LT_VBAK-NETWR.
          field LT_VBAK-KUNNR.
          module TCONTROL_modify on chain-request.
        endchain.
        field LT_VBAK-FLAG
          module TCONTROL_mark on request.
      endloop.
      module TCONTROL_user_command.
    *&spwizard: module TCONTROL_change_tc_attr.
    *&spwizard: module TCONTROL_change_col_attr.
    MODULE USER_COMMAND_9000.
    regards
    padma

  • Upload text file from PC to table control

    Hi Experts,
    I realize that this question was posted many times in SDN, but I am not able to find a clear answer. I have uploaded the file into internal table using GUI_UPLOAD function module (PAI module - MODULE UPLOAD_FROM_PC - I have created a push button using screen painter and included the logic based of fcode). Now, I want to append this internal table to the internal table linked to the table control. But I am not able to find the internal table which is linked to the table control. The EXTRACT is not an internal table. So, could you tell me how I could accomplish this logic.
    PROCESS BEFORE OUTPUT.
      MODULE LISTE_INITIALISIEREN.
      LOOP AT EXTRACT WITH CONTROL TCTRL_ZKK_EXAMPLE1 CURSOR NEXTLINE.
        MODULE LISTE_SHOW_LISTE.
      ENDLOOP.
    PROCESS AFTER INPUT.
      MODULE LISTE_EXIT_COMMAND AT EXIT-COMMAND.
      MODULE LISTE_BEFORE_LOOP.
      LOOP AT EXTRACT.
        MODULE LISTE_INIT_WORKAREA.
        CHAIN.
          FIELD ZKK_EXAMPLE1-ANLKL .
          MODULE SET_UPDATE_FLAG ON CHAIN-REQUEST.
        ENDCHAIN.
        FIELD VIM_MARKED MODULE LISTE_MARK_CHECKBOX.
        CHAIN.
          FIELD ZKK_EXAMPLE1-ANLKL .
          MODULE LISTE_UPDATE_LISTE.
        ENDCHAIN.
      ENDLOOP.
      MODULE UPLOAD_FROM_PC.
      MODULE LISTE_AFTER_LOOP.
    Thanks
    Sri

    Hi
    First of all convert excel or text file into tabular format
    (meanse same as we use in BDC).
    here table I_EXCL structure is same as your table control structure.
    for ex.
    yr table control structure is
    u can write down this coding in yr button press event.
    data:begin of extract occurs 0,
            matnr like matnr,
           maktx like maktx,
         end of extract.
    data:i_excl like extract occurs 0 with header line.
    GET THE FILE PATH
    DATA:W_FILENAME LIKE RLGRAP-FILENAME.
    CLEAR:W_FILENAME,extract[].
    CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
    EXPORTING
       PROGRAM_NAME        = SYST-REPID
       DYNPRO_NUMBER       = SYST-DYNNR
      FIELD_NAME          = ' '
      STATIC              = ' '
      MASK                = ' '
      CHANGING
        FILE_NAME           = W_FILENAME
    EXCEPTIONS
       MASK_TOO_LONG       = 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.
    IF W_FILENAME IS NOT INITIAL.
    CONVERT EXCEL FILE INTO INTERNAL TABLE
    CLEAR:I_EXCL.
    CALL FUNCTION 'WS_UPLOAD'
    EXPORTING
      CODEPAGE                      = ' '
       FILENAME                      = W_FILENAME
       FILETYPE                      = 'DAT'
      HEADLEN                       = ' '
      LINE_EXIT                     = ' '
      TRUNCLEN                      = ' '
      USER_FORM                     = ' '
      USER_PROG                     = ' '
      DAT_D_FORMAT                  = ' '
    IMPORTING
      FILELENGTH                    =
      TABLES
        DATA_TAB                      = I_EXCL
    EXCEPTIONS
       CONVERSION_ERROR              = 1
       FILE_OPEN_ERROR               = 2
       FILE_READ_ERROR               = 3
       INVALID_TYPE                  = 4
       NO_BATCH                      = 5
       UNKNOWN_ERROR                 = 6
       INVALID_TABLE_WIDTH           = 7
       GUI_REFUSE_FILETRANSFER       = 8
       CUSTOMER_ERROR                = 9
       NO_AUTHORITY                  = 10
       OTHERS                        = 11
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    After this in PBO module u can write
    process before output
      MODULE TAB_ENTRY_CHANGE_TC_ATTR.
    MODULE TAB_ENTRY_CHANGE_TC_ATTR.
      loop at i_excl.
        extract-matnr  = i_excl-matnr.
        extract-maktx  = i_excl-maktx.
       append extract.
      endloop.
    endmodule.
    I hope this is helpfull to solve yr problem.
    Edited by: Pavan Gajjar on Mar 26, 2008 9:57 AM

  • How can we use TABLE CONTROL in BDC and WORK FLOW of ABAP.

    how can we use TABLE CONTROL in BDC and WORK FLOW of ABAP.?
    please explain the important questions.

    How to deal with table control / step loop in BDC
    Steploop and table contol is inevitable in certain transactions. When we run BDC for such transactions, we will face the situation: how many visible lines of steploop/tablecontrol are on the screen? Although we can always find certain method to deal with it, such as function code 'NP', 'POPO', considering some extreme situation: there is only one line visible one the screen, our BDC program should display an error message. (See transaction 'ME21', we you resize your screen to let only one row visible, you can not enter mutiple lines on this screen even you use 'NP')
    Now with the help of Poonam on sapfans.com developement forum, I find a method with which we can determine the number of visible lines on Transaction Screen from our Calling BDC program. Maybe it is useless to you, but I think it will give your some idea.
    Demo ABAP code has two purposes:
    1. how to determine number of visible lines and how to calculte page number;
    (the 'calpage' routine has been modify to meet general purpose usage)
    2. using field symbol in BDC program, please pay special attention to the difference in Static ASSIGN and Dynamic ASSIGN.
    Now I begin to describe the step to implement my method:
    (I use transaction 'ME21', screen 121 for sample,
    the method using is Call Transation Using..)
    Step1: go to screen painter to display the screen 121, then we can count the fixed line on this screen, there is 7 lines above the steploop and 2 lines below the steploop, so there are total 9 fixed lines on this screen. This means except these 9 lines, all the other line is for step loop. Then have a look at steploop itselp, one entry of it will occupy two lines.
    (Be careful, for table control, the head and the bottom scroll bar will possess another two fixed lines, and there is a maximum number for table line)
    Now we have : FixedLine = 9
                  LoopLine  = 2(for table control, LoopLine is always equal to 1)
    Step2: go to transaction itself(ME21) to see how it roll page, in ME21, the first line of new page is always occupied by the last line of last page, so it begin with index '02', but in some other case, fisrt line is empty and ready for input.
    Now we have: FirstLine = 0
              or FirstLine = 1 ( in our case, FirstLine is 1 because the first line of new page is fulfilled)
    Step3: write a subroutine calcalculating number of pages
    (here, the name of actual parameter is the same as formal parameter)
    global data:    FixedLine type i, " number of fixed line on a certain screen
                    LoopLine  type i, " the number of lines occupied by one steploop item
                    FirstLine type i, " possbile value 0 or 1, 0 stand for the first line of new                                                               " scrolling screen is empty, otherwise is 1
                    Dataline  type i, " number of items you will use in BDC, using DESCRIBE to get
                    pageno    type i, " you need to scroll screen how many times.
                    line      type i, " number of lines appears on the screen.
                    index(2)  type N, " the screen index for certain item
                    begin     type i, " from parameter of loop
                    end       type i. " to parameter of loop
    *in code sample, the DataTable-linindex stands for the table index number of this line
    form calpage using FixedLine type i (see step 1)
                       LoopLine  type i (see step 1)
                       FirstLine type i (see step 2)
                       DataLine  type i ( this is the item number you will enter in transaction)
              changing pageno    type i (return the number of page, depends on run-time visible                                                                             line in table control/ Step Loop)
              changing line      type i.(visible lines one the screen)
    data: midd type i,
          vline type i, "visible lines
    if DataLine eq 0.
       Message eXXX.
    endif.
    vline = ( sy-srows - FixedLine ) div LoopLine.
    *for table control, you should compare vline with maximum line of
    *table control, then take the small one that is min(vline, maximum)
    *here only illustrate step loop
    if FirstLine eq 0.
            pageno = DataLine div vline.
            if pageno eq 0.
               pageno = pageno + 1.
            endif.
    elseif FirstLine eq 1.
            pageno = ( DataLine - 1 ) div ( vline - 1 ) + 1.
            midd = ( DataLine - 1 ) mod ( vline - 1).
            if midd = 0 and DataLine gt 1.
                    pageno = pageno - 1.
            endif.
    endif.
    line = vline.
    endform.
    Step4 write a subroutine to calculate the line index for each item.
    form calindex using Line type i (visible lines on the screen)
                        FirstLine type i(see step 2)
                        LineIndex type i(item index)
              changing  Index type n.    (index on the screen)
      if  FirstLine = 0.
            index = LineIndex mod Line.
            if index = '00'.
                    index = Line.
            endif.
      elseif FirstLine = 1.
            index = LineIndex mod ( Line - 1 ).
            if ( index between 1 and 0 ) and LineIndex gt 1.
                    index = index + Line - 1.
            endif.
            if Line = 2.
                    index = index + Line - 1.
            endif.
    endif.
    endform.
    Step5 write a subroutine to calculate the loop range.
    form calrange using Line type i ( visible lines on the screen)
                        DataLine type i
                        FirstLine type i
                        loopindex like sy-index
            changing    begin type i
                        end type i.
    If FirstLine = 0.
       if loopindex = 1.
            begin = 1.
            if DataLine <= Line.
                    end = DataLine.
            else.
                    end = Line.
            endif.
       elseif loopindex gt 1.
            begin = Line * ( loopindex - 1 ) + 1.
            end   = Line * loopindex.
            if end gt DataLine.
               end = DataLine.
            endif.
       endif.
    elseif FirstLine = 1.
      if loopindex = 1.
            begin = 1.
            if DataLine <= Line.
                    end = DataLine.
            else.
                    end = Line.
            endif.
      elseif loop index gt 1.
            begin = ( Line - 1 ) * ( loopindex - 1 ) + 2.
            end =   ( Line - 1 ) * ( loopindex - 1 ) + Line.
            if end gt DataLine.
                    end = DataLine.
            endif.
      endif.
    endif.
    endform.
    Step6 using field sysbol in your BDC, for example: in ME21, but you should calculate each item will correponding to which index in steploop/Table Control
    form creat_bdc.
    field-symbols: <material>, <quan>, <indicator>.
    data: name1(14) value 'EKPO-EMATN(XX)',
          name2(14) value 'EKPO-MENGE(XX)',
          name3(15) value 'RM06E-SELKZ(XX)'.
    assign:         name1 to <material>,
                    name2 to <quan>,
                    name3 to <indicator>.
    do pageno times.
    if sy-index gt 1
    *insert scroll page ok_code"
    endif.
            perform calrange using Line DataLine FirstLine sy-index
                             changing begin end.
    loop at DataTable from begin to end.
            perform calindex using Line FirstLine DataTable-LineIndex changing Index.
            name1+11(2) = Index.
            name2+11(2) = Index.
            name3+12(2) = Index.
            perform bdcfield using <material> DataTable-matnr.
            perform bdcfield using <quan>     DataTable-menge.
            perform bdcfield using <indicator> DataTable-indicator.
    endloop.
    enddo.
    An example abap program of handling Table Control during bdc programming.
    REPORT zmm_bdcp_purchaseorderkb02
           NO STANDARD PAGE HEADING LINE-SIZE 255.
                    Declaring internal tables                            *
    *-----Declaring line structure
    DATA : BEGIN OF it_dummy OCCURS 0,
             dummy(255) TYPE c,
           END OF it_dummy.
    *-----Internal table for line items
    DATA :  BEGIN OF it_idata OCCURS 0,
              ematn(18),      "Material Number.
              menge(13),      "Qyantity.
              netpr(11),      "Net Price.
              werks(4),       "Plant.
              ebelp(5),       "Item Number.
            END OF it_idata.
    *-----Deep structure for header data and line items
    DATA  :  BEGIN OF it_me21 OCCURS 0,
               lifnr(10),      "Vendor A/c No.
               bsart(4),       "A/c Type.
               bedat(8),       "Date of creation of PO.
               ekorg(4),       "Purchasing Organisation.
               ekgrp(3),       "Purchasing Group.
               x_data LIKE TABLE OF it_idata,
             END OF it_me21.
    DATA  :  x_idata LIKE LINE OF it_idata.
    DATA  :  v_delimit VALUE ','.
    DATA  :  v_indx(3) TYPE n.
    DATA  :  v_fnam(30) TYPE c.
    DATA  :  v_count TYPE n.
    DATA  :  v_ne TYPE i.
    DATA  :  v_ns TYPE i.
    *include bdcrecx1.
    INCLUDE zmm_incl_purchaseorderkb01.
                    Search help for file                                 *
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
      CALL FUNCTION 'F4_FILENAME'
        EXPORTING
          program_name  = syst-cprog
          dynpro_number = syst-dynnr
        IMPORTING
          file_name     = p_file.
    START-OF-SELECTION.
           To upload the data into line structure                        *
      CALL FUNCTION 'WS_UPLOAD'
        EXPORTING
          filename = p_file
          filetype = 'DAT'
        TABLES
          data_tab = it_dummy.
        Processing the data from line structure to internal tables       *
      REFRESH:it_me21.
      CLEAR  :it_me21.
      LOOP AT it_dummy.
        IF it_dummy-dummy+0(01) = 'H'.
          v_indx = v_indx + 1.
          CLEAR   it_idata.
          REFRESH it_idata.
          CLEAR   it_me21-x_data.
          REFRESH it_me21-x_data.
          SHIFT it_dummy.
          SPLIT it_dummy AT v_delimit INTO it_me21-lifnr
                                           it_me21-bsart
                                           it_me21-bedat
                                           it_me21-ekorg
                                           it_me21-ekgrp.
          APPEND it_me21.
        ELSEIF it_dummy-dummy+0(01) = 'L'.
          SHIFT it_dummy.
          SPLIT it_dummy AT v_delimit INTO it_idata-ematn
                                           it_idata-menge
                                           it_idata-netpr
                                           it_idata-werks
                                           it_idata-ebelp.
          APPEND it_idata TO it_me21-x_data.
          MODIFY it_me21 INDEX v_indx.
        ENDIF.
      ENDLOOP.
                    To open the group                                    *
      PERFORM open_group.
            To populate the bdcdata table for header data                *
      LOOP AT it_me21.
        v_count = v_count + 1.
        REFRESH it_bdcdata.
        PERFORM subr_bdc_table USING:   'X' 'SAPMM06E'    '0100',
                                        ' ' 'BDC_CURSOR'  'EKKO-LIFNR',
                                        ' ' 'BDC_OKCODE'  '/00',
                                        ' ' 'EKKO-LIFNR'  it_me21-lifnr,
                                        ' ' 'RM06E-BSART' it_me21-bsart,
                                        ' ' 'RM06E-BEDAT' it_me21-bedat,
                                        ' ' 'EKKO-EKORG'  it_me21-ekorg,
                                        ' ' 'EKKO-EKGRP'  it_me21-ekgrp,
                                        ' ' 'RM06E-LPEIN' 'T'.
        PERFORM subr_bdc_table USING:   'X' 'SAPMM06E'    '0120',
                                        ' ' 'BDC_CURSOR'  'RM06E-EBELP',
                                        ' ' 'BDC_OKCODE'  '/00'.
        MOVE 1 TO v_indx.
    *-----To populate the bdcdata table for line item data
        LOOP AT it_me21-x_data INTO x_idata.
          CONCATENATE 'EKPO-EMATN(' v_indx ')'  INTO v_fnam.
          PERFORM  subr_bdc_table USING ' ' v_fnam x_idata-ematn.
          CONCATENATE 'EKPO-MENGE(' v_indx ')'  INTO v_fnam.
          PERFORM  subr_bdc_table USING ' ' v_fnam x_idata-menge.
          CONCATENATE 'EKPO-NETPR(' v_indx ')'  INTO v_fnam.
          PERFORM  subr_bdc_table USING ' ' v_fnam x_idata-netpr.
          CONCATENATE 'EKPO-WERKS(' v_indx ')'  INTO v_fnam.
          PERFORM  subr_bdc_table USING ' ' v_fnam x_idata-werks.
          v_indx = v_indx + 1.
          PERFORM subr_bdc_table USING:  'X' 'SAPMM06E'    '0120',
                                         ' ' 'BDC_CURSOR'  'RM06E-EBELP',
                                         ' ' 'BDC_OKCODE'  '/00'.
        ENDLOOP.
        PERFORM subr_bdc_table USING:    'X' 'SAPMM06E'    '0120',
                                         ' ' 'BDC_CURSOR'  'RM06E-EBELP',
                                         ' ' 'BDC_OKCODE'  '=BU'.
        PERFORM bdc_transaction USING 'ME21'.
      ENDLOOP.
      PERFORM close_group.
                      End of selection event                             *
    END-OF-SELECTION.
      IF session NE 'X'.
    *-----To display the successful records
        WRITE :/10  text-001.          "Sucess records
        WRITE :/10  SY-ULINE(20).
        SKIP.
        IF it_sucess IS INITIAL.
          WRITE :/  text-002.
        ELSE.
          WRITE :/   text-008,          "Total number of Succesful records
                  35 v_ns.
          SKIP.
          WRITE:/   text-003,          "Vendor Number
                 17 text-004,          "Record number
                 30 text-005.          "Message
        ENDIF.
        LOOP AT it_sucess.
          WRITE:/4  it_sucess-lifnr,
                 17 it_sucess-tabix CENTERED,
                 30 it_sucess-sucess_rec.
        ENDLOOP.
        SKIP.
    *-----To display the erroneous records
        WRITE:/10   text-006.          "Error Records
        WRITE:/10   SY-ULINE(17).
        SKIP.
        IF it_error IS INITIAL.
          WRITE:/   text-007.          "No error records
        ELSE.
          WRITE:/   text-009,          "Total number of erroneous records
                 35 v_ne.
          SKIP.
          WRITE:/   text-003,          "Vendor Number
                 17 text-004,          "Record number
                 30 text-005.          "Message
        ENDIF.
        LOOP AT it_error.
          WRITE:/4  it_error-lifnr,
                 17 it_error-tabix CENTERED,
                 30 it_error-error_rec.
        ENDLOOP.
        REFRESH it_sucess.
        REFRESH it_error.
      ENDIF.
    CODE IN INCLUDE.
    Include           ZMM_INCL_PURCHASEORDERKB01
    DATA:   it_BDCDATA LIKE BDCDATA    OCCURS 0 WITH HEADER LINE.
    DATA:   it_MESSTAB LIKE BDCMSGCOLL OCCURS 0 WITH HEADER LINE.
    DATA:   E_GROUP_OPENED.
    *-----Internal table to store sucess records
    DATA:BEGIN OF it_sucess OCCURS 0,
           msgtyp(1)   TYPE c,
           lifnr  LIKE  ekko-lifnr,
           tabix  LIKE  sy-tabix,
           sucess_rec(125),
         END OF it_sucess.
    DATA: g_mess(125) type c.
    *-----Internal table to store error records
    DATA:BEGIN OF it_error OCCURS 0,
           msgtyp(1)   TYPE c,
           lifnr  LIKE  ekko-lifnr,
           tabix  LIKE  sy-tabix,
           error_rec(125),
         END OF it_error.
           Selection screen
    SELECTION-SCREEN BEGIN OF LINE.
    PARAMETERS session RADIOBUTTON GROUP ctu.  "create session
    SELECTION-SCREEN COMMENT 3(20) text-s07 FOR FIELD session.
    SELECTION-SCREEN POSITION 45.
    PARAMETERS ctu RADIOBUTTON GROUP ctu.     "call transaction
    SELECTION-SCREEN COMMENT 48(20) text-s08 FOR FIELD ctu.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 3(20) text-s01 FOR FIELD group.
    SELECTION-SCREEN POSITION 25.
    PARAMETERS group(12).                      "group name of session
    SELECTION-SCREEN COMMENT 48(20) text-s05 FOR FIELD ctumode.
    SELECTION-SCREEN POSITION 70.
    PARAMETERS ctumode LIKE ctu_params-dismode DEFAULT 'N'.
    "A: show all dynpros
    "E: show dynpro on error only
    "N: do not display dynpro
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 48(20) text-s06 FOR FIELD cupdate.
    SELECTION-SCREEN POSITION 70.
    PARAMETERS cupdate LIKE ctu_params-updmode DEFAULT 'L'.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 3(20) text-s03 FOR FIELD keep.
    SELECTION-SCREEN POSITION 25.
    PARAMETERS: keep AS CHECKBOX.       "' ' = delete session if finished
    "'X' = keep   session if finished
    SELECTION-SCREEN COMMENT 48(20) text-s09 FOR FIELD e_group.
    SELECTION-SCREEN POSITION 70.
    PARAMETERS e_group(12).             "group name of error-session
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 51(17) text-s03 FOR FIELD e_keep.
    SELECTION-SCREEN POSITION 70.
    PARAMETERS: e_keep AS CHECKBOX.     "' ' = delete session if finished
    "'X' = keep   session if finished
    SELECTION-SCREEN END OF LINE.
    PARAMETERS:p_file LIKE rlgrap-filename.
      at selection screen                                                *
    AT SELECTION-SCREEN.
    group and user must be filled for create session
      IF SESSION = 'X' AND
         GROUP = SPACE. "OR USER = SPACE.
        MESSAGE E613(MS).
      ENDIF.
      create batchinput session                                          *
    FORM OPEN_GROUP.
      IF SESSION = 'X'.
        SKIP.
        WRITE: /(20) 'Create group'(I01), GROUP.
        SKIP.
    *----open batchinput group
        CALL FUNCTION 'BDC_OPEN_GROUP'
          EXPORTING
            CLIENT = SY-MANDT
            GROUP  = GROUP
            USER   = sy-uname.
        WRITE:/(30) 'BDC_OPEN_GROUP'(I02),
                (12) 'returncode:'(I05),
                     SY-SUBRC.
      ENDIF.
    ENDFORM.                    "OPEN_GROUP
      end batchinput session                                             *
    FORM CLOSE_GROUP.
      IF SESSION = 'X'.
    *------close batchinput group
        CALL FUNCTION 'BDC_CLOSE_GROUP'.
        WRITE: /(30) 'BDC_CLOSE_GROUP'(I04),
                (12) 'returncode:'(I05),
                     SY-SUBRC.
      ELSE.
        IF E_GROUP_OPENED = 'X'.
          CALL FUNCTION 'BDC_CLOSE_GROUP'.
          WRITE: /.
          WRITE: /(30) 'Fehlermappe wurde erzeugt'(I06).
        ENDIF.
      ENDIF.
    ENDFORM.                    "CLOSE_GROUP
           Start new transaction according to parameters                 *
    FORM BDC_TRANSACTION USING TCODE TYPE ANY.
      DATA: L_SUBRC LIKE SY-SUBRC.
    *------batch input session
      IF SESSION = 'X'.
        CALL FUNCTION 'BDC_INSERT'
          EXPORTING
            TCODE     = TCODE
          TABLES
            DYNPROTAB = it_BDCDATA.
        WRITE: / 'BDC_INSERT'(I03),
                 TCODE,
                 'returncode:'(I05),
                 SY-SUBRC,
                 'RECORD:',
                 SY-INDEX.
      ELSE.
        REFRESH it_MESSTAB.
        CALL TRANSACTION TCODE USING it_BDCDATA
                         MODE   CTUMODE
                         UPDATE CUPDATE
                         MESSAGES INTO it_MESSTAB.
        L_SUBRC = SY-SUBRC.
        WRITE: / 'CALL_TRANSACTION',
                 TCODE,
                 'returncode:'(I05),
                 L_SUBRC,
                 'RECORD:',
                 SY-INDEX.
      ENDIF.
      Message handling for Call Transaction                              *
      perform subr_mess_hand using g_mess.
    *-----Erzeugen fehlermappe
      IF L_SUBRC <> 0 AND E_GROUP <> SPACE.
        IF E_GROUP_OPENED = ' '.
          CALL FUNCTION 'BDC_OPEN_GROUP'
            EXPORTING
              CLIENT = SY-MANDT
              GROUP  = E_GROUP
              USER   = sy-uname
              KEEP   = E_KEEP.
          E_GROUP_OPENED = 'X'.
        ENDIF.
        CALL FUNCTION 'BDC_INSERT'
          EXPORTING
            TCODE     = TCODE
          TABLES
            DYNPROTAB = it_BDCDATA.
      ENDIF.
      REFRESH it_BDCDATA.
    ENDFORM.                    "BDC_TRANSACTION
         Form  subr_bdc_table                                            *
          text
         -->P_0220   text                                                *
         -->P_0221   text                                                *
         -->P_0222   text                                                *
    FORM subr_bdc_table  USING      VALUE(P_0220) TYPE ANY
                                    VALUE(P_0221) TYPE ANY
                                    VALUE(P_0222) TYPE ANY.
      CLEAR it_bdcdata.
      IF P_0220 = ' '.
        CLEAR it_bdcdata.
        it_bdcdata-fnam     = P_0221.
        it_bdcdata-fval     = P_0222.
        APPEND it_bdcdata.
      ELSE.
        it_bdcdata-dynbegin = P_0220.
        it_bdcdata-program  = P_0221.
        it_bdcdata-dynpro   = P_0222.
        APPEND it_bdcdata.
      ENDIF.
    ENDFORM.                    " subr_bdc_table
         Form  subr_mess_hand                                            *
          text                                                           *
         -->P_G_MESS  text                                               *
    FORM subr_mess_hand USING  P_G_MESS TYPE ANY.
      LOOP AT IT_MESSTAB.
        CALL FUNCTION 'FORMAT_MESSAGE'
          EXPORTING
            ID     = it_messtab-msgid
            LANG   = it_messtab-msgspra
            NO     = it_messtab-msgnr
            v1     = it_messtab-msgv1
            v2     = it_messtab-msgv2
          IMPORTING
            MSG    = P_G_MESS
          EXCEPTIONS
            OTHERS = 0.
        CASE it_messtab-msgtyp.
          when 'E'.
            it_error-error_rec   =  P_G_MESS.
            it_error-lifnr       =  it_me21-lifnr.
            it_error-tabix       =  v_count.
            APPEND IT_ERROR.
          when 'S'.
            it_sucess-sucess_rec =  P_G_MESS.
            it_sucess-lifnr      =  it_me21-lifnr.
            it_sucess-tabix      =  v_count.
            APPEND IT_SUCESS.
        endcase.
      ENDLOOP.
      Describe table it_sucess lines v_ns.
      Describe table it_error  lines v_ne.
    ENDFORM.                    " subr_mess_hand
    Also refer
    http://sap.ittoolbox.com/groups/technical-functional/sap-dev/bdc-table-control-668404
    and
    http://www.sap-img.com/abap/bdc-example-using-table-control-in-bdc.htm
    Regards,
    srinivas
    <b>*reward for useful answers*</b>

  • How to use table control in bdc, plz somebody tell me.

    Hi Gurus,
    Ples tell me
    how to use table control in bdc, plz somebody tell me.
    And send Sample CODE also. Thnaks in advance.

    hi,
    Table control / step loop in BDC
    Steploop and table contol is inevitable in certain transactions. When we run BDC for such transactions, we will face the situation: how many visible lines of steploop/tablecontrol are on the screen?
    Although we can always find certain method to deal with it, such as function code 'NP', 'POPO', considering some extreme situation: there is only one line visible one the screen, our BDC program should display an error message. (See transaction 'ME21', we you resize your screen to let only one row visible, you can not enter mutiple lines on this screen even you use 'NP')
    we can determine the number of visible lines on Transaction Screen from our Calling BDC program.
    Demo ABAP code has two purposes:
    1. how to determine number of visible lines and how to calculte page number;
    (the 'calpage' routine has been modify to meet general purpose usage)
    2. using field symbol in BDC program, please pay special attention to the difference
    in Static ASSIGN and Dynamic ASSIGN.
    Step1: go to screen painter to display the screen 121, then we can count the fixed line on this screen, there is 7 lines above the steploop and 2 lines below the steploop, so there are total 9 fixed lines on this screen. This means except these 9 lines, all the other line is for step loop.
    Then have a look at steploop itselp, one entry of it will occupy two lines.
    (Be careful, for table control, the head and the bottom scroll bar will possess another two fixed lines, and there is a maximum number for table line)
    Now we have : FixedLine = 9
    LoopLine = 2(for table control, LoopLine is always equal to 1)
    Step2: go to transaction itself(ME21) to see how it roll page, in ME21, the first line of new page is always occupied by the last line of last page, so it begin with index '02', but in some other case, fisrt line is empty and ready for input.
    Now we have: FirstLine = 0
    or FirstLine = 1 ( in our case, FirstLine is 1 because the first line of new page is fulfilled)
    Step3: write a subroutine calcalculating number of pages
    (here, the name of actual parameter is the same as formal parameter)
    global data: FixedLine type i, " number of fixed line on a certain screen
    LoopLine type i, " the number of lines occupied by one steploop item
    FirstLine type i, " possbile value 0 or 1, 0 stand for the first line of new " scrolling screen is empty, otherwise is 1
    Dataline type i, " number of items you will use in BDC, using DESCRIBE to get
    pageno type i, " you need to scroll screen how many times.
    line type i, " number of lines appears on the screen.
    index(2) type N, " the screen index for certain item
    begin type i, " from parameter of loop
    end type i. " to parameter of loop
    *in code sample, the DataTable-linindex stands for the table index number of this line
    form calpage using FixedLine type i (see step 1)
    LoopLine type i (see step 1)
    FirstLine type i (see step 2)
    DataLine type i ( this is the item number you will enter in transaction)
    changing pageno type i (return the number of page, depends on run-time visible line in table control/ Step Loop)
    changing line type i.(visible lines one the screen)
    data: midd type i,
    vline type i, "visible lines
    if DataLine eq 0.
    Message eXXX.
    endif.
    vline = ( sy-srows - FixedLine ) div LoopLine.
    *for table control, you should compare vline with maximum line of
    *table control, then take the small one that is min(vline, maximum)
    *here only illustrate step loop
    if FirstLine eq 0.
    pageno = DataLine div vline.
    if pageno eq 0.
    pageno = pageno + 1.
    endif.
    elseif FirstLine eq 1.
    pageno = ( DataLine - 1 ) div ( vline - 1 ) + 1.
    midd = ( DataLine - 1 ) mod ( vline - 1).
    if midd = 0 and DataLine gt 1.
    pageno = pageno - 1.
    endif.
    endif.
    line = vline.
    endform.
    Step4 write a subroutine to calculate the line index for each item.
    form calindex using Line type i (visible lines on the screen)
    FirstLine type i(see step 2)
    LineIndex type i(item index)
    changing Index type n. (index on the screen)
    if FirstLine = 0.
    index = LineIndex mod Line.
    if index = '00'.
    index = Line.
    endif.
    elseif FirstLine = 1.
    index = LineIndex mod ( Line - 1 ).
    if ( index between 1 and 0 ) and LineIndex gt 1.
    index = index + Line - 1.
    endif.
    if Line = 2.
    index = index + Line - 1.
    endif.
    endif.
    endform.
    Step5 write a subroutine to calculate the loop range.
    form calrange using Line type i ( visible lines on the screen)
    DataLine type i
    FirstLine type i
    loopindex like sy-index
    changing begin type i
    end type i.
    If FirstLine = 0.
    if loopindex = 1.
    begin = 1.
    if DataLine <= Line.
    end = DataLine.
    else.
    end = Line.
    endif.
    elseif loopindex gt 1.
    begin = Line * ( loopindex - 1 ) + 1.
    end = Line * loopindex.
    if end gt DataLine.
    end = DataLine.
    endif.
    endif.
    elseif FirstLine = 1.
    if loopindex = 1.
    begin = 1.
    if DataLine <= Line.
    end = DataLine.
    else.
    end = Line.
    endif.
    elseif loop index gt 1.
    begin = ( Line - 1 ) * ( loopindex - 1 ) + 2.
    end = ( Line - 1 ) * ( loopindex - 1 ) + Line.
    if end gt DataLine.
    end = DataLine.
    endif.
    endif.
    endif.
    endform.
    Step6
    using field sysbol in your BDC, for example: in ME21, but you should calculate each item will correponding to which index in steploop/Table Control
    form creat_bdc.
    field-symbols: , , .
    data: name1(14) value 'EKPO-EMATN(XX)',
    name2(14) value 'EKPO-MENGE(XX)',
    name3(15) value 'RM06E-SELKZ(XX)'.
    assign: name1 to ,
    name2 to ,
    name3 to .
    do pageno times.
    if sy-index gt 1
    *insert scroll page ok_code"
    endif.
    perform calrange using Line DataLine FirstLine sy-index
    changing begin end.
    loop at DataTable from begin to end.
    perform calindex using Line FirstLine DataTable-LineIndex changing Index.
    name1+11(2) = Index.
    name2+11(2) = Index.
    name3+12(2) = Index.
    perform bdcfield using DataTable-matnr.
    perform bdcfield using DataTable-menge.
    perform bdcfield using DataTable-indicator.
    endloop.
    enddo.
    example 1
    BDC table control is an area on the screen in which you can display data in tabular form. You process it using a loop. Table controls are comparable to step loop tables. While a table control consists of a single definition row, step loop blocks may extend over more than one row. Table controls are more flexible than step loops, and are intended to replace them
    When you need to handle a scenario like in sales order,it may contain more than one material,if you have more than one material We have to use table control,it will have number of columns and number of rows.
    Table controls allow you to enter, display, and modify tabular data easily on the screen
    Check this code,
    PARAMETERS: file1 LIKE rlgrap-filename.
    *Internal Table Declarations
    DATA: BEGIN OF itab OCCURS 0,
    matnr(18) TYPE c, "MaterialNumber
    werks(4) TYPE c, "Plant
    vdatu(10) TYPE c, "Valid From Date
    bdatu(10) TYPE c, "Valid To Date
    lifnr(10) TYPE c, "Vendor Number
    ekorg(4) TYPE c, "Purchasing Organization
    feskz TYPE c, "Fixed
    autet TYPE c, "MRP Indicator
    END OF itab.
    DATA: bdcdata LIKE TABLE OF bdcdata WITH HEADER LINE.
    *VARIABLES Declarations
    DATA: wa1 LIKE LINE OF itab. "Workarea for ITAB
    DATA: n TYPE i, "Check
    count TYPE i.
    DATA: cnt(2), "Counter
    wa(15). "Workarea to hold concatenatedvalue
    DATA v_msg(100).
    DATA: flag.
    DATA: file TYPE string.
    *Initialization event
    INITIALIZATION.
    *At-selection-screen event
    *To provide Input help for file name
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR file1.
    CALL FUNCTION 'F4_FILENAME'
    EXPORTING
    program_name = syst-cprog
    dynpro_number = syst-dynnr
    IMPORTING
    file_name = file1.
    *START-OF-SELECTION EVENT
    START-OF-SELECTION.
    MOVE file1 TO file.
    CALL FUNCTION 'GUI_UPLOAD'
    EXPORTING
    filename = file
    filetype = 'ASC'
    has_field_separator = 'X'
    TABLES
    data_tab = itab
    EXCEPTIONS
    file_open_error = 1
    file_read_error = 2
    no_batch = 3
    gui_refuse_filetransfer = 4
    invalid_type = 5
    no_authority = 6
    unknown_error = 7
    bad_data_format = 8
    header_not_allowed = 9
    separator_not_allowed = 10
    header_too_long = 11
    unknown_dp_error = 12
    access_denied = 13
    dp_out_of_memory = 14
    disk_full = 15
    dp_timeout = 16
    OTHERS = 17.
    IF sy-subrc <> 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.
    *To populate BDCDATA and start data transfer
    LOOP AT itab .
    To validate Plant range
    IF itab-werks = '1000' OR itab-werks = '2000'
    OR itab-werks = '1008'.
    AT NEW werks.
    CLEAR: n.
    cnt = 1.
    PERFORM bdc_dynpro USING 'SAPLMEOR' '0200'.
    PERFORM bdc_field USING 'BDC_CURSOR'
    'EORD-MATNR'.
    PERFORM bdc_field USING 'BDC_OKCODE'
    '/00'.
    PERFORM bdc_field USING 'EORD-MATNR'
    itab-matnr.
    PERFORM bdc_field USING 'EORD-WERKS'
    itab-werks.
    PERFORM bdc_dynpro USING 'SAPLMEOR' '0205'.
    CONCATENATE 'EORD-EKORG(' cnt ')' INTO wa.
    PERFORM bdc_field USING 'BDC_CURSOR'
    wa.
    PERFORM bdc_field USING 'BDC_OKCODE'
    '=BU'.
    ENDAT.
    IF n = 12.
    READ TABLE bdcdata WITH KEY fval = '=BU'.
    bdcdata-fval = '=NS'.
    MODIFY bdcdata INDEX sy-tabix TRANSPORTING fval.
    PERFORM bdc_dynpro USING 'SAPLMEOR' '0205'.
    PERFORM bdc_field USING 'BDC_CURSOR'
    'EORD-VDATU(01)'.
    PERFORM bdc_field USING 'BDC_OKCODE'
    '=BU'.
    cnt = 2.
    n = 2.
    ENDIF.
    CONCATENATE 'EORD-VDATU(' cnt ')' INTO wa.
    PERFORM bdc_field USING wa
    itab-vdatu.
    CONCATENATE 'EORD-BDATU(' cnt ')' INTO wa.
    PERFORM bdc_field USING wa
    itab-bdatu.
    CONCATENATE 'EORD-LIFNR(' cnt ')' INTO wa.
    PERFORM bdc_field USING wa
    itab-lifnr.
    CONCATENATE 'EORD-EKORG(' cnt ')' INTO wa.
    PERFORM bdc_field USING wa
    itab-ekorg.
    CONCATENATE 'RM06W-FESKZ(' cnt ')' INTO wa.
    PERFORM bdc_field USING wa
    itab-feskz.
    CONCATENATE 'EORD-AUTET(' cnt ')' INTO wa.
    PERFORM bdc_field USING wa
    itab-autet.
    IF n <> 12.
    n = cnt.
    ENDIF.
    cnt = cnt + 1.
    AT END OF werks.
    CALL TRANSACTION 'ME01' USING bdcdata
    UPDATE 'S'
    MODE 'A'.
    CLEAR:bdcdata,bdcdata[].
    CALL FUNCTION 'FORMAT_MESSAGE'
    EXPORTING
    id = sy-msgid
    lang = 'EN'
    no = sy-msgno
    v1 = sy-msgv1
    v2 = sy-msgv2
    v3 = sy-msgv3
    v4 = sy-msgv4
    IMPORTING
    msg = v_msg.
    WRITE:/ v_msg.
    CLEAR: bdcdata,bdcdata[],flag.
    ENDAT.
    ENDIF.
    ENDLOOP.
    Start new screen *
    FORM bdc_dynpro USING program dynpro.
    CLEAR bdcdata.
    bdcdata-program = program.
    bdcdata-dynpro = dynpro.
    bdcdata-dynbegin = 'X'.
    APPEND bdcdata.
    ENDFORM.
    Insert field values
    FORM bdc_field USING fnam fval.
    IF NOT fval IS INITIAL.
    CLEAR bdcdata.
    bdcdata-fnam = fnam.
    bdcdata-fval = fval.
    APPEND bdcdata.
    ENDIF.
    CLEAR wa.
    ENDFORM.
    Sample code 2
    THis is example to upload the Bank details of the Vendor which has the TC.
    REPORT zprataptable2
    NO STANDARD PAGE HEADING LINE-SIZE 255.
    DATA : BEGIN OF itab OCCURS 0,
    i1 TYPE i,
    lifnr LIKE rf02k-lifnr,
    bukrs LIKE rf02k-bukrs,
    ekorg LIKE rf02k-ekorg,
    ktokk LIKE rf02k-ktokk,
    anred LIKE lfa1-anred,
    name1 LIKE lfa1-name1,
    sortl LIKE lfa1-sortl,
    land1 LIKE lfa1-land1,
    akont LIKE lfb1-akont,
    fdgrv LIKE lfb1-fdgrv,
    waers LIKE lfm1-waers,
    END OF itab.
    DATA : BEGIN OF jtab OCCURS 0,
    j1 TYPE i,
    banks LIKE lfbk-banks,
    bankl LIKE lfbk-bankl,
    bankn LIKE lfbk-bankn,
    END OF jtab.
    DATA : cnt(4) TYPE n.
    DATA : fdt(20) TYPE c.
    DATA : c TYPE i.
    INCLUDE bdcrecx1.
    START-OF-SELECTION.
    CALL FUNCTION 'WS_UPLOAD'
    EXPORTING
    filename = 'C:\first1.txt'
    filetype = 'DAT'
    TABLES
    data_tab = itab.
    CALL FUNCTION 'WS_UPLOAD'
    EXPORTING
    filename = 'C:\second.txt'
    filetype = 'DAT'
    TABLES
    data_tab = jtab.
    LOOP AT itab.
    PERFORM bdc_dynpro USING 'SAPMF02K' '0100'.
    PERFORM bdc_field USING 'BDC_CURSOR'
    'RF02K-KTOKK'.
    PERFORM bdc_field USING 'BDC_OKCODE'
    '/00'.
    PERFORM bdc_field USING 'RF02K-LIFNR'
    itab-lifnr.
    PERFORM bdc_field USING 'RF02K-BUKRS'
    itab-bukrs.
    PERFORM bdc_field USING 'RF02K-EKORG'
    itab-ekorg.
    PERFORM bdc_field USING 'RF02K-KTOKK'
    itab-ktokk.
    PERFORM bdc_dynpro USING 'SAPMF02K' '0110'.
    PERFORM bdc_field USING 'BDC_CURSOR'
    'LFA1-LAND1'.
    PERFORM bdc_field USING 'BDC_OKCODE'
    '/00'.
    PERFORM bdc_field USING 'LFA1-ANRED'
    itab-anred.
    PERFORM bdc_field USING 'LFA1-NAME1'
    itab-name1.
    PERFORM bdc_field USING 'LFA1-SORTL'
    itab-sortl.
    PERFORM bdc_field USING 'LFA1-LAND1'
    itab-land1.
    PERFORM bdc_dynpro USING 'SAPMF02K' '0120'.
    PERFORM bdc_field USING 'BDC_CURSOR'
    'LFA1-KUNNR'.
    PERFORM bdc_field USING 'BDC_OKCODE'
    '/00'.
    PERFORM bdc_dynpro USING 'SAPMF02K' '0130'.
    PERFORM bdc_field USING 'BDC_CURSOR'
    'LFBK-BANKN(01)'.
    PERFORM bdc_field USING 'BDC_OKCODE'
    '=ENTR'.
    cnt = 0.
    LOOP AT jtab WHERE j1 = itab-i1.
    cnt = cnt + 1.
    CONCATENATE 'LFBK-BANKS(' cnt ')' INTO fdt.
    PERFORM bdc_field USING fdt jtab-banks.
    CONCATENATE 'LFBK-BANKL(' cnt ')' INTO fdt.
    PERFORM bdc_field USING fdt jtab-bankl.
    CONCATENATE 'LFBK-BANKN(' cnt ')' INTO fdt.
    PERFORM bdc_field USING fdt jtab-bankn.
    IF cnt = 5.
    cnt = 0.
    PERFORM bdc_dynpro USING 'SAPMF02K' '0130'.
    PERFORM bdc_field USING 'BDC_CURSOR'
    'LFBK-BANKS(01)'.
    PERFORM bdc_field USING 'BDC_OKCODE'
    '=P+'.
    PERFORM bdc_dynpro USING 'SAPMF02K' '0130'.
    PERFORM bdc_field USING 'BDC_CURSOR'
    'LFBK-BANKN(02)'.
    PERFORM bdc_field USING 'BDC_OKCODE'
    '=ENTR'.
    ENDIF.
    ENDLOOP.
    PERFORM bdc_dynpro USING 'SAPMF02K' '0130'.
    PERFORM bdc_field USING 'BDC_CURSOR'
    'LFBK-BANKS(01)'.
    PERFORM bdc_field USING 'BDC_OKCODE'
    '=ENTR'.
    PERFORM bdc_dynpro USING 'SAPMF02K' '0210'.
    PERFORM bdc_field USING 'BDC_CURSOR'
    'LFB1-FDGRV'.
    PERFORM bdc_field USING 'BDC_OKCODE'
    '/00'.
    PERFORM bdc_field USING 'LFB1-AKONT'
    itab-akont.
    PERFORM bdc_field USING 'LFB1-FDGRV'
    itab-fdgrv.
    PERFORM bdc_dynpro USING 'SAPMF02K' '0215'.
    PERFORM bdc_field USING 'BDC_CURSOR'
    'LFB1-ZTERM'.
    PERFORM bdc_field USING 'BDC_OKCODE'
    '/00'.
    PERFORM bdc_dynpro USING 'SAPMF02K' '0220'.
    PERFORM bdc_field USING 'BDC_CURSOR'
    'LFB5-MAHNA'.
    PERFORM bdc_field USING 'BDC_OKCODE'
    '/00'.
    PERFORM bdc_dynpro USING 'SAPMF02K' '0310'.
    PERFORM bdc_field USING 'BDC_CURSOR'
    'LFM1-WAERS'.
    PERFORM bdc_field USING 'BDC_OKCODE'
    '/00'.
    PERFORM bdc_field USING 'LFM1-WAERS'
    itab-waers.
    PERFORM bdc_dynpro USING 'SAPMF02K' '0320'.
    PERFORM bdc_field USING 'BDC_CURSOR'
    'RF02K-LIFNR'.
    PERFORM bdc_field USING 'BDC_OKCODE'
    '=ENTR'.
    PERFORM bdc_dynpro USING 'SAPLSPO1' '0300'.
    PERFORM bdc_field USING 'BDC_OKCODE'
    '=YES'.
    PERFORM bdc_transaction USING 'XK01'.
    ENDLOOP.
    PERFORM close_group.
    Header file:
    1 63190 0001 0001 0001 mr bal188 b in 31000 a1 inr
    2 63191 0001 0001 0001 mr bal189 b in 31000 a1 inr
    TC file:
    1 in sb 11000
    1 in sb 12000
    1 in sb 13000
    1 in sb 14000
    1 in sb 15000
    1 in sb 16000
    1 in sb 17000
    1 in sb 18000
    1 in sb 19000
    1 in sb 20000
    1 in sb 21000
    1 in sb 22000
    2 in sb 21000
    2 in sb 22000
    Regards

  • Help on PO13 ---- "SAP Organizational Object"  in the table control.

    Hi All,
    Can some one tell me details on or where to read from ..... PO13 -> "SAP Organizational Object"  in the table control.
    For eg if you go to PO13 -
    > "Relationships"  in the table control you get all the hierarchy details of an employee (eg: reports to, belongs to, holder ...etc.).
    Similarly what would you get when u go to PO13 -
    > "SAP Organizational Object" -
    > Overview  in the table control. Is it something to do with product hierarchy ..... am not very sure. I am working on a sandbox on a trial workflow for learning purpose and I do not have it configured so that I can look for some samples.
    I understand I am not very clear about my question, but still I hope if someone can answer.
    Thanks,
    Anu.

    An object type is a generic description of an object.
    The object type definition determines the object type by specifying its various components.
    An object type is defined by its
    Basic data, such as name, created by...
    Key fields, which give each object a unique ID
    Attributes as the characteristics of an object
    Methods with parameters and exceptions as activities that can be performed for an object
    Events, which describe any changes that occur
    Implementation in the program code
    After assigning Object Type, you should click on Assign Key.. and assign respectuve Object ID.
    This will create link between Object in HR-OM with Object of other modules like Sales, Vendor, Purchase etc.
    Note sure, how this is used in Workflow... i never worked on workflows.
    Regards
    ...SAdhu

  • Handling Table control in BDC

    I am doing BC for transaction KKPA with session method. I am filling the table control by using two internal tables IT_STPO and IT_ZCOT. I have prepared the logic and able to move the data to table control. But I am unable to handle when it more records. Generally we will use page down event (=p+) to handle this. As I am new to this, Please advise me how to go ahead.
    Here I am pasting the code with valid comment. Please correct it and reply me.
    *-Table control SCREEN 1301 started.
            PERFORM BDC_DYNPRO      USING 'SAPLKKDI' '1301'.
            perform bdc_field       using 'BDC_CURSOR'
                                          'RK70L-MENGE(01)'.
            perform bdc_field       using 'BDC_OKCODE'
                                          '/00'.
            perform bdc_field       using 'RK70E-LST_SETNR'
                                          '    1'.
    *-To move the first record to table control
            MOVE 1 TO Y_CNT.
    *-Here we are moving activity type M data from internal table IT_STPO.
    *-Move the BDC data only for activity type M
            LOOP AT IT_STPO INTO WA_STPO.
    *-To move to the first screen
              CLEAR: Y_REM, Y_MOD.
              IF Y_CNT gt 10.
                Y_REM := Y_CNT / 10.
                Y_MOD := Y_CNT mod 10.
                IF ( Y_REM EQ 1 ) AND ( Y_MOD eq 1 ).
                  perform bdc_dynpro      using 'SAPLKKDI'
                                                '1301'.
                  perform bdc_field       using 'BDC_OKCODE'
                                                '=P+'.
                ENDIF.
                IF ( Y_REM gt 0 ) AND ( Y_MOD eq 1 ).
                  perform bdc_field       using 'RK70E-LST_SETNR'
                                                '    1'.
                ENDIF.
              ENDIF.
    *-For feild typps
              CONCATENATE 'RK70L-TYPPS(' Y_CNT ')' INTO Y_FNAM.
              PERFORM BDC_FIELD       USING Y_FNAM
                                            C_M.
              CONCATENATE 'RK70L-HERK2(' Y_CNT ')' INTO Y_FNAM.
              PERFORM BDC_FIELD       USING Y_FNAM
                                            WA_STPO-COMPONENT.
              CONCATENATE 'RK70L-HERK3(' Y_CNT ')' INTO Y_FNAM.
              PERFORM BDC_FIELD       USING Y_FNAM
                                         WA_KEKO_DATA-WERKS.
    *-Qunatity conversion
              WRITE: WA_STPO-COMP_QTY TO Y_COMP_QTY.
              CONCATENATE 'RK70L-MENGE(' Y_CNT ')' INTO Y_FNAM.
              PERFORM BDC_FIELD       USING Y_FNAM
                                         Y_COMP_QTY.
              Y_CNT = Y_CNT + 1.
              CLEAR: WA_STPO.
            ENDLOOP.
            CLEAR : Y_CNT, Y_FNAM.
            DESCRIBE TABLE IT_STPO LINES Y_CNT.
            Y_CNT = Y_CNT + 1.
    *-Here we are moving activity type M data from internal table IT_STPO.
    *-Move the BDC data only for activity type M
            LOOP AT IT_ZCOT INTO WA_ZCOT.
    *-Check the type of activity
              IF WA_ZCOT-TYPPS EQ C_E.
    *- if type of activity 'E'
                CONCATENATE 'RK70L-TYPPS(' Y_CNT ')' INTO Y_FNAM.
                PERFORM BDC_FIELD       USING Y_FNAM
                                              C_E.
                CONCATENATE 'RK70L-HERK2(' Y_CNT ')' INTO Y_FNAM.
                PERFORM BDC_FIELD       USING Y_FNAM
                                              WA_ZCOT-KOSTL.
                CONCATENATE 'RK70L-HERK3(' Y_CNT ')' INTO Y_FNAM.
                PERFORM BDC_FIELD       USING Y_FNAM
                                              WA_ZCOT-LSTAR.
                WRITE WA_ZCOT-MENGE TO Y_QUANT_CHAR.
                CONCATENATE 'RK70L-MENGE(' Y_CNT ')' INTO Y_FNAM.
                PERFORM BDC_FIELD       USING Y_FNAM
                                              Y_QUANT_CHAR.
              ENDIF.
    *- if type of activity 'V'
              IF WA_ZCOT-TYPPS EQ C_V.
                CLEAR: Y_QUANT_CHAR.
                CONCATENATE 'RK70L-TYPPS(' Y_CNT ')' INTO Y_FNAM.
                PERFORM BDC_FIELD       USING Y_FNAM
                                              C_V.
                CONCATENATE 'RK70L-KSTAR(' Y_CNT ')' INTO Y_FNAM.
                PERFORM BDC_FIELD       USING Y_FNAM
                                              WA_ZCOT-KSTAR.
                WRITE WA_ZCOT0001_DATA-MENGE TO Y_QUANT_CHAR.
                CONCATENATE 'RK70L-MENGE(' Y_CNT ')' INTO Y_FNAM.
                PERFORM BDC_FIELD       USING Y_FNAM
                                              WA_ZCOT-MENGE.
                CONCATENATE 'RK70L-LPREIS(' Y_CNT ')' INTO Y_FNAM.
                PERFORM BDC_FIELD       USING Y_FNAM
                                              WA_ZCOT-LPEINH.
              ENDIF.
              Y_CNT = Y_CNT + 1.
              CLEAR: WA_ZCOT.
            ENDLOOP.
            perform bdc_dynpro      using 'SAPLKKDI' '1301'.
            perform bdc_field       using 'BDC_CURSOR'
                                          'RK70L-LPREIS(04)'.
            perform bdc_field       using 'BDC_OKCODE'
                                          '=SICH'.
            perform bdc_field       using 'RK70E-LST_SETNR'
    As of now I am trying to handle the same in the internal table IT_STPO, so please correct the code in the loop IT_STPO and advise how to handle with other internal table also.
    Many Thanks,
    Raghyu.

    Hi,
    the insert button code is =POAN.
    TYPE-POOLS: truxs.
    TABLES: t100.
    TYPES: BEGIN OF bdc.
    INCLUDE TYPE bdcdata.
    TYPES: END   OF bdc.
    TYPES: BEGIN OF ty_itab,
           project_id TYPE dpr_project-project_id,
           aufnr TYPE aufk-aufnr,
           vbeln TYPE vbak-vbeln,
           auart TYPE vbak-auart,
           matnr TYPE vbap-matnr,
           zieme TYPE vbap-zieme,
           kschl TYPE konv-kschl,
           kbetr(13),
           bemot   TYPE vbap-bemot,
           zmeng(13),
           mvgr5   TYPE vbap-mvgr5,
           zzpernr TYPE vbap-zzpernr,
           htext1(72),
           htext2(72),
           END   OF ty_itab.
    TYPES: BEGIN OF ty_item,
           matnr TYPE vbap-matnr,
           zmeng(13),
           zieme TYPE vbap-zieme,
           mvgr5   TYPE vbap-mvgr5,
           aufnr TYPE aufk-aufnr,
           zzpernr TYPE vbap-zzpernr,
           bemot   TYPE vbap-bemot,
           arktx   TYPE vbap-arktx,
           kschl   TYPE konv-kschl,
           kbetr(13),
           END  OF ty_item.
    TYPES: BEGIN OF ty_pa0001,
           pernr    TYPE persno,
           ename    TYPE pa0001-ename,
           END   OF ty_pa0001.
    DATA: it_pa0001 TYPE TABLE OF ty_pa0001,
          wa_pa0001 TYPE ty_pa0001.
    DATA: itab     TYPE STANDARD TABLE OF ty_itab,
          item     TYPE TABLE OF ty_item,
          wa_item  TYPE ty_item,
          wa_itab  TYPE ty_itab.
    DATA: bdcdata  TYPE TABLE OF bdc,
          wa_bdc   TYPE bdc.
    DATA: mode TYPE c.
    DATA: message TYPE TABLE OF bdcmsgcoll,
          wa_message TYPE bdcmsgcoll.
    DATA : count(2) TYPE n.
    DATA : index(2) TYPE n.
    DATA: it_raw    TYPE truxs_t_text_data.
    DATA: lv_werks  TYPE vbap-werks.
    DATA: lv_vbeln(10)  TYPE n.
    DATA: l_mstring(480).
    DATA: l_pernr(10) TYPE c.
    FIELD-SYMBOLS : <fs_itab> TYPE ty_itab.
    SELECTION-SCREEN: BEGIN OF BLOCK b1 WITH FRAME.
    PARAMETERS: p_file TYPE rlgrap-filename,
                rb1 RADIOBUTTON GROUP g1,
                rb3 RADIOBUTTON GROUP g1.
    SELECTION-SCREEN: SKIP 2,
                      COMMENT 1(79) text-001.
    SELECTION-SCREEN: END OF BLOCK b1.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
      CALL FUNCTION 'F4_FILENAME'
        EXPORTING
          field_name = 'P_FILE'
        IMPORTING
          file_name  = p_file.
    START-OF-SELECTION.
      CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'
        EXPORTING
          i_line_header        = 'X'
          i_tab_raw_data       = it_raw       " WORK TABLE
          i_filename           = p_file
        TABLES
          i_tab_converted_data = itab[]    "ACTUAL DATA
        EXCEPTIONS
          conversion_failed    = 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.
    *  CALL FUNCTION 'WS_UPLOAD'
    *   EXPORTING
    **   CODEPAGE                      = ' '
    *     filename                      = p_file
    *     filetype                      = 'DAT'
    **   HEADLEN                       = ' '
    **   LINE_EXIT                     = ' '
    **   TRUNCLEN                      = ' '
    **   USER_FORM                     = ' '
    **   USER_PROG                     = ' '
    **   DAT_D_FORMAT                  = ' '
    ** IMPORTING
    **   FILELENGTH                    =
    *    TABLES
    *      data_tab                      = itab[]
    *   EXCEPTIONS
    *     conversion_error              = 1
    *     file_open_error               = 2
    *     file_read_error               = 3
    *     invalid_type                  = 4
    *     no_batch                      = 5
    *     unknown_error                 = 6
    *     invalid_table_width           = 7
    *     gui_refuse_filetransfer       = 8
    *     customer_error                = 9
    *     no_authority                  = 10
    *     OTHERS                        = 11
    *  IF sy-subrc <> 0.
    *    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
    *            WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    *  ENDIF.
    **  PERFORM open_group.
      CLEAR :lv_werks,lv_vbeln.
      READ TABLE itab INTO wa_itab INDEX 1.
      IF sy-subrc = 0.
        lv_vbeln = wa_itab-vbeln.
        SELECT SINGLE werks
               FROM   vbap
               INTO   lv_werks
               WHERE  vbeln = lv_vbeln.
      ENDIF.
      IF itab[] IS NOT INITIAL.
        REFRESH: it_pa0001.
        SELECT pernr ename
               FROM  pa0001
               INTO  TABLE it_pa0001
               FOR   ALL ENTRIES IN itab
               WHERE pernr = itab-zzpernr.
    *           AND   begda <= sy-datum
    *           AND   endda >= sy-datum.
      ENDIF.
      LOOP AT itab INTO wa_itab.
        MOVE-CORRESPONDING wa_itab TO wa_item.
        CLEAR wa_pa0001.
        READ TABLE it_pa0001 INTO wa_pa0001 WITH KEY
             pernr = wa_item-zzpernr.
        IF sy-subrc = 0.
          wa_item-arktx = wa_pa0001-ename.
        ENDIF.
        APPEND wa_item TO item.
        CLEAR wa_item.
      ENDLOOP.
      READ TABLE itab INTO wa_itab INDEX 1.
      PERFORM bdc_dynpro      USING 'SAPMV45A' '0101'.
      PERFORM bdc_field       USING 'BDC_CURSOR'
                                    'VBAK-AUART'.
      PERFORM bdc_field       USING 'BDC_OKCODE'
                                    '=COPY'.
      PERFORM bdc_field       USING 'VBAK-AUART'
                                    wa_itab-auart.
      PERFORM bdc_dynpro      USING 'SAPLV45C' '0100'.
      PERFORM bdc_field       USING 'BDC_OKCODE'
                                    '=REF1'.
      PERFORM bdc_field       USING 'BDC_CURSOR'
                                    'LV45C-VBELN'.
      PERFORM bdc_field       USING 'LV45C-VBELN'
                                    wa_itab-vbeln.
      PERFORM bdc_dynpro      USING 'SAPLV45C' '0100'.
      PERFORM bdc_field       USING 'BDC_OKCODE'
                                    '=REF1'.
      PERFORM bdc_field       USING 'BDC_CURSOR'
                                    'LV45C-VBELN'.
      PERFORM bdc_field       USING 'LV45C-VBELN'
                                    wa_itab-vbeln.
      PERFORM bdc_dynpro      USING 'SAPLV45C' '0100'.
      PERFORM bdc_field       USING 'BDC_OKCODE'
                                    '=UEBR'.
      PERFORM bdc_dynpro      USING 'SAPMV45A' '4001'.
      PERFORM bdc_field       USING 'BDC_OKCODE'
                                    '=KTEX_SUB'.
      PERFORM bdc_dynpro      USING 'SAPMV45A' '4002'.
      PERFORM bdc_field       USING 'BDC_OKCODE'
                                    '=TP_DELETE'.
      PERFORM bdc_dynpro      USING 'SAPMV45A' '4002'.
      PERFORM bdc_field       USING 'BDC_OKCODE'
                                    '=TP_CREATE'.
      PERFORM bdc_field       USING 'LV70T-SPRAS'
                                    sy-langu.
      PERFORM bdc_dynpro      USING 'SAPMV45A' '4002'.
      PERFORM bdc_field       USING 'BDC_OKCODE'
                                    '=TP_DETAIL'.
      PERFORM bdc_field       USING 'LV70T-SPRAS'
                                    sy-langu.
      PERFORM bdc_dynpro      USING 'SAPLSTXX' '1100'.
      PERFORM bdc_field       USING 'BDC_CURSOR'
                                    'RSTXT-TXLINE(02)'.
      PERFORM bdc_field       USING 'BDC_OKCODE'
                                    '=TXVB'.
      PERFORM bdc_field       USING 'RSTXT-TXPARGRAPH(02)'
      PERFORM bdc_field       USING 'RSTXT-TXPARGRAPH(03)'
      PERFORM bdc_field       USING 'RSTXT-TXLINE(02)'
                                    wa_itab-htext1.
      PERFORM bdc_field       USING 'RSTXT-TXLINE(03)'
                                    wa_itab-htext2.
      PERFORM bdc_dynpro      USING 'SAPLSTXX' '1100'.
      PERFORM bdc_field       USING 'BDC_CURSOR'
                                    'RSTXT-TXLINE(02)'.
      PERFORM bdc_field       USING 'BDC_OKCODE'
                                    '=TXBA'.
      PERFORM bdc_dynpro      USING 'SAPMV45A' '4002'.
      PERFORM bdc_field       USING 'BDC_OKCODE'
                                    '/EBACK'.
      CLEAR index.
      DATA: line TYPE i.
      DESCRIBE TABLE item LINES line.
      LOOP AT item INTO wa_item.
        index = index + 1.
        PERFORM bdc_dynpro      USING 'SAPMV45A' '4001'.
        IF index = 1.
          PERFORM bdc_field       USING 'VBAP-ZMENG(01)'
                                        wa_itab-zmeng.
          PERFORM bdc_field       USING 'VBAP-ZIEME(01)'
                                        wa_itab-zieme.
          PERFORM bdc_field       USING 'VBAP-ARKTX(01)'
                                        wa_item-arktx.
          IF wa_itab-mvgr5 IS NOT INITIAL.
            PERFORM bdc_field       USING 'VBAP-MVGR5(01)'
                                          wa_itab-mvgr5.
          ENDIF.
          PERFORM bdc_field       USING 'VBAP-AUFNR(01)'
                                        wa_itab-aufnr.
          PERFORM bdc_field       USING 'VBAP-WERKS(01)'
                                        lv_werks.
        ELSE.
          IF index < line.
           <b> PERFORM bdc_field       USING 'BDC_OKCODE'
                                          '=POAN'.</b>
          ENDIF.
          PERFORM bdc_field       USING 'RV45A-MABNR(02)'
                                         wa_item-matnr.
          PERFORM bdc_field       USING 'VBAP-ZMENG(02)'
                                        wa_item-zmeng.
          PERFORM bdc_field       USING 'VBAP-ZIEME(02)'
                                        wa_item-zieme.
          IF wa_item-mvgr5 IS NOT INITIAL.
            PERFORM bdc_field       USING 'VBAP-MVGR5(02)'
                                          wa_item-mvgr5.
          ENDIF.
          PERFORM bdc_field       USING 'VBAP-ARKTX(02)'
                                        wa_item-arktx.
          PERFORM bdc_field       USING 'VBAP-AUFNR(02)'
                                        wa_item-aufnr.
          PERFORM bdc_field       USING 'VBAP-WERKS(02)'
                                        lv_werks.
        ENDIF.
      ENDLOOP.
      PERFORM bdc_dynpro      USING 'SAPMV45A' '4001'.
      PERFORM bdc_field       USING 'BDC_OKCODE'
                                    '=ITEM'.
      PERFORM bdc_field       USING 'BDC_CURSOR'
                                    'RV45A-MABNR(02)'.
      PERFORM bdc_dynpro      USING 'SAPMV45A' '4003'.
      PERFORM bdc_field       USING 'BDC_OKCODE'
                                    '=T05'.
      PERFORM bdc_dynpro      USING 'SAPMV45A' '5003'.
      PERFORM bdc_field       USING 'BDC_OKCODE'
                                    '=POS1'.
      CLEAR index.
      LOOP AT item INTO wa_item.
        index = index + 1.
        IF index = 1.
          PERFORM bdc_field       USING 'BDC_CURSOR'
                                      'KOMV-KSCHL(01)'.
          PERFORM bdc_dynpro      USING 'SAPMV45A' '5003'.
          PERFORM bdc_field       USING 'BDC_OKCODE'
                                        '=POS+'.
          PERFORM bdc_field       USING 'BDC_CURSOR'
                                        'KOMV-KBETR(01)'.
          PERFORM bdc_field       USING 'KOMV-KBETR(01)'
                                        wa_item-kbetr.
        ELSE.
          PERFORM bdc_dynpro      USING 'SAPMV45A' '5003'.
          PERFORM bdc_field       USING 'BDC_OKCODE'
                                        '=V69A_KOAN'.
          PERFORM bdc_field       USING 'BDC_CURSOR'
                                        'KOMV-KSCHL(01)'.
          PERFORM bdc_dynpro      USING 'SAPMV45A' '5003'.
          PERFORM bdc_field       USING 'BDC_OKCODE'
                                        '=POS+'.
          PERFORM bdc_field       USING 'BDC_CURSOR'
                                        'KOMV-KBETR(02)'.
          PERFORM bdc_field       USING 'KOMV-KSCHL(02)'
                                        wa_item-kschl.
          PERFORM bdc_field       USING 'KOMV-KBETR(02)'
                                        wa_item-kbetr.
        ENDIF.
      ENDLOOP.
      PERFORM bdc_dynpro      USING 'SAPMV45A' '5003'.
      PERFORM bdc_field       USING 'BDC_OKCODE'
                                    '/EBACK'.
      PERFORM bdc_field       USING 'BDC_CURSOR'
                                    'KOMV-KSCHL(03)'.
      PERFORM bdc_dynpro      USING 'SAPMV45A' '4001'.
      PERFORM bdc_field       USING 'BDC_OKCODE'
                                    '=FEAZ'.
      LOOP AT item INTO wa_item.
        PERFORM bdc_dynpro      USING 'SAPLSLVC_FULLSCREEN' '0500'.
        PERFORM bdc_field       USING 'BDC_OKCODE'
                                      '=FEBE'.
        PERFORM bdc_dynpro      USING 'SAPMV45A' '4003'.
    *    PERFORM bdc_field       USING 'BDC_OKCODE'
    *                                  '=FEWE'.
        PERFORM bdc_field       USING 'BDC_CURSOR'
                                      'VBAP-BEMOT'.
        CLEAR l_pernr.
        l_pernr = wa_item-zzpernr.
        CONDENSE l_pernr.
        PERFORM bdc_field       USING 'VBAP-ZZPERNR'
                                      wa_item-zzpernr.
        PERFORM bdc_field       USING 'VBAP-BEMOT'
                                      wa_item-bemot.
        PERFORM bdc_dynpro      USING 'SAPMV45A' '4003'.
        PERFORM bdc_field       USING 'BDC_OKCODE'
                                      '=FEWE'.
      ENDLOOP.
      PERFORM bdc_dynpro      USING 'SAPMV45A' '4001'.
      PERFORM bdc_field       USING 'BDC_OKCODE'
                                    '=SICH'.
      IF rb1 = 'X'.
        mode = 'A'.
      ELSEIF rb3 = 'X'.
        mode = 'E'.
      ENDIF.
      CALL TRANSACTION 'VA01' USING bdcdata
                              MODE mode
                              UPDATE 'A'
                              MESSAGES INTO message.
      LOOP AT message INTO wa_message.
        SELECT SINGLE * FROM t100 WHERE sprsl = wa_message-msgspra
                                  AND   arbgb = wa_message-msgid
                                  AND   msgnr = wa_message-msgnr.
        IF sy-subrc = 0.
          l_mstring = t100-text.
          IF l_mstring CS '&1'.
            REPLACE '&1' WITH wa_message-msgv1 INTO l_mstring.
            REPLACE '&2' WITH wa_message-msgv2 INTO l_mstring.
            REPLACE '&3' WITH wa_message-msgv3 INTO l_mstring.
            REPLACE '&4' WITH wa_message-msgv4 INTO l_mstring.
          ELSE.
            REPLACE '&' WITH wa_message-msgv1 INTO l_mstring.
            REPLACE '&' WITH wa_message-msgv2 INTO l_mstring.
            REPLACE '&' WITH wa_message-msgv3 INTO l_mstring.
            REPLACE '&' WITH wa_message-msgv4 INTO l_mstring.
          ENDIF.
          CONDENSE l_mstring.
          WRITE: / wa_message-msgtyp, l_mstring(250).
        ELSE.
          WRITE: / wa_message.
        ENDIF.
      ENDLOOP.
    *&      Form  bdc_dynpro
    *       text
    *      -->PROGRAM    text
    *      -->DYNPRO     text
    FORM bdc_dynpro  USING    program dynpro.
      CLEAR wa_bdc.
      wa_bdc-program = program.
      wa_bdc-dynpro  = dynpro.
      wa_bdc-dynbegin = 'X'.
      APPEND wa_bdc TO bdcdata.
    ENDFORM.                    " bdc_dynpro
    *&      Form  bdc_field
    FORM bdc_field  USING    fnam fval.
      CLEAR wa_bdc.
      wa_bdc-fnam = fnam.
      wa_bdc-fval  = fval.
      APPEND wa_bdc TO bdcdata.
    ENDFORM.                    " bdc_field
    regards,
    Santosh Thorat

Maybe you are looking for