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

Select option in Dialog program screen

Former Member
0 Likes
4,343

Hi friends,

do we have any way to get a select option displayed in dialog programming ?

or

create a screen field with the properties of a select option in dialog screen ?

or

any standard function module to support this scenario ?

Thanks and Regards

Sakthi.

16 REPLIES 16
Read only

Former Member
0 Likes
2,198
1.on the screen create the fields low and high as in select option say with names s_matnr-low and s_matnr-high

2.Declare ranges table with name s_matnr
   data : begin of s_matnr occurs 0,
            sign(1),
            option(2),
            low like mara-matnr,
            high like mara-matnr,
          end of s_matnr.


3.u can use this internal table

Message was edited by: Sekhar

Read only

Former Member
0 Likes
2,198

hi friend,

here the issue is, I want all the options of a select option to be present in the screen field. All additions....

even I got the logic you told me. but how can I give the options of a selcet option for a screen field ?

Read only

0 Likes
2,198
try this......


selection-screen begin of screen 101.
selection-screen begin of block b1 with frame title text-001.
select-options:s_matne for mara-matnr.
selection-screen end of block b1 .
selection-screen end of screen 101.
Read only

0 Likes
2,198

You cannot directly have a screen field that is a select option. You can however do as Sekhar told, that is to declare a selection screen 100 and then include that in a subscreen area of your main screen.

Srinivas

Read only

2,198

Srinivas is right, there are a couple of ways of doing this, but the easiest is to include the selection screen in a subscreen, then include the subscreen in your dynpro. Here is a sample program which will walk you thru the process.



report zrich_0006 .

tables: mara.

* Custom Selection Screen 1010
selection-screen begin of screen 1010 as subscreen.
selection-screen begin of block b1 with frame title text-001.
parameters: p_rad1 radiobutton group grp1 default 'X',
            p_rad2 radiobutton group grp1,
            p_rad3 radiobutton group grp1.
select-options: s_matnr for  mara-matnr,
                s_matkl for  mara-matkl,
                s_mtart for  mara-mtart.
selection-screen end of block b1.
selection-screen end of screen 1010.


start-of-selection.

  call screen 100.
*&---------------------------------------------------------------------*
*&      Module  STATUS_0100  OUTPUT
*&---------------------------------------------------------------------*
module status_0100 output.
*  SET PF-STATUS 'xxxxxxxx'.
*  SET TITLEBAR 'xxx'.

endmodule.
*&---------------------------------------------------------------------*
*&      Module  USER_COMMAND_0100  INPUT
*&---------------------------------------------------------------------*
module user_command_0100 input.

endmodule.


* create   screen 100 and create a subscreen area called "subscreen_1010"


* Screen Flow Logic follows

*process before output.
*
*  module status_0100.
*
*  call subscreen subscreen_1010 including sy-repid '1010'.
*
*process after input.
*
*  call subscreen subscreen_1010 .
*
*  module user_command_0100.

Regards,

Rich Heilman

Read only

0 Likes
2,198

alternatviely you can use this FM to get selection screen type dialog

COMPLEX_SELECTIONS_DIALOG

Regards

Raja

Read only

0 Likes
2,198

Rich Heilman,

you are simply superb. i had similar requirement. by your answer. i got it done.

thank you so much !!

Read only

Former Member
0 Likes
2,198

Hi,

yes there is a way to make a field select option,

double click on field which you want to make it as select option, it will display the attributes screen, in that click on <b>program</b> attributes button , now go to <b>poss. entries</b> in the dropdown choose <b>1 show at selection</b>.

but it will behave like no-intervals option.

we did one such requirement....

check it...

Regards

vijay

Read only

0 Likes
2,198

Vijay,

thats for providing F4 icon for the field.

with that we can code F4 for a field. you wont get select-option kind of field with that.

there are only two options

1. define a selection-screen and call it in your program (as suggested by Rich)

2. use the FM i had suggested. (declare the field in and place a icon next to it and on click of that you call the fm i have mentioned and give reference to the field to the FM)

Regards

Raja

Read only

0 Likes
2,198

Hi,

i don't know you checked it or not, but i am able to do it, i send the screen shot also to you check it..

it is possible,with some coding also check it once...

REPORT  ZTEST_SCREEN                            .
DATA : BEGIN OF IT_DYNPFIELDS OCCURS 3.
        INCLUDE STRUCTURE DYNPREAD.
DATA : END OF IT_DYNPFIELDS.
DATA: TEST(10) TYPE C.
RANGES:  R_UNAME FOR SY-UNAME.
DATA:     V_USERNAME LIKE  SY-UNAME.
DATA : V_PROG LIKE D020S-PROG VALUE 'ZTEST_SCREEN',
       V_DNUM LIKE D020S-DNUM VALUE '0100'.
CALL SCREEN 100.
*&---------------------------------------------------------------------*
*&      Module  STATUS_0100  OUTPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE STATUS_0100 OUTPUT.
  SET PF-STATUS 'TEST'.
*  SET TITLEBAR 'xxx'.

ENDMODULE.                 " STATUS_0100  OUTPUT
*&---------------------------------------------------------------------*
*&      Module  USER_COMMAND_0100  INPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE USER_COMMAND_0100 INPUT.
  CASE SY-UCOMM.

    WHEN 'BACK'.
      LEAVE TO SCREEN 0.

  ENDCASE.
ENDMODULE.                 " USER_COMMAND_0100  INPUT
*&---------------------------------------------------------------------*
*&      Module  GET_CURSOR_USERNAME  INPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE GET_CURSOR_USERNAME INPUT.

  REFRESH IT_DYNPFIELDS.
  CLEAR   IT_DYNPFIELDS.

  MOVE 'V_USERNAME' TO IT_DYNPFIELDS-FIELDNAME.
  APPEND IT_DYNPFIELDS.
  CLEAR   IT_DYNPFIELDS.

  CALL FUNCTION 'DYNP_VALUES_READ'
    EXPORTING
      DYNAME               = V_PROG
      DYNUMB               = V_DNUM
      TRANSLATE_TO_UPPER   = 'X'
    TABLES
      DYNPFIELDS           = IT_DYNPFIELDS
    EXCEPTIONS
      INVALID_ABAPWORKAREA = 1
      INVALID_DYNPROFIELD  = 2
      INVALID_DYNPRONAME   = 3
      INVALID_DYNPRONUMMER = 4
      INVALID_REQUEST      = 5
      NO_FIELDDESCRIPTION  = 6
      INVALID_PARAMETER    = 7
      UNDEFIND_ERROR       = 8
      DOUBLE_CONVERSION    = 9
      STEPL_NOT_FOUND      = 10
      OTHERS               = 11.
  IF SY-SUBRC = 0.
    READ TABLE IT_DYNPFIELDS WITH KEY FIELDNAME = 'V_USERNAME'.
    IF SY-SUBRC = 0.
      V_USERNAME = IT_DYNPFIELDS-FIELDVALUE.
    ENDIF.
  ENDIF.
  PERFORM GET_MULTIPLE.


ENDMODULE.                 " GET_CURSOR_USERNAME  INPUT
*&---------------------------------------------------------------------*
*&      Form  GET_MULTIPLE
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM GET_MULTIPLE .
* Dynamically holding Field name
  FIELD-SYMBOLS: <FST> TYPE STANDARD TABLE.
  IF  R_UNAME[] IS INITIAL.
    IF NOT V_USERNAME IS INITIAL.
      R_UNAME-SIGN = 'I'.
      R_UNAME-OPTION = 'EQ'.
      R_UNAME-LOW = V_USERNAME.
      APPEND R_UNAME.
      CLEAR  R_UNAME.
    ENDIF.
  ENDIF.

  ASSIGN R_UNAME[] TO <FST>.
  CALL FUNCTION 'COMPLEX_SELECTIONS_DIALOG'
    EXPORTING
      TITLE             = 'Select Multiple Value'(059)
      TEXT              = 'Finish Group'(058)
      SIGNED            = 'X'
      LOWER_CASE        = ' '
      NO_INTERVAL_CHECK = 'X'
      JUST_DISPLAY      = ' '
      JUST_INCL         = 'X'
    TABLES
      RANGE             = <FST>
    EXCEPTIONS
      NO_RANGE_TAB      = 1
      CANCELLED         = 2
      INTERNAL_ERROR    = 3
      OTHERS            = 4.

  IF SY-SUBRC = 0.
    READ TABLE R_UNAME INDEX 1.
    IF SY-SUBRC = 0.
      V_USERNAME = R_UNAME-LOW.
    ENDIF.
  ENDIF.

ENDFORM.                    " GET_MULTIPLE

Flow loogic....

PROCESS BEFORE OUTPUT.
 MODULE STATUS_0100.
*
PROCESS AFTER INPUT.
 MODULE USER_COMMAND_0100.

 PROCESS ON VALUE-REQUEST.

*- To capture the cursor and for f4
  FIELD V_USERNAME      MODULE GET_CURSOR_USERNAME.

in screen i have one field v_username

for that field do this

<b>double click on field which you want to make it as select option, it will display the attributes screen, in that click on program attributes button , now go to poss. entries in the dropdown choose 1 show at selection.</b>

Regards

vijay

Read only

0 Likes
2,198

Sorry Vijay there seems to be a misunderstanding.

This is your preiouvs answer

"<i>Hi,

yes there is a way to make a field select option,

double click on field which you want to make it as select option, it will display the attributes screen, in that click on program attributes button , now go to poss. entries in the dropdown choose 1 show at selection.

but it will behave like no-intervals option.

we did one such requirement....

check it...

Regards

vijay"</i>

Where there is no mention of coding, just making the attribute change. thats why i was mentioning that you have to use the FM ('COMPLEX_SELECTIONS_DIALOG') and not by just simply chaning the attribute .

Hope this clears the doubt.

Regards

Raja

Read only

0 Likes
2,198

Hi Raja,

I missed it...,sorry for the confusion..

Regards

Vijay

Read only

0 Likes
2,198

hi all,

do you get your icon changed when using this code?

cheers

Oliver

Read only

0 Likes
2,198

Hey Vijay,

I followed ur code for one of my requirements and it works perfect !! I have a question on this...Once i make my selections , i understand my selection criteria is stored in R_UNAME[] as

I EQ 10

or

I GE 10

I LE 20

I BT 10 20

Now how do i make use of this in my select statement to retrieve the data ... For e.g. in my requirement I want to allow user to enter values for sales order...

he can choose to enter a sales order number range , or just one equal to value or greater than value etc...

how do i accomodate this in my where clause in my select statement ?

thks

Read only

0 Likes
2,198

Hey,

I guessed that I shud use the IN operator but it was not working for me initially. But now when I debugged it, it does. I dont know what went wrong but its fine now. thanks

Read only

Former Member
0 Likes
2,198

Hi,

Use MODAL DIALOG box for this, and simulate the Select-Option Functionality.