02-02-2016 4:10 AM
Hi all,
I am developing the table control in module pool.User needs to use table control to enter the data in it manually and store it in the database.
the table control has following fields for example :
SR NO NAME PLACE CITY
1 AAA BBB CCC
2 DDD EEE FFF
3 GGG MMM PPP
The requirement is the serial no. column in the table control should be filled automatically by default like 1,2,3 and so on.....and the user wants just to fill the remaining details like name,place and city without modifying the serial no.
The user should not be allowed to modify the serial no. and also when user presses insert button, the new row inserted should have the appropriate serial.no filled automatically.
please help me with the required code and where to write it in my module pool.
please request you all to provide me solutions on this.
Thanks in advance for ur help...
Regards,
Akil syed.
02-02-2016 5:08 AM
hi see below code
pbo
LOOP WITH CONTROL PMC_TC.
MODULE NEW_WNTRY.
ENDLOOP.
MODULE NEW_WNTRY OUTPUT.
CLEAR GS_PMCM.
READ TABLE GT_PMCM INTO GS_PMCM INDEX PMC_TC-CURRENT_LINE.
GS_PMCM-SLNO = PMC_TC-CURRENT_LINE. "automatci serial no setting
CONDENSE GS_PMCM-SLNO NO-GAPS. "automatci serial no setting
ENDMODULE.
screen
set serial no field in display mode in screen.
02-02-2016 5:02 AM
Hi Akil,
In screen layout, double click on field 'SR. NO' and set input/ouput not possible in properties. That way 'SR no' field will become non editable.
Regarding auto-updation , make use of sy-loopc.
SY-LOOPC gives the total no of records in table control.
So you can do it as sr no = sy-loopc + 1 or something.
Regards,
Rohini.
02-02-2016 5:03 AM
Hello Akil,
The code will written in PAI.
About the serial number issue,you can use sy-tabix in order to provide the automatic serial number.
You have to pass sy-tabix to your workarea,when you are modifing the internal table.
Regards
Siddhant Patel
02-02-2016 5:08 AM
hi see below code
pbo
LOOP WITH CONTROL PMC_TC.
MODULE NEW_WNTRY.
ENDLOOP.
MODULE NEW_WNTRY OUTPUT.
CLEAR GS_PMCM.
READ TABLE GT_PMCM INTO GS_PMCM INDEX PMC_TC-CURRENT_LINE.
GS_PMCM-SLNO = PMC_TC-CURRENT_LINE. "automatci serial no setting
CONDENSE GS_PMCM-SLNO NO-GAPS. "automatci serial no setting
ENDMODULE.
screen
set serial no field in display mode in screen.
02-02-2016 5:23 AM
Thank u so much krishna murthy......your logic really worked fine........
Thanks a lot all for your quick replies....
Regards
Akil.