Application Development and Automation 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: 
Read only

Dynamic Check Box Addition

Former Member
0 Likes
1,324

Hello,

my scenario,

I have designed a table using table control now i need to insert check for every row displayed in the table display, so that a user can select multiple rows.

The selected rows now need to be stored in an internal table, when the user press a button on the screen, the internal table will then be passed to Idoc FM to send to external system.

So my question, how to add check box for multiple selection, or is there any other way in table control

Regards,

Abhishek

1 ACCEPTED SOLUTION
Read only

nabheetscn
SAP Champion
SAP Champion
0 Likes
1,240

In your internal table have a field as ZMARK and in your table control double click on it and in properties you can set it with select box w/selcolumn enter you structure field ZMARK name there and choose line selection as multiple

Nabheet

Hello,

my scenario,

I have designed a table using table control now i need to insert check for every row displayed in the table display, so that a user can select multiple rows.

The selected rows now need to be stored in an internal table, when the user press a button on the screen, the internal table will then be passed to Idoc FM to send to external system.

So my question, how to add check box for multiple selection, or is there any other way in table control

Regards,

Abhishek

8 REPLIES 8
Read only

nabheetscn
SAP Champion
SAP Champion
0 Likes
1,241

In your internal table have a field as ZMARK and in your table control double click on it and in properties you can set it with select box w/selcolumn enter you structure field ZMARK name there and choose line selection as multiple

Nabheet

Read only

0 Likes
1,240

Hello,

Now i have got the selection column, now i need to store the selected rows into an internal.

How to proceed for this

i have used table controls and select with selection column in the table control properties, haven't the generated code.

Regards,

Abhishek

Read only

0 Likes
1,240

Hi,

When you will select the columns for marking and you want to press some button please check in PAI during debugging that this field will be automatically marked 'X'..append thoses entries to table and after loop proceed ahead with your logic.

Nabheet

Read only

0 Likes
1,240

Hello,

I tried debugging but keep loosing the track,

My Table control name, ZPRTransfer, this has fields from EBAN table, ie Purchase Requisition Details

Line Selection Name: ZMARK.

I Have two Inputs fields Date from and Date To, and button Zbutton1(Get Data) FCode ZBGD

I need to fetch, data from Eban, into table control, where the user specifies the date range. when a user clicks on Get data.

And once data is fielded in the table control, the user selects the PR number EBAN-BANFN, and selects another button Generated Idoc, now the selected the PR numbers must be stored in the Internal table for some processing.

How do i go abt processing that is getting data into the internal table.

Any sample code, will be appreciated

Regards,

Abhishek

Read only

0 Likes
1,240

Do as follow

Lets say your table control ZPRTransfer fields are in structure in ZWA which also has field ZMARK..In your table control reference ref this field as zwa-zmark.

Lets assue you get 3 line in table control and user use choose 2..

in your loop endloop in PAI

Check if ZWA_ZMARK eq "x'

Append it to itAB_SEND _IDOC table.

endif.

After endloop you can process this internal table to send idocs.

Nabheet

Read only

0 Likes
1,240

Hello,

Using table control wizard, a lot of code was generated, so i started fresh.

this is my abap code

&----


*& Module Pool ZPR_TRANSFER_1000

*&

&----


*&

*&

&----


PROGRAM zpr_transfer_1000.

TABLES: eban.

CONTROLS zprtransfer TYPE TABLEVIEW USING SCREEN '1000'.

TYPES: BEGIN OF prtransfer,

banfn LIKE eban-banfn,

bnfpo LIKE eban-bnfpo,

bsart LIKE eban-bsart,

ekgrp LIKE eban-ekgrp,

afnam LIKE eban-afnam,

txz01 LIKE eban-txz01,

matnr LIKE eban-matnr,

werks LIKE eban-werks,

matkl LIKE eban-matkl,

menge LIKE eban-menge,

meins LIKE eban-meins,

ekorg LIKE eban-ekorg,

bwtar LIKE eban-bwtar,

mfrpn LIKE eban-mfrpn,

mfrnr LIKE eban-mfrnr,

zmark TYPE c,

END OF prtransfer.

DATA: it_pr TYPE STANDARD TABLE OF prtransfer,

wa_pr LIKE LINE OF it_pr.

DATA: it_eban TYPE STANDARD TABLE OF eban,

wa_eban LIKE LINE OF it_eban.

DATA: it_line TYPE sy-loopc.

DATA: ok_code TYPE sy-ucomm,

save_ok TYPE sy-ucomm.

  • Begin of PBO

  • PBO Block, Process Before Output

MODULE status_1000 OUTPUT.

SET PF-STATUS 'SCREEN-1000'.

SET TITLEBAR '001'.

SELECT * FROM eban INTO TABLE it_eban.

ENDMODULE. " STATUS_1000 OUTPUT

----


  • MODULE fill_table_control OUTPUT

----


*

----


MODULE fill_table_control OUTPUT.

LOOP AT it_eban INTO wa_eban.

MOVE-CORRESPONDING wa_eban TO wa_pr.

APPEND wa_pr TO it_pr.

REFRESH CONTROL 'zprtransfer' FROM SCREEN '1000'.

ENDLOOP.

ENDMODULE. " FILL_TABLE_CONTROL OUTPUT

  • End of PBO

  • Begin of PAI

  • PAI Block, Process after Input

MODULE cancel INPUT.

LEAVE PROGRAM.

ENDMODULE. " CANCEL INPUT

&----


*& Module READ_TABLE_CONTROL INPUT

&----


  • text

----


MODULE read_table_control INPUT.

it_line = sy-loopc.

ENDMODULE. " READ_TABLE_CONTROL INPUT

  • End of PAI.

FLOW LOGIC

PROCESS BEFORE OUTPUT.

MODULE status_1000.

LOOP WITH CONTROL zprtransfer.

MODULE fill_table_control.

ENDLOOP.

PROCESS AFTER INPUT.

MODULE cancel AT EXIT-COMMAND.

LOOP with CONTROL zprtransfer.

module read_table_control.

ENDLOOP.

  • MODULE USER_COMMAND_1000.

i also have two date fields, date from and date to. and a button get data, based on the range the table should get filled in EBAN Details currently i havent added the logic for read the date fields as i dont know how to read the fields.

The problem is data is not getting filled in the table control,

any help would be appreciated

Regards,

Abhishek

Read only

Former Member
0 Likes
1,240

Hi,

If you are using with Wizard,

Add a field to the internal table of type c of length 1,

and check the checkbox 'Line Selection Col.' then enter the added fieldname for 'Selection Col.fld'.

Regards

Haritha

Read only

Former Member
0 Likes
1,240

Hi friend,

You can achive it very easily.

you can get the hints from this Link: [Module Pool Programmie: Multiple check boxes in Table Wizard|]

If you still face issues please revert back to me i will help you.

Thanks,

Sri Hari

Edited by: srihari.kumar on Jan 6, 2012 5:50 PM

Edited by: srihari.kumar on Jan 6, 2012 5:51 PM