‎2014 Mar 04 6:18 AM
Hi all,
I have a table control with checkboxes. My requirement is that there aill be 2 buttons (Fail and Pass) and which are going to be in invisible mode when the table control is displayed. When one or more than one checkbox is selected, "Fail" button will be visible. If all cj\heckboxes are selected, only then the "Pass" button should be enabled. How can I achieve this?
My table control is shown above. The buttons are invisible as per my requirement.
Below is the layout:
The variables I declared are:
TYPES: BEGIN OF TY_VBAP ,
check TYPE c,
VBELN TYPE VBAP-VBELN,
POSNR TYPE VBAP-POSNR,
MATNR TYPE VBAP-MATNR,
MATKL TYPE VBAP-MATKL,
POSAR TYPE VBAP-POSAR,
END OF TY_VBAP.
DATA: IT_VBAP TYPE STANDARD TABLE OF TY_VBAP,
WA_VBAP TYPE TY_VBAP.
DATA:ok_code TYPE sy-ucomm.
CONTROLS tc1 TYPE TABLEVIEW USING SCREEN 1001 .
In my PAI, I tried with this code, but its not working.
LOOP AT IT_VBAP INTO WA_VBAP WHERE CHECK = 'X'.
loop at screen.
IF SCREEN-GROUP1 = 'CHK' AND
SCREEN-GROUP2 = 'GPS' AND
SCREEN-NAME = 'FAIL'.
screen-ACTIVE = '1'.
* screen-invisible = '0'.
modify screen.
ENDIF.
ENDLOOP.
ENDLOOP.
Please help me with this.
Regards.
Souvik.
‎2014 Mar 04 6:20 AM
i think it is easy to meet this requiremnt.
all your lines' information is stored in 1 internal table.
in pbo, base on the data in this internal table , do loop screen, and modify input to 0, it will be working.
Hope you can fix your issue.
feel free to let me know your concern.
‎2014 Mar 04 6:25 AM
I have done it in the PBO of screen 9001 to keep the buttons invisible as shown:
loop at screen.
if screen-group1 eq 'GRP'.
screen-active = '0'.
modify screen.
endif.
endloop.
loop at screen.
if screen-group1 eq 'GPS'.
screen-active = '0'.
modify screen.
endif.
endloop.
The issue I am facing is that I need to enable them based on my checkbox selection as mentioned in my post.
‎2014 Mar 04 6:31 AM
1.add fcode to checkbox.
2.in pbo, base on checkbox field value to set this button invisible or not.
‎2014 Mar 04 6:53 AM
Sorry Aiolos, but if I add a fcode to the checkbox, the checkbox doesnt function properly in my screen.. i.e. the fields dont get selected via the checkbox. I had already tried this approach earlier.
‎2014 Mar 04 7:08 AM
If you don't assign a function code to check-boxes, you wont be able to trigger a PAI/PBO cycle and unable to automatically display any of the two buttons.
So you have to either
Regards,
Raymond
‎2014 Mar 04 7:17 AM
When I mentioned that "the checkbox doesn't function properly in my screen", I meant that when I am selecting a field using checkboxes,the Fail button is not appearing as per requirement.
The user does not have to press Enter to make the buttons visible, its basically the role of the checkboxes to make that happen.
‎2014 Mar 05 4:49 AM
Hi,
I have solved part of the issue, that is, I am able to enable the "Fail" button with the click of another button. However , as per my requirement, the "Fail" button should be enabled by triggering a checkbox, and not a push button . Now if I assign a function code to the checkbox, it acts as a push button, and the checkbox does not hold the 'tick' mark. So how do I solve this?
Regards.
Manish.
‎2014 Mar 04 7:03 AM
Hi Use a variable to set screen-active property 0 or 1.
when declaring the variable assign some initial value to it ( 0 or 1). Later (PAI or PBO) if all the lines are selected assign value 1 to the variable else 0.
Sample code
data: gv_grp_Active type c value '0'.
in PBO loop at screen.
screen-active = gv_grp_active.
‎2014 Mar 04 7:10 AM
Its not working Santhoshi Whether I use 0 or 1 or I declare a variable for the values, its one and the same thing. There is no difference. The buttons are not getting enabled. Please refer to my code snippet and tell me where am I going wrong, if possible.
Regards.
Souvik.
‎2014 Mar 04 7:05 AM
Hi Souvik
Simply do one thing. Declare a global variable GV_PASS type C.
In PAI of your screen in user command after loop endloop. Check if all checkbox are marked.
LT_TEMP[] = LT_PASS[]
delete lt_temp where mark is initial.
if sy-subrc ne 0." all marked
GV_PASS = X
else.
clear gv_pass.
endif.
in PBO if flag is initial hide it else show it
Nabheet
‎2014 Mar 04 7:27 AM
Hi Nabheet,
Can you tell me what I can do to make the buttons get enabled as per my requirement? That is my main concern.
Regards.
Souvik.
‎2014 Mar 04 7:33 AM
Souvik
The solution to your problem has already been provided in above threads.
Nabheet
‎2014 Mar 04 11:05 AM
I did try, but it seems that the buttons are not getting enabled...
‎2014 Mar 04 11:11 AM
I think you need to switch on the debugger and use F5. Check how your logic is running. We can propose ways to do it. But actually how you have done it depends on you. Best thing will be to switch on the debugger put break points at various points like where you are enabling disabling stuff
Nabheet
‎2014 Mar 05 4:49 AM
Hi,
I have solved part of the issue, that is, I am able to enable the "Fail" button with the click of another button. However , as per my requirement, the "Fail" button should be enabled by triggering a checkbox, and not a push button . Now if I assign a function code to the checkbox, it acts as a push button, and the checkbox does not hold the 'tick' mark. So how do I solve this?
Regards.
Manish.
‎2014 Mar 04 9:16 AM
Hi,,
Please do as follows in a PBO module..
READ TABLE IT_VBAP INTO WA_VBAP WITH KEY CHECK IS INITIAL .
( if at least one check box is blank then fail button will appear )
IF SY-SUBRC = 0 .
loop at screen.
IF SCREEN-NAME = 'FAIL'.
screen-ACTIVE = '1'.
modify screen.
ENDIF.
ENDLOOP.
else . (if all check boxes are checked and no blank check boxes )
loop at screen.
IF SCREEN-NAME = 'PASS'.
screen-ACTIVE = '1'.
modify screen.
ENDIF.
ENDLOOP.
ENDIF .
Regards
DJ
‎2014 Mar 04 9:36 AM
‎2014 Mar 04 9:59 AM
Hi Souvik,
Maybe you can use classes to do this. I have used this kind in a module pool with class CL_GUI_ALV_GRID. Hope this helps