‎2014 Dec 01 11:42 AM
Dear All,
Is it possible to call a push button at run time or through code? Suppose in my module pool program in a particular screen having two push button , i.e. Button1 and Button2 . When user click on Button1 then inside program or code it should call Button2 as if user clicked on Button2.
I am asking this question because I have to jump to or call a particular Tab when some error occurred in another tab in the same screen . My screen having 5 nos of tabs.
Please help.
-Pk
‎2014 Dec 01 12:27 PM
Hi,
To go to a tab of the tabstrip you need to set the field activetab of the tabstrip control to the function code of the tab that you want to be displayed.
In the PAI,
tab_cntrl-activetab = 'FCT'.
That's all. This will go to the tab which has function code as FCT.
Regards,
Ashish
‎2014 Dec 01 11:49 AM
Hi,
You can simply call the Form routine behind "Button 2". why you are thinking so complex.
Case sy-ucomm.
when 'BUT1'.
Perform F1.
when 'BUT2'.
Perform F2.
endcase.
Form F1.
"your logic
Perform F2.
endform.
Form F2.
"logic
Endform.
‎2014 Dec 01 12:18 PM
Hello Wasim,
Thank you for your reply. My actual requirement is stated in second part of my post. I have a screen with 5 nos of tabs . User can enter data in first tab screen and without going to second tab screen he can save data. But now we have inserted few checks in second tab . So Now when user entered data in first tab and try to save records with out visiting second tab , system shows error message because of our validation check . But my client wants that when user response to error message then cursor should automatically move to second tab's field where we have given the check for compulsory data.
Here the second tab in my screen is nothing but a push button which is I want to call dynamically when error occurred for validation.
So , Wasim can you help in this regards?
-PK
‎2014 Dec 01 12:32 PM
the problem with error message is that its stop the further processing. If you show a status or information message in your logic, and then make second tab as active tab it will navigate to second tab.
‎2014 Dec 01 11:54 AM
Hi PK,
You can directly set a SY-UCOMM Value Where ever you want...
Ex,you are in Button 1
inside this you can use
sy-ucomm = 'BUTTON2'. ..
‎2014 Dec 01 12:27 PM
Hello Ranjit,
Thank you for your reply. I have tried as you have suggested . I have inserted SY-UCOMM = FctCode just after the error message but found that Sy-UCOMM is holding value of enter key since we have responded to error message by pressing enter key.
My actual requirement is stated in the reply to Wasim .
Ranjit can you help to solve by problem as stated in reply to Wasim ?.
-Pk
‎2014 Dec 01 12:27 PM
Hi,
To go to a tab of the tabstrip you need to set the field activetab of the tabstrip control to the function code of the tab that you want to be displayed.
In the PAI,
tab_cntrl-activetab = 'FCT'.
That's all. This will go to the tab which has function code as FCT.
Regards,
Ashish
‎2014 Dec 02 6:19 AM
Hello Ashish ,
Your reply helps us a lot . Tabstrip Activation is the actual way to go to a particular screen's tab after responding an error message by user.
Thank you again Ashish.
-pk
‎2014 Dec 01 12:36 PM
I think that what you are searching for is this function.
CALL FUNCTION ‘SAPGUI_SET_FUNCTIONCODE’
EXPORTING
functioncode = ‘/i′
EXCEPTIONS
function_not_supported = 1
OTHERS = 2.
For example this code will make that when the source code reach this fm the sessión will be closed. You can put any function code, so if you need to execute a push buton just put the function code associated to that button.
Regards