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: 

how we can get mark field in table control designing?

former_member593554
Participant
0 Kudos
1,425

hi guru's,

how we can get mark field in table control while designing a screen having table control ?

if i select mark while deleting i want delete particular record only.

give some example code i referred demo_dynpro_tabcon_loop_at also.

1 ACCEPTED SOLUTION

Former Member
177

Hi satheesh,

Do the following:

-> Go to the Screen painter of your screen (Alternatively from SE51)

-> double click on the table control

-> On the attributes window... on the botton check on the <b>w/ selcolumn</b> checkbox.

-> Provide the field name for it... It should be of the form <Ztable name>-<Fieldname> or alternatively <internal table name>-<fieldname> whichever your have used in your table control.

Note: The internal table or the transparent table must have the field in it.. with the same name as you have given here.

code to delete is as follows:

<b>Case 'okcode'.

WHEN 'DELETE'. " okcode for the delete button

LOOP AT itab WHERE mark = 'X'.

CALL FUNCTION 'POPUP_TO_CONFIRM' "confirm deletion

EXPORTING

TITLEBAR = 'Confirm Deletion of Record'

text_question = 'Are you sure you want to delete record from the database?'

TEXT_BUTTON_1 = 'Yes'(001)

TEXT_BUTTON_2 = 'No'(002)

IMPORTING

ANSWER = lv_answer.

if lv_answer eq '1'.

DELETE itab WHERE mark = 'X'.

REFRESH CONTROL 'TABCTRL' FROM SCREEN 666.

MESSAGE i003(zmsg146911).

ELSE.

MESSAGE i004(zmsg146911).

endif.

ENDLOOP.

ENDIF.</b>

This will solve your problem!!

<b>*REWARD IF USEFUL*</b>

Regards,

Naveenan.

4 REPLIES 4

Former Member
178

Hi satheesh,

Do the following:

-> Go to the Screen painter of your screen (Alternatively from SE51)

-> double click on the table control

-> On the attributes window... on the botton check on the <b>w/ selcolumn</b> checkbox.

-> Provide the field name for it... It should be of the form <Ztable name>-<Fieldname> or alternatively <internal table name>-<fieldname> whichever your have used in your table control.

Note: The internal table or the transparent table must have the field in it.. with the same name as you have given here.

code to delete is as follows:

<b>Case 'okcode'.

WHEN 'DELETE'. " okcode for the delete button

LOOP AT itab WHERE mark = 'X'.

CALL FUNCTION 'POPUP_TO_CONFIRM' "confirm deletion

EXPORTING

TITLEBAR = 'Confirm Deletion of Record'

text_question = 'Are you sure you want to delete record from the database?'

TEXT_BUTTON_1 = 'Yes'(001)

TEXT_BUTTON_2 = 'No'(002)

IMPORTING

ANSWER = lv_answer.

if lv_answer eq '1'.

DELETE itab WHERE mark = 'X'.

REFRESH CONTROL 'TABCTRL' FROM SCREEN 666.

MESSAGE i003(zmsg146911).

ELSE.

MESSAGE i004(zmsg146911).

endif.

ENDLOOP.

ENDIF.</b>

This will solve your problem!!

<b>*REWARD IF USEFUL*</b>

Regards,

Naveenan.

0 Kudos
177

hi Naveenan.

i declared a structure with the fields what ever my transparent table having and SEL field .But iam using wizarad table control .After giving table control name in next screen there are two options 1) dictionary table

2) internal program table.

when iam selecting dictionary table option i cannt able to get my structure ?

so what can i do for this.

0 Kudos
177

Hi satheesh,

Firstly, Using a Table Control wizard is not recommented unless you want to use the standard features and not much of customizing is to be done.

You have two options to add the SEL field(or usually a Mark field) in your program,

-> If you have defined a structure in your program.

>>>>>>>>>> Create an internal program with the structure

Data: itab type table of stru(your structure).

>>>>>>>>>> Use that internal program table in your table control wizard of the given two options.

-> If you want to use the dictionary table option then try to add the SEL field (<b>Type CHAR and Length 1</b>) directly in the dictionary table you give in the table control.

First method is advisable!

*Reward Points and earn points yourself*

regards,

Naveenan.

Message was edited by:

Naveenan

former_member196299
Active Contributor
0 Kudos
177

Hi Satheesh ,

There is an option for selection in the attributes of the table control , if you want to mark a line / select a line then you declare a variable SEL of CHAR 1 and use it there .

Then when you select a line on the table control then you can loop at your internal table containing the records of TC and delete or do the needed operations .

Regards,

Ranjita