2012 Nov 06 1:18 PM
dear experts,
i have one table control requirement.
suppose my table control have 4 column and 20 rows. it contain the first value as shown below
1st 2nd 3rd 4th
......................................................
10 kg kilogram 2
now i want to upload data from 2nd row. i have written code for this like :
data : it type standard table of ............
wa type ..........
data : lv_indx(2) type N,
lv_indx = 2. ( if i assign here '1' it will overlap with 1st one.)
loop at it into wa.
// codes here......
lv_indx = lv_indx + 1.
endloop.
suppose i have uploaded 3 data here.(means 4 rows )
it works fine up to here. now, problem cames here.
suppose again i want to upload 3 data here..
so, data should comes to the 5th column , 6th & 7th.
how to solve this issue so, that data will be uploaded from next row.
help plz.
2012 Nov 06 1:31 PM
Hi Santosh,
I'm not sure I understand your question. What do you mean by "5th column , 6th & 7th"? You wrote your table has 4 columns-- are you trying to add new columns?
Or are you trying to append new rows onto the table, e.g., APPEND wa TO itab?
Or are you trying to insert a new row at a specific index in the table, e.g., INSERT wa INTO itab INDEX idx?
Please provide more detail about your requirement.
Cheers,
Amy
2012 Nov 06 1:37 PM
2012 Nov 06 1:40 PM
Hi Santosh,
Then does APPEND or INSERT meet your requirement to add rows to the table?
Cheers,
Amy
2012 Nov 06 1:40 PM
dear experts,
i have one table control requirement.
suppose my table control have 4 column and 20 rows. it contain the first value as shown below
1st 2nd 3rd 4th
......................................................
10 kg kilogram 2
now i want to upload data from 2nd row. i have written code for this like :
data : it type standard table of ............
wa type ..........
data : lv_indx(2) type N,
lv_indx = 2. ( if i assign here '1' it will overlap with 1st one.)
loop at it into wa.
// codes here......
lv_indx = lv_indx + 1.
endloop.
suppose i have uploaded 3 data here.(means 4 rows )
it works fine up to here. now, problem cames here.
suppose again i want to upload 3 data here..
so, data should comes to the 5th , 6th & 7th rows.
how to solve this issue so, that data will be uploaded from next row.
help plz.
2012 Nov 06 1:43 PM
Actually,
it's a bdc requirement. so, i have to upload data index wise.
apeend or insert doesn't work here..
2012 Nov 07 3:46 PM
Hi Santhosh,
No need to use index.
use the statement.
modify itab from wa_itab.
if sy-subrc ne 0.
append wa_itab tp itab.
endif.
2012 Nov 07 5:57 PM
Santosh, please be more specific in your questions. If you have mentioned at the very beginning that this was for BDC then the whole example wouldn't be necessary. Otherwise everyone just gets confused and you get no answer.
I believe this question (or a similar one) has already been answered on SCN since this is not an unusual task with BDC. In such cases it is usually required to read the existing entries first and then calculate the position where new entries need to be added. It might be more complex if data does not fit on one screen, so you'd have to program for scrolling. Please do more search on SCN, all this has already been discussed many times.
I'm assuming you have already done research to confirm that BDC is the only option and there is no BAPI or other alternative available. If not, please do so first.
Good luck.