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

Tab based selection screen

Former Member
0 Likes
6,618

Hi all,

My requirement is to haev two tabs in a program. One tab is for Uploading a file to application server and the other is to download a file from application server.

I have created two tabs using the SELECTION-SCREEN AS SUBSCREEN. Now, each tab has a mandatory field. So when the user needs to download a file, he has to give some data to the upload tab's fields (as the field is mandatory and upload tab is the first tab).

Also, for these two tabs, I have to write separate logics. I tried giving a IF condition using sy-dynnr, but it is not working.

Please let me know how to have the obligatory fields in both tabs and logics for two tabs separately using an IF statement.

Thanks,

Surya

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
3,342

Hi Surya,

Check the below code this will help you.


SELECTION-SCREEN BEGIN OF SCREEN 300 AS SUBSCREEN.
PARAMETER: p_var1(10) TYPE c.
SELECTION-SCREEN END OF SCREEN 300.

* SUBSCREEN 2

SELECTION-SCREEN BEGIN OF SCREEN 200 AS SUBSCREEN.
PARAMETERS: p_var2(10) TYPE c.
SELECTION-SCREEN END OF SCREEN 200.

SELECTION-SCREEN: BEGIN OF TABBED BLOCK mytab FOR 4 LINES,
                  TAB (20) button1 USER-COMMAND push1,
                  TAB (20) button2 USER-COMMAND push2
                                   DEFAULT SCREEN 300,
                  END OF BLOCK mytab.

INITIALIZATION.

  button1 = text-001.
  button2 = text-002.
  mytab-prog = sy-repid.
  mytab-dynnr = 300.
  mytab-activetab = 'BUTTON1'.

AT SELECTION-SCREEN.

  CASE sy-dynnr.
    WHEN 1000.
      CASE sy-ucomm.
        WHEN 'PUSH1'.
          mytab-dynnr = 300.
          mytab-activetab = 'BUTTON1'.
          CLEAR: p_vbeln.
        WHEN 'PUSH2'.
          mytab-dynnr = 200.
          mytab-activetab = 'BUTTON2'.
          CLEAR: s_date.
      ENDCASE.
  ENDCASE.

START-OF-SELECTION.
  IF mytab-dynnr = '300'.
* Check p_var1 is not initial else throw message
* Put logic for 1st tab
  ELSE.
* Check p_var2 is not initial else throw message
* Put logic for 2nd tab
  ENDIF.

[Tabstrip Controls on Selection Screens |http://help.sap.com/erp2005_ehp_04/helpdata/EN/24/23b937ba187121e10000009b38f8cf/frameset.htm]

Regards

Dillip

Edited by: Dillip Kumar Sahoo on Jun 3, 2010 1:47 PM

10 REPLIES 10
Read only

former_member233090
Active Contributor
0 Likes
3,342

Hi surya,

just check this example and def you will find it helpful

http://nafran.blogspot.com/2010/03/selection-screen-with-tabs.html

cheers

Bhavana

Read only

0 Likes
3,342

Hi all,

The above example did not help me.. could some one help me on this issue.

Thanks,

Surya

Read only

Former Member
0 Likes
3,342

Default the two values in INITIALIZATION event. Then, validate the values after the user executes from the active tab.

Read only

Former Member
0 Likes
3,342

Hi,

Please check the below code.

SELECTION-SCREEN BEGIN OF B1.

fields

SELECTION-SCREEN END OF B1.

SELECTION-SCREEN BEGIN OF B2.

fields

SELECTION-SCREEN END OF B2.

Have you done this?

*No of line for the display of tabstrip

SELECTION-SCREEN BEGIN OF TABBED BLOCK tabb1 FOR 15 LINES.

SELECTION-SCREEN TAB (15) tabs1 USER-COMMAND ucomm1 DEFAULT SCREEN 001.

SELECTION-SCREEN TAB (15) tabs2 USER-COMMAND ucomm2 DEFAULT SCREEN 002.

SELECTION-SCREEN TAB (15) tabs3 USER-COMMAND ucomm3 DEFAULT SCREEN 003.

SELECTION-SCREEN END OF BLOCK tabb1.

INITIALIZATION.

*Get the names for all the tabs.

tabs1 = text-002.

tabs2 = text-005.

tabs3 = text-003.

activetab = 'TABS1'.

Now do the validation on separate blocks

AT SELECTION-SCREEN ON BLOCK 1.

IF sy-batch NE 'X'.

*Validate material no

IF NOT s_matnr IS INITIAL.

SELECT SINGLE * FROM mara WHERE matnr IN s_matnr.

IF sy-subrc NE 0.

MESSAGE text-014 TYPE 'E'.

ENDIF.

ENDIF.

AT SELECTION-SCREEN ON BLOCK 2.

IF sy-batch NE 'X'.

*Validate sales order no

IF NOT s_vebln IS INITIAL.

SELECT SINGLE * FROM vbak WHERE vbeln IN s_vbeln.

IF sy-subrc NE 0.

MESSAGE text-015 TYPE 'E'.

ENDIF.

ENDIF.

Hope this helps

Read only

Former Member
0 Likes
3,342

Hi,

SELECTION-SCREEN BEGIN OF SCREEN 100 AS SUBSCREEN.

PARAMETERS: p1 TYPE c LENGTH 10,

p2 TYPE c LENGTH 10,

p3 TYPE c LENGTH 10.

SELECTION-SCREEN END OF SCREEN 100.

SELECTION-SCREEN BEGIN OF SCREEN 200 AS SUBSCREEN.

PARAMETERS: q1 TYPE c LENGTH 10,

q2 TYPE c LENGTH 10,

q3 TYPE c LENGTH 10.

SELECTION-SCREEN END OF SCREEN 200.

SELECTION-SCREEN: BEGIN OF TABBED BLOCK mytab FOR 10 LINES,

TAB (20) button1 USER-COMMAND push1,

TAB (20) button2 USER-COMMAND push2,

END OF BLOCK mytab.

Check the above code. Hope this might help you.

With Regards,

Sumodh.P

Read only

Former Member
0 Likes
3,343

Hi Surya,

Check the below code this will help you.


SELECTION-SCREEN BEGIN OF SCREEN 300 AS SUBSCREEN.
PARAMETER: p_var1(10) TYPE c.
SELECTION-SCREEN END OF SCREEN 300.

* SUBSCREEN 2

SELECTION-SCREEN BEGIN OF SCREEN 200 AS SUBSCREEN.
PARAMETERS: p_var2(10) TYPE c.
SELECTION-SCREEN END OF SCREEN 200.

SELECTION-SCREEN: BEGIN OF TABBED BLOCK mytab FOR 4 LINES,
                  TAB (20) button1 USER-COMMAND push1,
                  TAB (20) button2 USER-COMMAND push2
                                   DEFAULT SCREEN 300,
                  END OF BLOCK mytab.

INITIALIZATION.

  button1 = text-001.
  button2 = text-002.
  mytab-prog = sy-repid.
  mytab-dynnr = 300.
  mytab-activetab = 'BUTTON1'.

AT SELECTION-SCREEN.

  CASE sy-dynnr.
    WHEN 1000.
      CASE sy-ucomm.
        WHEN 'PUSH1'.
          mytab-dynnr = 300.
          mytab-activetab = 'BUTTON1'.
          CLEAR: p_vbeln.
        WHEN 'PUSH2'.
          mytab-dynnr = 200.
          mytab-activetab = 'BUTTON2'.
          CLEAR: s_date.
      ENDCASE.
  ENDCASE.

START-OF-SELECTION.
  IF mytab-dynnr = '300'.
* Check p_var1 is not initial else throw message
* Put logic for 1st tab
  ELSE.
* Check p_var2 is not initial else throw message
* Put logic for 2nd tab
  ENDIF.

[Tabstrip Controls on Selection Screens |http://help.sap.com/erp2005_ehp_04/helpdata/EN/24/23b937ba187121e10000009b38f8cf/frameset.htm]

Regards

Dillip

Edited by: Dillip Kumar Sahoo on Jun 3, 2010 1:47 PM

Read only

0 Likes
3,342

Sumodh,

I have created two different tabs already. The problem for me ism having obligatory fields on both the tabs and writing separate logic for each tabs using the screen number. I cannot solve these two.

Dilip

Your code will work , but I face difficulty in validating the fields. say, tab1 has 2 fields and tab2 has 2 fields. All are mandatory. I have to check if it is initial or not.

Thanks,

Surya

Read only

0 Likes
3,342

If you have defined them as obligatory, then obligatory they are.

Remove the obligatory options and handle it with logic (as Dillip has shown).

Rob

Edited by: Rob Burbank on Jun 3, 2010 12:30 PM

Read only

0 Likes
3,342

Hello Surya,

Remove the obligatory addtion from the declaration of parameters of both the tabs.

Acording to my above code snippet validate the parameter data here


START-OF-SELECTION.
  IF mytab-dynnr = '300'.
* Check p_var1 is not initial else throw message
* Put logic for 1st tab
  ELSE.
* Check p_var2 is not initial else throw message
* Put logic for 2nd tab
  ENDIF.

Hope this is clear now.

Regards

Dillip

Read only

0 Likes
3,342

Hi Surya,

Please close the thread, if the issue is solved now,

Regards

DKS