Académique Documents
Professionnel Documents
Culture Documents
This post is about selection screen with tabs. Selection screen with tabs are not that hard to implement on ABAP and I am sure
if you search online you will always get the code for it.... but just to start things ill just give the code no a basic selection screen
with tabs...
INITIALIZATION.
button1 = text-011.
button2 = text-012.
mytab-prog = sy-repid.
mytab-dynnr = 101.
mytab-activetab = 'BUTTON1'.
AT SELECTION-SCREEN .
IF sy-batch = 'X'.
mytab-dynnr = 102.
mytab-activetab = 'BUTTON2'.
sy-ucomm = 'AUTO'.
ENDIF.
CASE sy-dynnr.
WHEN 1000.
CASE sy-ucomm.
WHEN 'ON'.
mytab-dynnr = 101.
mytab-activetab = 'BUTTON1'.
WHEN 'AUTO'.
mytab-dynnr = 102.
mytab-activetab = 'BUTTON2'.
endcase.
WHEN 0101.
mytab-dynnr = 101.
mytab-activetab = 'BUTTON1'.
WHEN 'ONLI'.
PERFORM screen_validation101.
ENDCASE.
WHEN 0102.
mytab-dynnr = 102.
mytab-activetab = 'BUTTON2'.
case sy-ucomm.
WHEN 'ONLI'.
PERFORM screen_validation102.
ENDCASE.
ENDCASE.
START-OF-SELECTION.
CASE mytab-activetab.
WHEN 'BUTTON1'."online mode
WHEN 'BUTTON2'." when automatic
ENDCASE.
now the above code is to a selection screen with tabs that you code using a report program.( this code cannot be used in
module pool program )
When a customer request to a selection screen with tabs there can be 2 reasons.
1) To group a selection on one out put ( I mean the final out-put is one but selection screen can be with tabs to make things
clear for e.g on SD related report the tabs can be Material selection , SO selection like wise )
2) The user requires different kind of out comes with different tabs... for e.g tab no1 to work during online operations and tab
no 2 to work on background operations.
The above requirement 1 which will be totally fine with the code given on top. But the requirement 2 will be a issue when it
comes to the above code. As most of the developers know on a selection screen we will always have mandatory fields. when
switching between tabs the selection screen first calls the validation and then it calls the normal screen code ( as you know the
validation is automatic if me make a selection option mandatory and we have no say on it ).
So in case if the user wants the functionality of the tab 2 he first has to fill all the mandatory fields on tab 1 so that the error
wont occur. This was a error I had to face during my development for this there are 2 way outs
1) do the validation by your self ( draw back : you wont get the mandatory sign on the selection screen )
2) write a selection screen with tabs ( draw back : the user wont be able to save variants or this part has to be coded which will
be a messy job )
for the 2nd option on above to make sure the tab switching with happen without first validating you have to do the codding as
follows
MODULE exit_comm.
MODULE switch_tab.
CALL SUBSCREEN SUB.
MODULE screen_comm.
MODULE USER_COMMAND_0100.
before call sub screen you have to call a module switch tabs.
on my case my customer wanted the variants to be there. Therefore they agreed to the validation by code where the mandatory
sign is not displayed.