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

CHECK BOX IN TABLE CONTROL

Former Member
0 Likes
2,831

Hi All,

In my program i have a table control called "ATAB"with two check box "approve" and "reject" in front of every line. Later when user ticks "approve" or "reject" in  check box that should be saved when i press the "SAVE BUTTON" and it should popup a error message when both the "APPROVE"check box and "REJECT"check box are ticked .

please see the pic below ...

check.JPG

PLEASE HELP...

MORE IMPORTANTLY I AM A BEGINNER..  PLEASE EXPLAIN ME IN DETAIL

Hi All,

In my program i have a table control called "ATAB"with two check box "approve" and "reject" in front of every line. Later when user ticks "approve" or "reject" in  check box that should be saved when i press the "SAVE BUTTON" and it should popup a error message when both the "APPROVE"check box and "REJECT"check box are ticked .

please see the pic below ...

check.JPG

PLEASE HELP...

MORE IMPORTANTLY I AM A BEGINNER..  PLEASE EXPLAIN ME IN DETAIL

11 REPLIES 11
Read only

Former Member
0 Likes
2,146

Hi mohamed,

Go through this link below.

http://www.sapdev.co.uk/dialog/tabcontrol/tc_mark.htm.

In order to get pop up use FM 'POPUP_TO_CONFIRM'.

For checkbox write like this,

if approve = 'X' or reject = 'X'.

do the operation.

Regards,

Vijay

Read only

0 Likes
2,146

Hi vijay kumar for your kind replay ,

My question is

  1. How to track is the check box is checked or not?
  2. If it is checked i have to save the particular line from the Table control.
  3. If both the check box from the same line checked ,while saving it has to pop an error message.

can u see the pic now

Read only

0 Likes
2,146

Hi mohamed,

track in the sense? means what?

where you have to save?

you can apply the condition for that rite.

Regards,

vijay

Read only

0 Likes
2,146

Hi Naveen,

1. To track the chechbox : When the user selects any of the checkboxes , internally the field will have a 'X' value i.e ATAB-aprove or ATAB-reject will hold a X value.So, this value will help you to track the field whether it is checked or not.

2. To save the particular line : Check for both the fields with 'X' Value.

3. To give a pop-up : If both the fields have a value 'X' then, use a Function module  POPUP_TO_CONFIRM to raise a pop up.

Hope this helps. Do let me know if anything else is required.

Thanks,

Namrata

Read only

0 Likes
2,146

In the PAI of main screen you should have written something like

* Here function defined as exit (back, cancel, etc.)

* so no check of data required

MODULE USER_COMMAND AT EXIT-COMMAND.

* Here PAI of subscreen

CALL SUBSCREEN sub_area.

* ...

* Same module, but here applicative functions only will triggger
MODULE USER_COMMAND.

In the PAI of the subscreen (tab with table control)

* Loop at table control

  LOOP AT itab.

     CHAIN

       FIELD itab-box1.

       FIELD itab-box2.

       " check only one box checked

       MODULE check_one_box.

     ENDCHAIN.

     " update internal table

    MODULE modify_itab.

  ENDLOOP.

Then

  • In the check box module raise an error if two boxes are checked (the checknoxes will be input allowed)
  • In the user command during "SAVE" (not defined as exit but as applicative function) processing you can loop at modified table and update database.

Alternative :

  • Add a third box "keep" or "ignore" defaulted as checked during initialization, and group all three boxes in a radiobutton group.

Regards,

Raymond


Read only

0 Likes
2,146
Thanks

Now my problem is when i click the check box the tick disappears but when i run the debugger the value 'X' for the CHECK BOX field has been append to the internal table but the tick symbol disappears in the screen.

hear is my CODE:

WHEN 'APPROVE'   "FUNCTION FOR THE CHECK BOX".

      IF ITAB_INBOX-APPROVE EQ ' '."ITAB_INBOX IS THE INTERNAL TABLE"

      ITAB_INBOX-APPROVE = 'X'.

      MODIFY ITAB_INBOX INDEX sy-tabix TRANSPORTING APPROVE. "APPROVE FIELD NAME FOR THE CHECK BOX"

     ELSEIF ITAB_INBOX-APPROVE EQ 'X'.

      APPROVE = ' '.

      MODIFY ITAB_INBOX INDEX sy-tabix TRANSPORTING APPROVE.

      ENDIF.

please help .

Read only

0 Likes
2,146

Remove most of your code, when clicking on the box the value is changed in dynpro field switching between space and 'X', so if you check a box when previous value was initial, the click set it to 'X' and your code reset it to initial ?

Just "ignore" in PAI the function code attached to check box (consier it as Enter) and let the LOOP AT itab of the PAI do the update of internal table. Those codes should only have to trigger a PAI/PBO cycle so check of data when user click.

Regards,

Raymond

Read only

0 Likes
2,146

and also help me to trace the line in the table control.

THANKS IN ADVANCE

Read only

0 Likes
2,146

ok,but from which value should i update my internal table??

and i want to know which row of the check box is checked???
Thankyou for your reply.

Read only

0 Likes
2,146

Thanks

Do SAP have any demo program regarding to my scenario??

If any can you provide the program name??

Thank you.

Read only

Former Member
0 Likes
2,146

Hi,

Your picture is not displaying.

Regards,

Vijay