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 wizard with check box field

0 Kudos

Hi,

I have the requirement to create a table control wizard where take checkbox as a field, the checkbox will work as row selection for table control

and create a execute button. After selecting the checkbox when will press the execute button in the next screen output will be display.

In the first screen I have created a table control wizard in layout also has taken a column field in the table as a checkbox column. But the issue is mine checkbox is not working as a row selection. So, how I can achieve

15 REPLIES 15

Sandra_Rossi
Active Contributor

What is your question?

I want to make the checkbox column as a row selection . so how I can achieve that and I don't want to use the function code in check box because for that it was working as a button. I have to select the check box for a particular row and after pressing the execute button then need to go to the next screen.

raymond_giuseppi
Active Contributor
0 Kudos

And what were you unable to do, identify the selected line(s), the one(s) with the box checked?

0 Kudos

Yes not able to identify by the code.

Sandra_Rossi
Active Contributor
0 Kudos

If you link your table control to a global internal table, and the checkbox column name is one of the internal table, then the selected line(s) can be identified during the loop at the lines of the control, during the PAI. It's not more complex than an "IF" at the checkbox field inside the LOOP (make sure that the target structure variable of the LOOP AT is global too and that's it).

0 Kudos

Could you please provide me the code of this?

Sandra_Rossi
Active Contributor
0 Kudos

If you want full code, then you can search the forum.

Otherwise, it's as simple as:

IF table_line-checkbox = 'X'.
" action
ENDIF.

0 Kudos

ok but I have searched a lot but not getting the required things. And I am not able to implement that how we can pass the input in table control wizard as a selection screen and how we can capture that value using the check box as a row selection and display to the next screen by an execute button.

I have tried but I am getting all empty internal table.

Sandra_Rossi
Active Contributor
0 Kudos

I'd like to fix your code, but it won't be possible if you don't post it.

Sandra_Rossi
Active Contributor
0 Kudos

You didn't share which modules belong to which screens ("flow logic").

Why didn't you implement any logic to read the selected row(s)? Is it really that you don't know how to find the selected row(s) with LOOP AT?

After you are in the case of pressing EXECUTE, do any logic for the selected row(s):

loop at lt_mchb into ls_mchb where check = 'X'.
  " here any logic for the selected row
endloop.

Sandra_Rossi
Active Contributor
0 Kudos

Please edit your comment (actions > edit), select your code and press the button [CODE], which makes the code appear colored/indented, it will be easier for people to look at it. Thank you!

0 Kudos

Actually the issue is I am getting the first record only

not the selected records I am using first time table control wizard

0 Kudos
TYPES : BEGIN OF ty_mchb, " For Declaration
check TYPE c LENGTH 1,
charg TYPE charg_d,
werks TYPE werks_d,
matnr TYPE c LENGTH 8,
END OF ty_mchb.
DATA : lt_mchb TYPE TABLE OF ty_mchb.
DATA : ls_mchb TYPE ty_mchb.
*&SPWIZARD: DECLARATION OF TABLECONTROL 'TC_WIZARD' ITSELF
CONTROLS: tc_wizard TYPE TABLEVIEW USING SCREEN 0100.
*&SPWIZARD: LINES OF TABLECONTROL 'TC_WIZARD'
DATA: g_tc_wizard_lines LIKE sy-loopc.
DATA: ok_code LIKE sy-ucomm.

0 Kudos
*&SPWIZARD: OUTPUT MODULE FOR TC 'TC_WIZARD'. DO NOT CHANGE THIS LINE!
*&SPWIZARD: UPDATE LINES FOR EQUIVALENT SCROLLBAR
MODULE tc_wizard_change_tc_attr OUTPUT.
  DESCRIBE TABLE lt_mchb LINES tc_wizard-lines.
  IF lt_mchb[] IS INITIAL. " Added for getting the input after pressing enter input *is going to disappeared
    CLEAR:ls_mchb.
  APPEND ls_mchb TO lt_mchb.
  ENDIF.
ENDMODULE.

0 Kudos
INCLUDE zmodulepool_pbo_100.
INCLUDE zmodulepool_user_pai.
&---------------------------------------------------------------------*
*& Module STATUS_0100 OUTPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE status_0100 OUTPUT.
SET PF-STATUS 'ZMODULEPOOL_100'.
SET TITLEBAR 'DTS'.
ENDMODULE.
*&---------------------------------------------------------------------*
*& Module STATUS_0200 OUTPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE status_0200 OUTPUT.
SET PF-STATUS 'ZMODULEPOOL_200'.
ENDMODULE.
*&---------------------------------------------------------------------*
*& Module INSERT_DATA OUTPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE insert_data OUTPUT.
IF lt_mchb IS NOT INITIAL.
SELECT charg werks matnr
FROM mchb
INTO CORRESPONDING FIELDS OF TABLE lt_mchb
WHERE charg = ls_mchb-charg
AND werks = ls_mchb-werks
AND matnr = ls_mchb-matnr.
ENDIF.
ENDMODULE.
----------------------------------------------------------------
*&---------------------------------------------------------------------*
*& Module USER_COMMAND_0100 INPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE user_command_0100 INPUT.
CASE sy-ucomm.
WHEN 'EXECUTE'.
*CLEAR : sy-ucomm.
loop at lt_mchb into ls_mchb where check = 'X'.
endloop.
CALL SCREEN '0200'.
ENDCASE.
ENDMODULE.
*&---------------------------------------------------------------------*
*& Module USER_COMMAND_0200 INPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE user_command_0200 INPUT.
CASE sy-ucomm.
WHEN 'BACK'.
CALL SCREEN '0100'.
ENDCASE.
ENDMODULE.
*&---------------------------------------------------------------------*
*& Module GET_DATA INPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE get_data INPUT.
READ TABLE lt_mchb INTO ls_mchb INDEX tc_wizard-current_line.
IF ls_mchb-check IS NOT INITIAL.
ls_mchb-check = 'X'.
MODIFY lt_mchb FROM ls_mchb INDEX tc_wizard-current_line.
ENDIF.
ENDMODULE.
----------------------------------------------------------------------------
PROCESS BEFORE OUTPUT.
MODULE insert_data.
MODULE STATUS_0100.
*&SPWIZARD: PBO FLOW LOGIC FOR TABLECONTROL 'TC_WIZARD'
MODULE TC_WIZARD_CHANGE_TC_ATTR.
*&SPWIZARD: MODULE TC_WIZARD_CHANGE_COL_ATTR.
LOOP AT LT_MCHB
INTO LS_MCHB
WITH CONTROL TC_WIZARD
CURSOR TC_WIZARD-CURRENT_LINE.
MODULE TC_WIZARD_GET_LINES.
*&SPWIZARD: MODULE TC_WIZARD_CHANGE_FIELD_ATTR
ENDLOOP.

*
PROCESS AFTER INPUT.
*&SPWIZARD: PAI FLOW LOGIC FOR TABLECONTROL 'TC_WIZARD'
LOOP AT LT_MCHB.
CHAIN.
FIELD LS_MCHB-CHECK.
FIELD LS_MCHB-CHARG.
FIELD LS_MCHB-WERKS.
FIELD LS_MCHB-MATNR.
MODULE TC_WIZARD_MODIFY ON CHAIN-REQUEST.
endchain.
MODULE get_data.
ENDLOOP.
MODULE TC_WIZARD_USER_COMMAND.
*&SPWIZARD: MODULE TC_WIZARD_CHANGE_TC_ATTR.
*&SPWIZARD: MODULE TC_WIZARD_CHANGE_COL_ATTR.
MODULE USER_COMMAND_0100.