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: 

Table Control With Check Box.

Former Member
0 Kudos

Hi,

I have displayed data in a table control with a check box field. Now, the users checks the correspondng record and then press the save button. Then the record should come into display mode and also that record should append in the Zdbtable.

For this in which module PBO or PAI we have to write the code and How to find out which record he checked ?

Bye,

Satya.

6 REPLIES 6

Former Member
0 Kudos

Hi,

see this thread.

rgds,

bharat.

0 Kudos

Hi,

You need to execute a module in LOOP AT itab with TABLE CONTROL in both PBO and PAI.

In PAI module you need to push the data into the internal table and then into the Database table suing INSERT.

And in the PBO module you need to disable the new records edit mode using

MODULE init_tab OUTPUT.

LOOP AT SCREEN

CHECK SCREEN-NAME = 'Your field".

SCREEN-INPUT = 0.

MODIFY SCREEN

ENDLOOP.

ENDMODULE.

The code will be

PBO.

LOOP AT itab with table control.

module init_tab.

ENDLOOP.

PAI.

LOOP AT Itab with TABLE CONTROL.

module save_data.

ENDLOOP.

Regards,

Sesh

0 Kudos

Hi,

Thanks for your suggestion.

In the PAI after LOOP at ITAB nothing is accepted even with Table Control also.

and which one we have to use Modify or Insert ?

If insert can i have the sample code because the structure of the dbtable and internal table or differenent. in that case can we use like this .?

dbtable-field1 = itab-field1.

dbtable-field2 = itab-field2.

insert dbtable.

is it correct or not ?

Bye,

Satya.

0 Kudos

Hi,

You have to use modify first.If it fails then do append like this.

PROCESS AFTER INPUT.

LOOP AT it_marc.

CHAIN.

FIELD x_marc-matnr.

FIELD x_marc-xchar.

FIELD x_marc-mmsta.

MODULE tc2_modify ON CHAIN-REQUEST.

ENDCHAIN.

FIELD x_marc-sel

MODULE tc2_mark ON REQUEST.

ENDLOOP.

MODULE user_command_9001.

MODULE tc2_modify INPUT.

<b> MODIFY it_marc FROM x_marc INDEX tc2-current_line.

IF sy-subrc NE 0.

APPEND x_marc TO it_marc.

ENDIF.</b>

ENDMODULE.

*---->For updating your table

MODULE user_command_9002 INPUT.

CASE ok_9002.

WHEN 'SAVE'.

loop at it_marc into x_marc where sel = 'X'.

<Modify the zable>.

Endloop.

ENDCASE.

ENDMODULE. " USER_COMMAND_9002 INPUT "TC2_MODIFY INPUT

Message was edited by:

Vigneswaran S

0 Kudos

Hi,

loop at screen.

if screen-name = 'itab-check'.

if itab-check = 'x'.

screen-input = 0.

endif.

endif.

endloop.

Is it the right way to check wheather the check box has checked or not and if it is checked then we have to disable that check box for not selecting next time.

other wise is there any way help me.

Bye,

Satya.

0 Kudos

Hi,

Set one flag variable in itab of the table control and set taht flag = 'X whn you save the selected record into the ztable.Then In PBO, do like this.

PROCESS BEFORE OUTPUT.

LOOP AT it_t001l INTO x_t001l WITH CONTROL tc CURSOR tc-current_line.

MODULE tc_get_lines.

ENDLOOP.

MODULE tc_get_lines OUTPUT.

IF x_t001l-flag = 'X'.

LOOP AT SCREEN.

IF screen-name = 'X_T001L-SEL'.

screen-input = 0.

MODIFY SCREEN.

ENDIF.

ENDLOOP.

ENDIF.

ENDMODULE. "TC_GET_LINES OUTPUT

*---->In PAI, For saving

MODULE user_command_9002 INPUT.

CASE ok_9002.

WHEN 'SAVE'.

loop at it_marc into x_marc where sel = 'X'.

<Modify the zable>.

<b>x_marc-flag = 'X'.

modify it_marc from x_marc transporting flag.</b>

Endloop.

ENDCASE.

ENDMODULE. " USER_COMMAND_9002 INPUT "TC2_MODIFY INPUT

Message was edited by:

Vigneswaran S