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

Selection Screen Bug :: Drop Down List.

adeel_sarwar
Contributor
0 Likes
1,603

Hi

I have created the following ABAP Report. I am new at this and I have just hit an issue. I have two drop down boxes linked to transactions. Now when I select a report from Drop Down 1 and click it it goes to the transaction. Now if I also have a selection in Drop Down 2 it actually runs both transactions.

How can i fix this?

Thanks

Adeel

REPORT TEST.

*TYPE POOLS DECLARATIONS
TYPE-POOLS: vrm.

TABLES: sscrfields.

*SELECTION SCREEN FIELDS
*DATA: c(20) TYPE c.


***********SELECTION-SCREENS**********************
SELECTION-SCREEN BEGIN OF BLOCK blk1 WITH FRAME TITLE text-tt1.

PARAMETERS: one(20) AS LISTBOX VISIBLE LENGTH 40.
PARAMETERS: two(20) AS LISTBOX VISIBLE LENGTH 40.
* ADD Afer 40 to show text "DEFAULT 'PLEASE SELECT'"

SELECTION-SCREEN SKIP.

SELECTION-SCREEN END OF BLOCK blk1.



*********DROP DOWN SELECTION WITH DESCP******************
AT SELECTION-SCREEN OUTPUT.

PERFORM ONE.
PERFORM TWO.


*&---------------------------------------------------------------------*
*&      Form  ONE
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
FORM one.

  DATA: name  TYPE vrm_id,
      list  TYPE vrm_values,
      value LIKE LINE OF list.


  name = 'ONE'.

  value-key = '1 ::'.
  value-text = 'Stock Report'.
  APPEND value TO list.
  CLEAR value.

  value-key = '2 ::'.
  value-text = 'Open Sales Order Report'.
  APPEND value TO list.
  CLEAR value.

  CALL FUNCTION 'VRM_SET_VALUES'
    EXPORTING
      id              = name
      values          = list
    EXCEPTIONS
      id_illegal_name = 1
      OTHERS          = 2.
  IF sy-subrc <> 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
            WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  ENDIF.

ENDFORM.                    "ONE


*&---------------------------------------------------------------------*
*&      Form  TWO
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
FORM two.

  DATA: name  TYPE vrm_id,
      list  TYPE vrm_values,
      value LIKE LINE OF list.


  name = 'TWO'.

  value-key = '1 ::'.
  value-text = 'AS Stock Report'.
  APPEND value TO list.
  CLEAR value.

  value-key = '2 ::'.
  value-text = 'AS Open Sales Order Report'.
  APPEND value TO list.
  clear value.



  CALL FUNCTION 'VRM_SET_VALUES'
    EXPORTING
      id              = name
      values          = list
    EXCEPTIONS
      id_illegal_name = 1
      OTHERS          = 2.
  IF sy-subrc <> 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
            WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  ENDIF.

ENDFORM.                    "TWO


***********LINKS TO ABOVE SELECTION**********************
START-OF-SELECTION.

IF ONE = '&IC1'.
  CASE one.
    WHEN '1 ::'.
      CALL TRANSACTION 'MB5L' AND SKIP FIRST SCREEN.
    WHEN '2 ::'.
      CALL TRANSACTION 'ZSOD'.
  ENDCASE.
ENDIF.

IF TWO = '&IC1'.
  CASE two.
    WHEN '1 ::'.
      CALL TRANSACTION 'MB52' AND SKIP FIRST SCREEN.
    WHEN '2 ::'.
      CALL TRANSACTION 'ZSOD'.
  ENDCASE.
ENDIF.

13 REPLIES 13
Read only

former_member209217
Active Contributor
0 Likes
1,524

Please Format your code.

Its not in a readable form

Read only

0 Likes
1,524

Cant seem to Put it in the Code brackets for watever reason

REPORT z_exec_cockpit.

*TYPE POOLS DECLARATIONS
TYPE-POOLS: vrm.

TABLES: sscrfields.

*SELECTION SCREEN FIELDS
*DATA: c(20) TYPE c.


***********SELECTION-SCREENS**********************
SELECTION-SCREEN BEGIN OF BLOCK blk1 WITH FRAME TITLE text-tt1.

PARAMETERS: one(20) AS LISTBOX VISIBLE LENGTH 40.
PARAMETERS: two(20) AS LISTBOX VISIBLE LENGTH 40.
* ADD Afer 40 to show text "DEFAULT 'PLEASE SELECT'"

SELECTION-SCREEN SKIP.

SELECTION-SCREEN END OF BLOCK blk1.



*********DROP DOWN SELECTION WITH DESCP******************
AT SELECTION-SCREEN OUTPUT.

PERFORM ONE.
PERFORM TWO.

Edited by: Adeel Sarwar on Dec 18, 2009 1:20 PM

Read only

0 Likes
1,524
*&---------------------------------------------------------------------*
*&      Form  ONE
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
FORM one.

  DATA: name  TYPE vrm_id,
      list  TYPE vrm_values,
      value LIKE LINE OF list.


  name = 'ONE'.

  value-key = '1 ::'.
  value-text = 'Stock Report'.
  APPEND value TO list.
  CLEAR value.

  value-key = '2 ::'.
  value-text = 'Open Sales Order Report'.
  APPEND value TO list.
  CLEAR value.

  CALL FUNCTION 'VRM_SET_VALUES'
    EXPORTING
      id              = name
      values          = list
    EXCEPTIONS
      id_illegal_name = 1
      OTHERS          = 2.
  IF sy-subrc <> 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
            WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  ENDIF.

ENDFORM.                    "ONE


*&---------------------------------------------------------------------*
*&      Form  TWO
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
FORM two.

  DATA: name  TYPE vrm_id,
      list  TYPE vrm_values,
      value LIKE LINE OF list.


  name = 'TWO'.

  value-key = '1 ::'.
  value-text = 'AS Stock Report'.
  APPEND value TO list.
  CLEAR value.

  value-key = '2 ::'.
  value-text = 'AS Open Sales Order Report'.
  APPEND value TO list.
  clear value.



  CALL FUNCTION 'VRM_SET_VALUES'
    EXPORTING
      id              = name
      values          = list
    EXCEPTIONS
      id_illegal_name = 1
      OTHERS          = 2.
  IF sy-subrc <> 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
            WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  ENDIF.

ENDFORM.                    "TWO
Read only

0 Likes
1,524
***********LINKS TO ABOVE SELECTION**********************
START-OF-SELECTION.


  CASE one.
    WHEN '1 ::'.
      CALL TRANSACTION 'MB5L' AND SKIP FIRST SCREEN.
    WHEN '2 ::'.
      CALL TRANSACTION 'ZSOD'.
  ENDCASE.



  CASE two.
    WHEN '1 ::'.
      CALL TRANSACTION 'MB52' AND SKIP FIRST SCREEN.
    WHEN '2 ::'.
      CALL TRANSACTION 'ZSOD'.
  ENDCASE.
Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
1,524

Hello,

Now that you have posted the code cleanly, tell us what exactly is your problem ?

BR,

Suhas

Read only

0 Likes
1,524

Hi Now try this one,.

*TYPE POOLS DECLARATIONS

TYPE-POOLS: vrm.

TABLES: sscrfields.

*SELECTION SCREEN FIELDS *

DATA: c(20) TYPE c.

**********SELECTION-SCREENS*********************

SELECTION-SCREEN BEGIN OF BLOCK blk1 WITH FRAME TITLE text-tt1.

PARAMETERS: one(20) AS LISTBOX VISIBLE LENGTH 40.

PARAMETERS: two(20) AS LISTBOX VISIBLE LENGTH 40.

  • ADD Afer 40 to show text "DEFAULT 'PLEASE SELECT'"

SELECTION-SCREEN SKIP. SELECTION-SCREEN END OF BLOCK blk1.

********DROP DOWN SELECTION WITH DESCP*****************

AT SELECTION-SCREEN OUTPUT.

PERFORM one.

PERFORM two.

&----


*& Form ONE

&----


  • text ----------------------------------------------------------------------

FORM one.

DATA: name TYPE vrm_id,

list TYPE vrm_values,

value LIKE LINE OF list.

name = 'ONE'.

value-key = '1'.

value-text = 'Stock Report'.

APPEND value TO list.

CLEAR value.

value-key = '2'.

value-text = 'Open Sales Order Report'.

APPEND value TO list.

CLEAR value.

CALL FUNCTION 'VRM_SET_VALUES'

EXPORTING

id = name

values = list

EXCEPTIONS

id_illegal_name = 1

OTHERS = 2.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

ENDFORM. "ONE

&----


*& Form TWO

&----


  • text ----------------------------------------------------------------------

FORM two.

DATA: name TYPE vrm_id,

list TYPE vrm_values,

value LIKE LINE OF list.

name = 'TWO'.

value-key = '1'.

value-text = 'AS Stock Report'.

APPEND value TO list.

CLEAR value.

value-key = '2'.

value-text = 'AS Open Sales Order Report'.

APPEND value TO list.

CLEAR value.

CALL FUNCTION 'VRM_SET_VALUES'

EXPORTING

id = name

values = list

EXCEPTIONS

id_illegal_name = 1

OTHERS = 2.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

ENDFORM. "TWO

**********LINKS TO ABOVE SELECTION*********************

START-OF-SELECTION.

CASE one.

WHEN '1'.

CALL TRANSACTION 'MB5L'AND SKIP FIRST SCREEN.

WHEN '2'.

CALL TRANSACTION 'MM01'.

ENDCASE.

CASE two.

WHEN '1'.

CALL TRANSACTION 'MB52' AND SKIP FIRST SCREEN.

WHEN '2'.

CALL TRANSACTION 'MM01'.

ENDCASE.

                                      • Give the 1:: as 1 and 2:: as 2 it will work...

Regards,

Bharani

Edited by: SeethaRamaiah Bharani on Dec 18, 2009 8:10 PM

Read only

0 Likes
1,524

Hi,

Nope still doesn't work, i tried this before aswell.

Read only

0 Likes
1,524

Hi

Your code seems to be ok, after running the transactions for parameter ONE your report should call the transaction for paramter TWO

Max

Read only

0 Likes
1,524

Hi Max,

Thanks for your reply. Code works fine the issue is if you try the below you will see the same problem

1) When you run the program and in the first drop down select stock and click on run the program will appear.

2) Click Back and the selection screen will appear

3) In Drop down two select AS Stock and click RUN

4) Now you will see it has actually ran dropdown one then when you click back it will run AS Stock.

Hope that explains the bug.

Thanks

ADeel

Read only

0 Likes
1,524

Hi

That's as the flow of your report is:

 CASE one.  "<--------------- POINT A
    WHEN '1 ::'.
      CALL TRANSACTION 'MB5L' AND SKIP FIRST SCREEN.
    WHEN '2 ::'.
      CALL TRANSACTION 'ZSOD'.
  ENDCASE.



  CASE two. "<--------------- POINT B
    WHEN '1 ::'.
      CALL TRANSACTION 'MB52' AND SKIP FIRST SCREEN.
    WHEN '2 ::'.
      CALL TRANSACTION 'ZSOD'.
  ENDCASE.

So if the both parameters are filled, the report will call the transactions in point A and point B, if you need your report calls only one transaction u should check only one parametes is filled:

AT SELECTION-SCREEN.

  IF NOT ONE IS INITIAL AND
     NOT TWO IS INITIAL.
    MESSAGE E208(00) with 'Select 1 option only'.
  ENDIF.

Max

Read only

0 Likes
1,524

Hi Max,

Thanks for your help again. What i really wamt is that which ever selection is selected it should just run that not the other. Example being if i have selected Case one (When you select it it becomes yellow) then it should just run that regardless of an entry in Case two.

Isn't there a statament in abap to say what ever box user selects on run then it should restrict the entries to that only?

Hope that makes sense

Read only

0 Likes
1,524

Hi

You need to check which parameters are filled in the selection-screen, you can only avoid both parameters are filled simultaneously: that means if the ONE is filled, TWO has to be empty and if TWO has filled, ONE is empty.

Max

Read only

0 Likes
1,524

One option is you can use USER-COMMAND addition on those two drop down lists and can set a flag depending on the ucomm of the drop down list selected. Then in the start-of-selection you can use that flag to determine which of the switch cases to process.

Cheers!