Wizard generated table control: bug in insert line function?

Hi,
I added a table control to a dynpro using the wizard in the screen painter. Now I have an issue with the inserting line button:
If I add a new line the first time, a new empty line is added to the table control before my last line. So far so good.
If I add now another line, again a new line empty is added before my last line and two lines are added after my last line: one empty line and a line with the same content as my former second last line.
The following should explain it a bit better:
table before inserting new line:
line 1
line 2
line 3
line 4
line 5
after inserting a new line:
line 1
line 2
line 3
line 4
new empty line
line 5
table before inserting the second line:
line 1
line 2
line 3
line 4
line 5
line 6
after inserting the second line:
line 1
line 2
line 3
line 4
line 5
new empty line
line 6
new empty line
line 5
I didn't change the generated coding yet!
Thanks in advance and regards,
Martin
Edited by: fischerman on May 29, 2008 9:08 AM

Here is the code of the form which is called in PAI if the insert button was pressed:
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

Similar Messages

  • To handle cursor position in table control while using insert initial line

    hi,
          I have a requirement to handle cursor position in my table control in which i am using insert initial line by incrementing the index. Now i am handling the cursor position by using set cursor but after 14 records it is going to the first field of the screen. My table control length is 14 records.
          How to handle this, please reply me if anyone know.
    thanks & regards,
        sekhar.

    hi,
             I need to page down the page and then want to set cursor position but for this system command i am getting space for every command. Page down and cursor down or enter every thing it is taking as space. So for this how can i handle it.
    thanks & regards,
        sekhar.

  • Table control disables all the lines

    hi Goo day,
    i have worked a lot on on TC and am struggling to get it right with the insert option.
    i have button on the main screen where i read the data and fill the table control and display on the RADIO Button How many records are in the TC.
    So i click the button and get into the TC but accept the records that i have displayed will all be disabled. even if i try to enable a line by insert i cant do it.
    PROCESS AFTER INPUT.
    LOOP AT IT_WAGON.
       chain.
       field : IT_WAGON-TRAIN_NUM,
               IT_WAGON-DELAY_MIN.
        MODULE modify_tabview_wagon.
       endchain.
    ENDLOOP.
       IF sy-ucomm = 'INST'.
          DESCRIBE TABLE it_wagon LINES v_count.
         ADD 1 TO v_count.
         INSERT it_wagon INDEX v_count.
        ENDIF.
    i want to know why they are are disabled.
    what can i do to overcome.

    Do this in the PBO.
    rob

  • WIZARD FOR TABLE CONTROL DOCUMENTS REQUIRED

    hI ALL,
    cAN ANYBODY SEND ME DOCUMENTS RELATED TO TABLE CONTROL USING WIZARD.i NEED TO CREATE A TABLE IN WHICH I WOULD FILL THE TABLE WITH AND WHEN I SAVE IT I NEED THE ZTABLE TO BE UPDATED .
    cAN ANYBODY SEND ME SOME DOCUMENTS REGARDING HOW TO USE WIZARD.
    mY EMAIL ID :
    [email protected]
    tHANKS IN ADVANCE

    Hi Kajol,
    I was searching online and came with this short steps from this link:
    http://sap.ittoolbox.com/groups/technical-functional/sap-r3-dev/dialogprogramcall-dump-725857#
    (1) drag the table control (with wizard) on the full screen. (2) press continue. (3) enter the name of your table control (any name you want) (4) press continue (5) select 'internal table' (6) enter name of your internal table (the one that contains data to be displayed for table control) (7) press continue (8) fields of your itab will be displayed then, select the fields you want to be seen on your table control (9) continue pressing 'continue' until complete button is shown (10) press 'complete'.
    I tried giving database table name instead of internal table at point number (6).
    Also, did you go thru this link:
    http://help.sap.com/saphelp_nw04/helpdata/en/6d/150d67da1011d3963800a0c94260a5/content.htm
    Hope this will be of some help to you.
    Regards,
    Vivek

  • How to update DBtable in table control (MPP) for selected lines.

    Hi Folks,
    I need to update DBtable from the table control after modification of  only multiple selected rows.
    But my issue. any row if edited is being modified in DBtable.
    Client does not want me to use Check box so im using Selcolumn in module pool table control.
    Please help me in resolving the issue. Let me know if you have any queries
    Thanks
    Reddy

    Hi Reddy,
    Hope it helps.
    For  Sel column.
    Declare:
    Data : SEL  TYPES XFELD in Structure.
    Double click on the sel  field     give the structure name and field name as below in screen shoot.
    In Flow logic.
    PROCESS AFTER INPUT.
    loop at it_tab.
        FIELD YTBLCTRL-SEL.
    MODULE update.
    ENDLOOP.
    MODULE Updatedb.
    In Editor.
    MODULE UPDATE INPUT.
       MODIFY it_tab FROM YTBLCTRL INDEX tbc1-current_line.
       if ytblctrl-sel IS NOT INITIAL.
       lv_cnt = lv_cnt + 1.
       endif.
    ENDMODULE.
    MODULE UPDATEDB INPUT.
    Case sy-ucomm.
    WHEN 'SAVE'.
    if lv_cnt is NE '1'.
    Message 'select more than one item.
    else.
    Update DB.
    endif.
    Endcase.
    Regards,
    Venkat.

  • Add Line in Table control

    Hi,
       I have a proble in table control where my table control have 3 lines and when i enter three records i can see the records in table control scrren and when i want to add a 4 th line  i need to press a BUTTON.when i press the button a new line inserted but i need to scroll to see the fourth record,but my req ments is to see the 4th record in the 3 rd line of the table control and 3 rd will be seen in the 2 nd line of the table control. Is there any good soultions to achieve this.
    Thanks,
    Deesanth

    Hi Deesanth,
    In the PBO of the screen just add code:-
    tab_ctrl-lines = tab_ctrl-lines + 10. "tab_ctrl is name of table control
    This will insert 10 extra line in the table control.
    You can see these empty line when you scroll the vertical scroll bar of the table control.
    Hope this solves your problem.
    Thanks & Regards,
    Tarun Gambhir

  • How can I insert, modify and delete entries on my table control?

    Hi,
    I already have build a table control. Now I want to make manipulations on it. Therefore I have created 3 buttons, insert, modify and delete. But how can I get actions on table control.
    This is my code for the internal table:
    BEGIN OF its OCCURS 0,
    mark TYPE C VALUE ' ',
    artikel_nr TYPE ZARTIKEL-ARTIKEL_NR,
    artikel_typ TYPE ZARTIKEL-TYPE,
    bezeichnung TYPE ZARTIKEL-BEZEICHNUNG,
    preis TYPE ZARTIKEL-PREIS,
    mwst TYPE ZARTIKEL-MWST,
    END OF its.
    and this is the code which i wanted to  delete a row in my table control:
    WHEN 'DELETE'.
    LOOP AT its WHERE mark EQ 'X'.
    DELETE its WHERE mark = 'X'.
    MOVE its TO ZARTIKEL.
    ENDLOOP.
    ENDCASE.
    ENDMODULE:
    and my PBO and PAI:
    PROCESS BEFORE OUTPUT.
    LOOP AT its INTO ZARTIKEL WITH CONTROL ARTIKEL.
    ENDLOOP.
    PROCESS AFTER INPUT.
    MODULE EXIT.
    LOOP AT its.
    MODULE V1.
    ENDLOOP.
    MODULE user_command_1060.
    But if I now open my table control and mark the line that I wanted to delete, nothing happens, not on my internal table and the data even not deleted on my table ZARTIKEL. Have you an idea what I did wrong??

    Hi,
    In the attributes of table control take the SELCOL as wa_zekpo-flag
    And in the internal table and work area add a field as flag(1) TYPE c
    Refer:
    At screen logic:-
    PROCESS BEFORE OUTPUT.
      MODULE status_8002.
      LOOP WITH CONTROL po_tab.
        MODULE pass_data.
      ENDLOOP.
    PROCESS AFTER INPUT.
      MODULE user_command_8002.
      LOOP WITH CONTROL po_tab.
        MODULE modify_data.
      ENDLOOP.
      MODULE function.
    In PBO,
    MODULE status_8002 OUTPUT.
      SET PF-STATUS 'ZTG_SELTB'.
      DATA : line_count TYPE i.
      DESCRIBE TABLE it_ekpo
      LINES line_count.
      po_tab-lines = line_count + 5.
    ENDMODULE.                 " STATUS_8002  OUTPUT
    *&      Module  PASS_DATA  OUTPUT
    MODULE pass_data OUTPUT.
      READ TABLE it_ekpo into wa_ekpo INDEX po_tab-current_line.
    ENDMODULE.                 " PASS_DATA  OUTPUT
    In PAI,
    *&      Module  USER_COMMAND_8002  INPUT
    MODULE USER_COMMAND_8002 INPUT.
      OK_CODE = SY-UCOMM.
      CASE OK_CODE.
        WHEN 'BACK'.
          LEAVE TO SCREEN 8001.
        WHEN 'EXIT'.
          LEAVE PROGRAM.
      ENDCASE.
    ENDMODULE.                 " USER_COMMAND_8002  INPUT
    *&      Module  MODIFY_DATA  INPUT
    MODULE DISPLAY_DATA INPUT.
      MODIFY IT_EKPO INDEX PO_TAB-CURRENT_LINE FROM WA_EKPO.
    ENDMODULE.                 " MODIFY_DATA  INPUT
    *&      Module  FUNCTION  INPUT
    MODULE FUNCTION INPUT.
      OK_CODE = SY-UCOMM.
      CASE OK_CODE.
        WHEN 'SELECT'. "<--select all records
          LOOP AT IT_EKPO INTO WA_EKPO.
            WA_EKPO-FLAG = 'X'.
            MODIFY IT_EKPO FROM WA_EKPO.
          ENDLOOP.
        WHEN 'DESEL'. "<--deselect all records
          LOOP AT IT_EKPO INTO WA_EKPO.
            WA_EKPO-FLAG = ' '.
            MODIFY IT_EKPO FROM WA_EKPO.
          ENDLOOP.
        WHEN 'DELETE'.
          DELETE FROM it_ekpo WHERE flag = 'X'.
      ENDCASE.
    ENDMODULE.                 " FUNCTION  INPUT
    Regards,
    Tarun

  • Table control lines cannot be controlled in Batch Input session ?

    I am using a program which creates Batch Input sessions for the transaction FCHR (Online cashed checks) . The second screen is that of a table control where the check number is entered.
         I observed that while doing SHDB, if we tick the default size then changing the desktop resolution has no effect on the number of lines in table control - we see 14 lines in both cases.However, when the batch input session is processed, the number of table control lines varies according to the resoution(9 lines for 800600 and approx 15 for 1024768). Selecting the 'Dynpro standard size' option while processing the session has no effect.
      I know call transaction with 'default' parameter in optparam will take care of this problem. But I want to know whether Batch Input Session is known to have a problem with different resolutions.

    HI..
    i had the same problem once.... i dealt in the following way
    while entering values in table control
    1) enter value in the first line
    2) look for button on application toolbar using which you can increment line
    3) you will not find difference for first line but you will find it when you insert second line and go for next line.
    4) now for every increment you will get table conrol as (02) if you are going for recording.
    this will surely solve all issue related to table control as it solved for me
    regards
    Edited by: Mohit Kumar on Feb 19, 2009 12:04 PM

  • Copy selected lines in the table control

    Hi friends,
    I Have a screen 200 in which i have a button COPY and table control.
    In my table control i have 6 lines of data.
    now my requirement is when i select any lines  ie :  let us say i ahve selected 1 , 3 , 5 lines of my table control and when i click on the button COPY of that screen. i need those 3 selected lines 1 , 3 , 5 to be copied again in the table control
    example  :
    line 1         selected
    line2
    line3          selected
    line4
    line5          selected .
    line6
    now my table control should be
    line1
    line2
    line3
    line4
    line5
    line6
    line1
    line3
    line5
    How can i do that
    Regards
    Priyanka.

    I have similar issue...i need help how to accomplish automatic addition on every line.  example (see below)
    this is how it looks right now
    DATE    EMPLOYEE       DEPT JOB     LOT     OPER#     LX_HRS     OP_SETUP     LX_TYPE     COMPLETE
    2/23/2009     M.Paquiao   NB         1960     001     10             1.50                14.00                     S                      NO
    2/24/2009                                                      1.00             14.00                  S                        NO
    2/25/2009                                                      4.50                14.00                  S                    NO
    2/27/2009                                                      3.00             14.00                  S                        NO
    2/28/2009                                                      1.50             14.00                  R                       YES
    3/1/2009                                                      2.00             14.00                  R                  YES
    this what I need it to do when I meant automatic addition of each line:
    DATE   EMPLOYEE     DEPT     JOB     LOT     OPER#     LX_HRS     OP_SETUP     LX_TYPE     COMPLETE
    2/23/2009     M.Paquiao      NB        1960     001     10             1.50        14.00               S         NO
    2/24/2009                                                      2.50             14.00                  S             NO
    2/25/2009                                                      7.00        14.00                  S             NO
    2/27/2009                                                      10.00     14.00               S             NO
    2/28/2009                                                      11.50     14.00               R             YES
    3/1/2009                                                      13.50     14.00               R             YES
    As you can see everything is the same but on column LX_HRS, the first example one is not doing anything addition but on the second example is now doing addition.  This additions were done manually, how can I tell crystal to add each line, in the example above, the
    first example                                              second example: (addition is involved)
    date                lx_hrs                                  date                  lx_hrs
    2/23/09           1.50                                     2/23/09              1.50
    2/24/09           1.00                                     2/24/09              2.50 (sum of : 1.50 + 1.00 was added)
    2/25/09           4.50                                     2/25/09              7.00 (sum of 2.50 (on date 2/24/09 &  4.50 from date 2/25/09 of the first example).

  • Long text in table control lines

    If i put long text  buttons on the  table control coulum, when the line  is deleted  from the table, the text for tha line  are permenantly deleted before the screen is saved in the user command. how do i correct the problem ?
    regards
    Rendani

    Use the FM for text delete when u press save button and not at table control delete command.
    physically delete the line from table control and put it in internal table which can be used for deletion purpose at time of actual deletion...

  • How to determine line number on Table control in BDC

    Hi,
    I am uploading changes for CG02 using BDC. I have to change data to specification type which are listed in a table control having some of the fields as IDCAT, IDTYPE, LANG, ORD, IDENT etc.
    For a particular substance number, there can be variable number of idtypes. Since there were 8 Idtypes already created for the substance number I was working with while recording and I created 9th Idtyep(Z_SARADOT#) while recording (Using SHBD), I am getting the code like ...'ESTRI-IDTYPE(09)....ESTRI-IDCAT(09).....'RCGRIIOT-IDENT(09)' which indicate that while recording, the values were added on 9th line of table control.
    Now this line number can vary for other substance number. How can I know
    (1) The last line of table control
    (2) Line number based on Value of field
        Example - here I want to know line number corresponding to IDTYPE Z_SARADOT# if it was created so that I can change the value of field IDENT of the table control.
    The piece of code I got after recording is:
              perform bdc_field       using 'ESTRI-IDTYPE(09)'
                                            'NUM'.
              perform bdc_field       using 'ESTRI-IDCAT(09)'
                                            'Z_SARADOT#'.
              perform bdc_field       using 'RCGRIIOT-IDENT(09)'
                                            '1175'.     
    Please help friends.
    Thanks & Regards,
    Surya

    There are around 800 Substance numbers and for each substance number there are around 10 IDtype. So It would be a costly processing.
    If there no other way doing it?
    I think, I need to follow this way as We can not determine the line number untill BDC is running.

  • Issue finding current line when page down occurs - table control

    HI experts,
    How to find the current line index of the table control? The "Current line" property of table control gives the index of the current line when the cursor is in the first page. If it exceeds the first page, then it is not returning the correct value..
    For example, first page has 10 lines and the cursor is in the 5th line of the 2nd page, then the index must be returned as 15.. But current line returns the value as 5..
    Pls tell me how to find this.

    Hi,
    try this Way...
    IN PBO At MODULE STATUS_<Screen-Number>.
    13 is the number of cells in the Tables control
    TBC_200 is the Table control Name....
      if sy-ucomm = 'PGUP'.
         if TBC_200-current_line GE 14.
            TBC_200-top_line = TBC_200-top_line - 13.
         endif.
      ENDIF.
      if sy-ucomm = 'PGDN'.
         if TBC_200-current_line lE TBC_200-lines.
            TBC_200-top_line = TBC_200-top_line + 13.
         endif.
      ENDIF.
    Regards,
    Prabhudas

  • Module pool in table control wizared

    Hi
    I have created in module pool table control wizared created insert and delete rows in output.
    insert the data in table control the colume is not save.
    can u tell me the save the data in table control.
    pls tell me the flow of save button.
    after insert the record how to save the data in table control wizard in module pool.
    can u tell me the save button functionality.
    after save data will add in table.

    Hi Venkat,
    I think you have already posted this query with the subject line "Table control" with the thread below today.
    table control
    Try with the online link we have provided you will learn that way on your own.
    Nobody here will write the whole logic for you.
    Try to put in your efforts.
    Regards
    Abhii
    Edited by: Abhii on Sep 8, 2010 3:13 PM

  • Table control layout

    Hi All can someone tell me how to design the complete layout of a table control.
    please tell me step-by-step process.
    reward points for all useful ans

    hi,
    •Step 1 (Create new structure for table control)
    Type is name of structure (ZTC_EKKO) and press create
    •Step 2 (Create Program)
    Goto transaction SE80(Object Navigator) -> Repository Browser -> Program.
    Enter your program name, please ensure that is begins with SAPMZ…… as this is a module pool (dialog program).
    Press enter to create, and press yes!
    Ensure that you create a top include, and press Enter.
    Accept the name created for the top include.
    Press Enter.    
    Press Save
    •Step 3 (Create TOP include)
    Double click on the top include and enter following ABAP code:
    Tables: ZTC_EKKO.
    controls: tc100 type tableview using screen 100.
    data: ok_code type sy-ucomm.
    data: it_ekko type standard
                 table of ZTC_EKKO initial size 0,
               wa_ekko type ZTC_EKKO.
    data: ok_code type sy-ucomm.
         Press Save and Activate
    •Step 4 (Create screen)
    Right click the program to create a screen 100 for the dialog. Enter Short description, set screen type to Normal and enter 0 or blank into Next screen. Then move to Element List tab and enter the OK code as OK_CODE (i.e. the same as what you declared in the top include with data: ok_code type sy-ucomm).
    •Step 5 (Create table control)
    Press the Layout button to bring up the screen painter editor.
    Press table control button and drag it on to the screen, enter the name of table control created in TOP include (TC100). Now press the yellow button for attributes and set the table control as below options
    •Step 6 (Populate table control )
    Press the orange button (Fields). On the next screen enter ZTC_EKKO and press the ‘Get from Dict’ button. Select the fields you want (all) and press enter. Now drag them onto your Table Control.
    Below is the result, there will been syntax errors if we check now! So Save and go back into the flow logic tab.
    •Step 7 (Create flow control )
    Within the flow logic of screen 100 and create two modules, one to select the data from the database and the other to move the selected fields into the table control. Also insert the two loop statements to populate and retrieve the lines of the table control.
    PROCESS BEFORE OUTPUT.
    MODULE STATUS_0100.
      module data_retrieval.
      loop at it_ekko into wa_ekko with control TC100.
        module populate_screen.
      endloop.
    PROCESS AFTER INPUT.
      loop at it_ekko.
      endloop.
    MODULE USER_COMMAND_0100.
    Double click the module data_retrieval to create and click yes to get past the popup. Ensure that a new include is created to hold all the PBO modules (default). Press enter.
    Select 10 rows of data from the EKKO table and load into the internal table it_ekko. Go back to the flow logic to load this data into the Table Control.
    ***INCLUDE MZ_TCONTROL_DATA_RETRIEVALO01 .
    *&      Module  data_retrieval  OUTPUT
          text
    MODULE data_retrieval OUTPUT.
    select data from ekko table
      SELECT ebeln bukrs bstyp bsart
             bsakz loekz statu aedat
       UP TO 10 ROWS
        FROM ekko
        INTO CORRESPONDING FIELDS OF TABLE it_ekko.
    ENDMODULE.                 " data_retrieval  OUTPUT
    Double click the module populate_screen to create. Now move the values in this loop from the wa_ekko into the Table Control with the move-corresponding statement.
    MODULE populate_screen OUTPUT.
        DATA: ld_line TYPE i.
      Set which line of table is a top of displayed table control
        IF sy-stepl = 1.
          tc100-lines =
            tc100-top_line + sy-loopc - 1.
        ENDIF.
      move fields from work area to scrren fields
        MOVE-CORRESPONDING wa_ekko TO ztc_ekko.
      ENDMODULE.                 " populate_screen  OUTPUT
    •Step 8 (Create transaction )
    Now create a transaction to test the table control program. Right click the Program and select create-> transaction.
    •Step 9 (Execute transaction )
    Execute transaction ZTC
    but table contro wizrd automatically generates the code. try it
    reward if its useful.

  • Table control scrolling issue

    hi,
          I am having a issue with table control scrolling. When i was passing less number of records (say 19 records becuase table control is having 19 lines) to table control in BDC call transaction, everything is working fine. after filling the 19 line items its not taking the next line item the page is not scrolling down. T.code is <b>GS02</b>. please suggest me. following is my code
    REPORT ZLOCK_WBS_ELEMENTS  MESSAGE-ID ZFI_RESTMT.
                           TYPES                                         *
    *types declaration for final internal table
    types: begin of ty_final,
             ryear       like zupi5a-ryear,  "Fiscal year
             rbukrs      like zupi5a-rbukrs, "Company code
             racct       like zupi5a-racct,  "Account number
             rzzps_posid like zupi5a-rzzps_posid, "WBS element
             rzzmtit     like zupi5a-rzzmtit, "MPM title
             rzzmfor     like zupi5a-rzzmfor, "MPM format
             rzzmatnr    like zupi5a-rzzmatnr, "Material number
             rzzcou      like zupi5a-rzzcou, "Country
             rzzfow      like zupi5a-rzzfow,  "Financial owner
             rzzoow      like zupi5a-rzzoow,  "Operational owner
             rzzcon      like zupi5a-rzzcon,  "Licensee Contract
             rzzloc      like zupi5a-rzzloc, "Licensor Contract
             kostl       like zupi5a-kostl,  "Cost center
             zzfam       like zupi5a-zzfam,  "Fame Number
             zzfor       like zupi5a-zzfor,  "Format
             zzprd       like zupi5a-zzprd,  "Product Line
             zzwin       like zupi5a-zzwin,  "Window group
             zzwig       like zupi5a-zzwig,  "Window
             rtcur       like zupi5a-rtcur,  "Currency Key
             tsl         like zupi5a-tsl,  "Amount Transaction currency
             hsl         like zupi5a-hsl,  "Amount Co. code currency
             ksl         like zupi5a-ksl,  "Amount Group currency
             msl         like zupi5a-msl,  "Quantity
           end of ty_final.
    Data
    data:  j_final2      type standard table of ty_final,
           v_final2      type standard table of ty_final.
    data:  wa_final2     type ty_final.
    data:  bdcdata like bdcdata occurs 0 with header line,
           messtab like bdcmsgcoll occurs 0 with header line.
    data :begin of i_values occurs 0.
            include structure setvalues.
    data :end of i_values.
    data: v_counter(3) type n value '0',
          v_from    like rgsbl-from,
          V_FROM(30) TYPE C,
          v_setname like zfi_setid_cc-setid,
          v_setid like sethier-setid,
          n type i,
          l type i,
          k type i value '1',
          p_rbukrs like zupi5a-rbukrs.
    import p_rbukrs from memory id 'bukrsid'.
    import i_final2 to j_final2 from memory id 'table'.
    To eliminate duplicate WBS elements to be stored into the sets
    v_final2 = j_final2.
    sort v_final2 by rzzps_posid.
    delete adjacent duplicates from v_final2 comparing rzzps_posid.
    select single setid into v_setname
           from zfi_setid_cc
           where rbukrs EQ p_rbukrs.
    IF sy-subrc <> 0.
      MESSAGE E005.
    ENDIF.
    *write 'ZFIRESTATEMENT' to v_setname.
    call function 'G_SET_GET_ID_FROM_NAME'
         EXPORTING
              shortname = v_setname
         IMPORTING
              new_setid = v_setid.
    call function 'G_SET_TREE_IMPORT'
         EXPORTING
              client     = sy-mandt
              langu      = sy-langu
              setid      = v_setid
         TABLES
              set_values = i_values.
    describe table i_values lines n.
    describe table v_final2 lines l.
    write n to v_counter.
    clear bdcdata.
    refresh bdcdata.
    perform bdc_dynpro      using 'SAPMGSBM' '0105'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'RGSBM-SHORTNAME'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    *perform bdc_field       using 'RGSBM-SHORTNAME'
                                 'ZFIRESTATEMENT'.
    perform bdc_field       using 'RGSBM-SHORTNAME'
                                  v_setname.
    loop at v_final2 into wa_final2.
       v_counter = v_counter + 1.
      perform bdc_dynpro      using 'SAPMGSBM' '0115'.
      concatenate 'RGSBL-FROM(' v_counter ')' into v_from.
      perform bdc_field     using 'BDC_CURSOR'
                                  v_from.
      perform bdc_field     using 'BDC_OKCODE'
                                  '/00'.
      perform bdc_field     using 'RGSBS-TITLE'
                                  'FI Restatement-WBS locking'.
      perform bdc_field     using v_from
                                   wa_final2-rzzps_posid.
    endloop.
    perform bdc_dynpro      using 'SAPMGSBM' '0115'.
    perform bdc_field       using 'BDC_CURSOR'
                                  v_from.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=SAVE'.
    perform bdc_field       using 'RGSBS-TITLE'
                                  'FI Restatement-WBS locking'.
    perform bdc_dynpro      using 'SAPMGSBM' '0105'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/EBACK'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'RGSBM-SHORTNAME'.
    call transaction 'GS02'
      using bdcdata
      mode 'A'
      update 'S'
      messages into messtab.
           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                                                  *
    form bdc_field using fnam fval.
      if fval <> ' '.
        clear bdcdata.
        bdcdata-fnam = fnam.
        bdcdata-fval = fval.
        append bdcdata.
      endif.
    endform.
    this is working fine when they r less than 19 line items. please suggest me with the logic when it is more than 19 line items.

    Hi,
    Just try to increase the table control lines before display.
    v_counter = n + 10.

Maybe you are looking for

  • Exporting a report to Excel

    Hi Guys, Is it possible for a simple report (NOT an ALV) to be exported into an excel file? Please let me know how... Thanks a lot! Regards, Mark

  • CST Value Printing Wrongly

    HI, We are using function module CALCULATE_ TAX_ITEM to print the values of VAT & CST.We have a delivery cost condition before the tax calculation.Tax has to be calculated for the price & delivery cost condition.In Purchase Order the tax value are co

  • Mounting USB devices in arch guest

    I'm new to virtualbox, but not to linux.  I have been using arch for at least 3 years, so I have some familiarity with it.  I have recently installed arch as a guest OS on virtualbox (on OSX host).  I am having some trouble accessing an attached USB

  • From London to Australia...

    Hey All Complete technophobe here. Okay so am relocating to Australia in a few weeks. I have an iPhone 4s and will be taking it with me. I have backed up all my contacts on the Cloud, and have now bought iTunes Match also. I have been told to unlock

  • Creative Cloud 2014 processes not stopping

    I am running Creative Cloud 2014 on a Windows 7 system with nVidia Quadro 2000 display adapter.  Since upgrading to CC 2014 I've noticed that a lot of my Creative Cloud programs (Premiere, Audition and After Effects, Media Encoder, and I'm guessing o