08-06-2014 10:10 AM
Hi all,
i have created a table control wizard in my screen and in that my need is to populate automatically increasing serial number in it.
For this purpose i have written these code lines, but i am not getting what i wants, but i get the row has been appended one after another.
Please see my code and tell me where i am doing wrong. Here it_zlname is the name of my internal table i have used in my table control wizard
and SNO is the field which i need to auto increment.
DATA: count(2) TYPE n.
MODULE MODIFY INPUT.
DESCRIBE TABLE it_zlname LINES count.
count = count + 1.
IF wa_zlname-SNO IS INITIAL.
wa_zlname-sno = count.
APPEND wa_zlname to it_zlname.
ELSE.
MODIFY IT_ZLNAME
FROM WA_ZLNAME
TRANSPORTING sno PER_RES name CONTACT_NO
ADDRESS ADV_FEES WHERE sno = wa_zlname-sno.
ENDIF.
ENDMODULE.
08-06-2014 10:23 AM
08-06-2014 10:30 AM
Hi,
initially before pressing ENTER , when user puts the values in Table Control it is
and when user Press ENTER, it is coming as
But my requirement is that it should be 2 as SNO in second row and the other columns should be blank.
08-06-2014 10:41 AM
I think you have not used the LOOP .. ENDLOOP in the flow logic.
Check programs -
DEMO_DYNPRO_TABCONT_LOOP
DEMO_DYNPRO_TABCONT_LOOP_AT
demo_dynpro_step_loop
Thanks,
Mahantesh
08-06-2014 10:44 AM
one question u will input the first row i.e. first serial no???
If yes, then u input value in PER RES column or SNO column...???
this wud be ur MAIN where u decalre PBO and PAI
PROCESS BEFORE OUTPUT.
MODULE status_9000.
LOOP AT it_zlname INTO wa_zlname1
WITH CONTROL table1 CURSOR table1-current_line.
MODULE display_data.
ENDLOOP.
PROCESS AFTER INPUT.
MODULE user_command_9000.
LOOP AT it_zlname.
MODULE insert_it.
ENDLOOP.
NOW in PAI
write
if it_zlname-sno is not initial.
append it_zlname.
else.
describe logic..
count = count + 1.
append statement
endif
try this and let me know if it works??
08-06-2014 11:00 AM
Hi,
no i don't put first SNO , it should come by default, when user will go for entry in first row and press ENTER, it should come 1 in first row and 2 in second row, and this should increase on each ENTER.
I have changed my code as in PAI , i have written these code
LOOP AT IT_ZLNAME.
CHAIN.
* FIELD WA_ZLNAME-P_TYPE.
FIELD WA_ZLNAME-PER_RES.
FIELD WA_ZLNAME-SNO.
FIELD WA_ZLNAME-NAME.
FIELD WA_ZLNAME-ADDRESS.
FIELD WA_ZLNAME-CONTACT_NO.
FIELD WA_ZLNAME-ADV_FEES.
MODULE INSERT.
MODULE ZLEGAL_MODIFY ON CHAIN-REQUEST.
endchain.
FIELD WA_ZLNAME-SEL
MODULE ZLEGAL_MARK ON REQUEST.
ENDLOOP.
and inside it , i wrote these lines of code but nothing changes, still the result is same.
MODULE INSERT INPUT.
DESCRIBE TABLE it_zlname LINES count.
count = count + 1.
IF wa_zlname-SNO IS INITIAL.
wa_zlname-sno = count.
APPEND wa_zlname to it_zlname.
ELSE.
MODIFY IT_ZLNAME
FROM WA_ZLNAME
TRANSPORTING sno PER_RES name CONTACT_NO
ADDRESS ADV_FEES WHERE sno = wa_zlname-sno.
ENDIF.
ENDMODULE.