‎2008 Dec 24 8:58 PM
HI All,
I'm doing a Table Control module pool Program. Now suppose there are two fields - MATNR & MAKTX.
Our requirement is while weu2019ll give the material No (MATNR field), material desc. will be populated in corresponding field (MAKTX field),
Now the problem is, while we are entering Material No. in 1st row it is Material Desc. coming in to corresponding field but while the data is given to next row it replaces the 1st rows data .
eg - ............................... ........ MATNR.............................MAKTX
1st entry in 1st row ..................... 23................................... XXX --after pressing 'ENTER' mat desc XXX comes. now 2nd entry in 2nd row 24 .............................. YYY --after pressing 'ENTER'
1st row details like MATERIAL NO(23) & Desc(XXX) got deleted & that is replaced by 24 YYY
We can not extend that no. of rows of Table Control Table more than one row.
If you kindly help me how it is possible to increase the no. of rows of that table dynamically without replacing the previous row it will be very helpful for me.
Thanks & Regards,
Biswajit
‎2008 Dec 29 4:21 AM
Hi
Try this out.
In PAI
loop at itab.
field itab-matnr module get_maktx.
module modify_tab.
endloop.
in Program
module get_matkx.
if not itab-matnr is initial.
select single maktx from makt into itab-maktx where matnr = itab-matnr and spras = 'EN'.
endif.
endmodule.
module modify_tab.
describe table itab lines tc-lines.
if tc-current_line > tc-lines.
append itab.
else.
modify itab index tc-current_line.
endif.
endmodule
Cheers.
Ramchander Rao.K
‎2008 Dec 27 7:31 AM
Hi Biswajit,
This probably means that the table control PAI is modifying the first line always in the internal table instead of current line
eg: we wite the code
loop at screen and then modify the internal table with current line
table_control => name of table control as given on screen
in PAI of the screen
loop at internaltable.
modify internaltable index table_control-current_line .
put a break point here and see*
it will always be updating the first record because of some reason - logic error or coding error*
endloop.
Also in PBO we can see that the internal table will be having just one record after the action mentioned above....it is a case of overwrite
To simply increment the number of lines
table_control-lines = table_control-lines + 1. in PAI
Pls check and revert
Hope it helps
Regards
Byju
‎2008 Dec 29 4:21 AM
Hi
Try this out.
In PAI
loop at itab.
field itab-matnr module get_maktx.
module modify_tab.
endloop.
in Program
module get_matkx.
if not itab-matnr is initial.
select single maktx from makt into itab-maktx where matnr = itab-matnr and spras = 'EN'.
endif.
endmodule.
module modify_tab.
describe table itab lines tc-lines.
if tc-current_line > tc-lines.
append itab.
else.
modify itab index tc-current_line.
endif.
endmodule
Cheers.
Ramchander Rao.K