Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Regarding the column in table control

akil_syed1
Explorer
0 Kudos

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.

1 ACCEPTED SOLUTION

former_member241258
Active Participant
0 Kudos

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.

4 REPLIES 4

Former Member
0 Kudos

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.

0 Kudos

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

former_member241258
Active Participant
0 Kudos

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.

0 Kudos

Thank u so much krishna murthy......your logic really worked fine........

Thanks a lot all for your quick replies....

Regards

Akil.