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

how to create dynamic selection screen?

Former Member
0 Likes
1,671

how to create dynamic selection screen?

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
831

Hi..,,

just execute this sample code ...

<i>This program displays an empty selection screen with two Push buttons on Application tool bar 'Material' , 'Purchase Document'..

When u click on the Material .. u will get a select option to enter values for the Material.. and when u click on the purchase Document ,, u will get a select option to enter PO numbers...</i>

<b>tables : mara, ekko, sscrfields.

data : w_flag1 type i,

w_flag2 type i.

SELECT-OPTIONS : S_MATNR FOR MARA-MATNR MODIF ID sc1.

SELECT-OPTIONS : S_EBELN FOR EKKO-EBELN MODIF ID sc2.

SELECTION-SCREEN: FUNCTION KEY 1,

FUNCTION KEY 2.

INITIALIZATION.

sscrfields-functxt_01 = 'Material'.

sscrfields-functxt_02 = 'Purchase document'.

LOOP AT SCREEN.

IF SCREEN-GROUP1 = 'SC1' OR SCREEN-GROUP1 = 'SC2'.

SCREEN-ACTIVE = 0.

MODIFY SCREEN.

CONTINUE.

ENDIF.

ENDLOOP.

At selection-screen output.

IF w_flag1 = 1.

LOOP AT SCREEN.

IF SCREEN-GROUP1 = 'SC2'.

SCREEN-ACTIVE = 0.

MODIFY SCREEN.

ENDIF.

ENDLOOP.

CLEAR W_FLAG1.

ELSEIF W_FLAG2 EQ 1.

LOOP AT SCREEN.

IF SCREEN-GROUP1 = 'SC1'.

SCREEN-ACTIVE = 0.

MODIFY SCREEN.

ENDIF.

ENDLOOP.

CLEAR W_FLAG2.

ENDIF.

AT SELECTION-SCREEN.

CASE sscrfields-ucomm.

WHEN 'FC01'.

w_flag1 = 1.

WHEN 'FC02'.

w_flag2 = 1.

ENDCASE.</b>

Hope this helps u...

regards,

sai ramesh

4 REPLIES 4
Read only

Former Member
0 Likes
832

Hi..,,

just execute this sample code ...

<i>This program displays an empty selection screen with two Push buttons on Application tool bar 'Material' , 'Purchase Document'..

When u click on the Material .. u will get a select option to enter values for the Material.. and when u click on the purchase Document ,, u will get a select option to enter PO numbers...</i>

<b>tables : mara, ekko, sscrfields.

data : w_flag1 type i,

w_flag2 type i.

SELECT-OPTIONS : S_MATNR FOR MARA-MATNR MODIF ID sc1.

SELECT-OPTIONS : S_EBELN FOR EKKO-EBELN MODIF ID sc2.

SELECTION-SCREEN: FUNCTION KEY 1,

FUNCTION KEY 2.

INITIALIZATION.

sscrfields-functxt_01 = 'Material'.

sscrfields-functxt_02 = 'Purchase document'.

LOOP AT SCREEN.

IF SCREEN-GROUP1 = 'SC1' OR SCREEN-GROUP1 = 'SC2'.

SCREEN-ACTIVE = 0.

MODIFY SCREEN.

CONTINUE.

ENDIF.

ENDLOOP.

At selection-screen output.

IF w_flag1 = 1.

LOOP AT SCREEN.

IF SCREEN-GROUP1 = 'SC2'.

SCREEN-ACTIVE = 0.

MODIFY SCREEN.

ENDIF.

ENDLOOP.

CLEAR W_FLAG1.

ELSEIF W_FLAG2 EQ 1.

LOOP AT SCREEN.

IF SCREEN-GROUP1 = 'SC1'.

SCREEN-ACTIVE = 0.

MODIFY SCREEN.

ENDIF.

ENDLOOP.

CLEAR W_FLAG2.

ENDIF.

AT SELECTION-SCREEN.

CASE sscrfields-ucomm.

WHEN 'FC01'.

w_flag1 = 1.

WHEN 'FC02'.

w_flag2 = 1.

ENDCASE.</b>

Hope this helps u...

regards,

sai ramesh

Read only

Former Member
0 Likes
831

Hi,

for this u have use the function module "rss_template_instantiate".

check the doccumentation of that FM.

regards,

bharat.

Read only

ferry_lianto
Active Contributor
0 Likes
831

Hi,

You can use the following statement.

SELECTION-SCREEN DYNAMIC SELECTIONS FOR NODE|TABLE <node>.

declares a node <node> of a logical database for dynamic selections in the selection include.

To use the dynamic selections in the SELECT statements of the subroutine PUT_<node>, you must use the data object DYN_SEL. The data object DYN_SEL is automatically generated in the logical database program as follows:

TYPE-POOLS RSDS.

DATA DYN_SEL TYPE RSDS_TYPE.

You do not have to program these lines yourself. The data object DYN_SEL is available in the database program but not in a connected executable program.

The type RSDS_TYPE of the data object is defined in the type group RSDS as follows:

TYPE-POOL RSDS.

  • WHERE-clauses ------------------------------

TYPES: RSDS_WHERE_TAB LIKE RSDSWHERE OCCURS 5.

TYPES: BEGIN OF RSDS_WHERE,

TABLENAME LIKE RSDSTABS-PRIM_TAB,

WHERE_TAB TYPE RSDS_WHERE_TAB,

END OF RSDS_WHERE.

TYPES: RSDS_TWHERE TYPE RSDS_WHERE OCCURS 5.

  • Expressions Polish notation ---------------

TYPES: RSDS_EXPR_TAB LIKE RSDSEXPR OCCURS 10.

TYPES: BEGIN OF RSDS_EXPR,

TABLENAME LIKE RSDSTABS-PRIM_TAB,

EXPR_TAB TYPE RSDS_EXPR_TAB,

END OF RSDS_EXPR.

TYPES: RSDS_TEXPR TYPE RSDS_EXPR OCCURS 10.

  • Selections as RANGES-tables -----------------

TYPES: RSDS_SELOPT_T LIKE RSDSSELOPT OCCURS 10.

TYPES: BEGIN OF RSDS_FRANGE,

FIELDNAME LIKE RSDSTABS-PRIM_FNAME,

SELOPT_T TYPE RSDS_SELOPT_T,

END OF RSDS_FRANGE.

TYPES: RSDS_FRANGE_T TYPE RSDS_FRANGE OCCURS 10.

TYPES: BEGIN OF RSDS_RANGE,

TABLENAME LIKE RSDSTABS-PRIM_TAB,

FRANGE_T TYPE RSDS_FRANGE_T,

END OF RSDS_RANGE.

TYPES: RSDS_TRANGE TYPE RSDS_RANGE OCCURS 10.

  • Definition of RSDS_TYPE

TYPES: BEGIN OF RSDS_TYPE,

CLAUSES TYPE RSDS_TWHERE,

TEXPR TYPE RSDS_TEXPR,

TRANGE TYPE RSDS_TRANGE,

END OF RSDS_TYPE.

For more information, please check this link.

http://help.sap.com/saphelp_nw04/helpdata/en/67/93b80914a911d2953c0000e8353423/content.htm

Regards,

Ferry Lianto