‎2008 Feb 05 7:52 AM
How do I not allow the user to go to my other tabs of my tabstrip when the field of my first tab (IO_NAME) is not entered upon clicking the 'Save' button?
Codes examples is needed for me to understand better.
‎2008 Feb 05 7:54 AM
‎2008 Feb 05 7:55 AM
Hi,
In PBO,
Check if any field is initial..
if yes set a flag...
check that flage in PBO of sub screen...
if set SHOW A ERROR MSG..
Call back the default sub screen.
Reward if helpful,
Gaurav J.
‎2008 Feb 05 7:56 AM
‎2008 Feb 05 8:01 AM
Hi,
check this
process before output.
module status_0100.
module tabstrp_active_tab_set.
call subscreen subscreen
including g_tabstrp-prog g_tabstrp-subscreen.
process after input.
call subscreen subscreen.
module tabstrp_active_tab_get.
module user_command_0100.
CODE:----
program z11gauravprogram35 .
controls : tabstrp type tabstrip.
data : ok_code(4).
data: rd1 type c value 'X'.
data: rd2 type c.
data: temp type c.
data: begin of g_tabstrp,
subscreen like sy-dynnr,
prog like sy-repid value 'Z11GAURAVPROGRAM35',
pressed_tab like sy-ucomm value 'TAB1',
end of g_tabstrp.
data: flag type c.
&----
*& Module STATUS_0100 OUTPUT
&----
text
----
module status_0100 output.
set pf-status 'MAIN'.
set titlebar 'MAIN'.
case sy-ucomm.
when 'TAB1'.
if flag = '1'.
set titlebar 'TAB1'.
endif.
when 'TAB2'.
if flag = '1'.
set titlebar 'TAB2'.
endif.
endcase.
endmodule. " STATUS_0100 OUTPUT
&----
*& Module USER_COMMAND_0100 INPUT
&----
text
----
module user_command_0100 input.
if sy-ucomm = 'EXT'.
leave program.
endif.
endmodule. " USER_COMMAND_0100 INPUT
&----
*& Module TABSTRP_ACTIVE_TAB_SET OUTPUT
&----
text
----
module tabstrp_active_tab_set output.
tabstrp-activetab = g_tabstrp-pressed_tab.
case g_tabstrp-pressed_tab.
when 'TAB1'.
if rd1 = 'X'.
g_tabstrp-subscreen = '0102'.
elseif rd2 = 'X'.
g_tabstrp-subscreen = '0103'.
endif.
when 'TAB2'.
g_tabstrp-subscreen = '0101'.
endcase.
endmodule. " TABSTRP_ACTIVE_TAB_SET OUTPUT
&----
*& Module TABSTRP_ACTIVE_TAB_GET INPUT
&----
text
----
module tabstrp_active_tab_get input.
ok_code = sy-ucomm.
case ok_code.
when 'G1'.
if rd1 = 'X'.
elseif rd2 = 'X'.
endif.
when 'TAB1'.
g_tabstrp-pressed_tab = 'TAB1'.
when 'TAB2'.
g_tabstrp-pressed_tab = 'TAB2'.
endcase.
endmodule. " TABSTRP_ACTIVE_TAB_GET INPUT
&----
*& Module STATUS_0101 OUTPUT
&----
text
----
module status_0101 output.
SET PF-STATUS 'xxxxxxxx'.
SET TITLEBAR 'xxx'.
flag = '1'.
endmodule. " STATUS_0101 OUTPUT
&----
*& Module USER_COMMAND_0101 INPUT
&----
text
----
module user_command_0101 input.
endmodule. " USER_COMMAND_0101 INPUT
Now what I am asking you to do is that make a module in PBO of main screen which contains tab strip.
mark flag if any field is initial...
Check this flag in PBO of SUB screen create of different tab..
pbo is comman to all subscreen...
if marked Exit.
Reward if helpful..
Gaurav J.
Edited by: Gaurav Juneja on Feb 5, 2008 9:02 AM
‎2008 Feb 05 7:57 AM
Hi,
The basic concept here is that whenever a user clicks the tab for navigating to the tab strip - it triggers the corresponding okcode attached to the tab strip in propoerties.
Hence what you can do is, in the PAI of the main screen create a module and code as below:
CASE OK_CODE.
*Assuming OK_CODE is the user command defined
WHEN 'TAB2' OR 'TAB3'
*OKCODES for tab 2 and 3 respectively have been clicked
IF IO_NAME IS INITIAL.
*No name entered on tab 1
MESSAGE E002(SY) WITH 'Please enter name before navigating'.
ENDIF.
ENDCASE.
Hence by raising an error message as shown above, you prevent the user from navigating when no name is entered.
Cheers,
Aditya
‎2008 Feb 05 11:37 AM
I created a module at PAI of my screen of my tabstrip with the codes given:
CASE OK_CODE.
*Assuming OK_CODE is the user command defined
WHEN 'TAB2' OR 'TAB3'
*OKCODES for tab 2 and 3 respectively have been clicked
IF IO_NAME IS INITIAL.
*No name entered on tab 1
MESSAGE E002(SY) WITH 'Please enter name before navigating'.
ENDIF.
ENDCASE.
However, this does not seems to work. What should I do?
‎2008 Feb 05 11:44 AM
Hi,
What's the problem? Is there a syntax error ? if not , whats the reaction?
/Aditya
‎2008 Feb 05 11:48 AM
Hello
There is no error but it did not disable the other 2 tabs when my textbox at first tabs in empty.
‎2008 Feb 05 11:57 AM
Hi,
This then sounds like the same query you posted in UI Programming and was resolved.
/Aditya