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

Getting Dynamic selection Screen based on Key combinations

Former Member
0 Likes
482

HI Experts??

For Pricing Condition type, we have key combinations, based on selecting the key combination we have to populate the selection screen having select options for that key combinations.

Note : We could not able to create selection screens for each comination manually,we may have multiple pricing condition types, For each condition type we have multiple key comobinations, Based on selecting the key combination, we need to populate selection screen.

I know the logic for getting key combination fields.

I JUST WANT dynamic logic for displaying the selection screeen(SELECT-OPTIONS) based on that fields selection.

Thanks in Advance!!

1 REPLY 1
Read only

Former Member
0 Likes
397

hi Sanjana,

use this sample code.

  • Below is Function for a Dynamic Selection Screen

FUNCTION zstan_selections.

*"----


""Local interface:

*" IMPORTING

*" VALUE(TABNAME) LIKE DD02L-TABNAME DEFAULT 'ZSCARE'

*" EXPORTING

*" VALUE(DS_CLAUSES) TYPE RSDS_WHERE

*" EXCEPTIONS

*" TABLE_NOT_VALID

*" OTHER_ERROR

*"----


DATA texpr TYPE rsds_texpr.

DATA twhere TYPE rsds_twhere.

DATA trange TYPE rsds_trange.

DATA BEGIN OF qcat. "Selections View for

INCLUDE STRUCTURE rsdsqcat. "Free Selectoptions

DATA END OF qcat.

DATA BEGIN OF tabs OCCURS 10.

INCLUDE STRUCTURE rsdstabs.

DATA END OF tabs.

DATA BEGIN OF fields OCCURS 10.

INCLUDE STRUCTURE rsdsfields.

DATA END OF fields.

DATA BEGIN OF efields OCCURS 10.

INCLUDE STRUCTURE rsdsfields.

DATA END OF efields.

DATA selid LIKE rsdynsel-selid.

DATA actnum LIKE sy-tfill.

DATA title LIKE sy-title VALUE 'Selection Screen'.

DATA: maxnum LIKE sy-subrc VALUE '69'.

CLEAR tabs.

tabs-prim_tab = tabname.

COLLECT tabs.

DATA: position LIKE dd03l-position.

DATA: keyflag LIKE dd03l-keyflag.

CLEAR fields.

fields-tablename = tabname.

fields-sign = 'I'.

DATA: step LIKE sy-subrc.

SELECT fieldname keyflag position

INTO (fields-fieldname, keyflag, position)

FROM dd03l

WHERE tabname = tabname

AND fieldname NOT LIKE '.INCLU%'

AND datatype NE 'CLNT'

ORDER BY position.

ADD 1 TO step.

CHECK step LE maxnum.

IF keyflag <> 'X'.

efields = fields.

APPEND efields.

ENDIF.

APPEND fields.

ENDSELECT.

IF sy-subrc <> 0.

RAISE table_not_valid.

ENDIF.

CALL FUNCTION 'FREE_SELECTIONS_INIT'

EXPORTING

expressions = texpr

kind = 'F'

IMPORTING

selection_id = selid

expressions = texpr

where_clauses = twhere

field_ranges = trange

number_of_active_fields = actnum

TABLES

tables_tab = tabs

fields_tab = fields

fields_not_selected = efields

EXCEPTIONS

fields_incomplete = 01

fields_no_join = 02

field_not_found = 03

no_tables = 04

table_not_found = 05

expression_not_supported = 06

incorrect_expression = 07

illegal_kind = 08

area_not_found = 09

inconsistent_area = 10

kind_f_no_fields_left = 11

kind_f_no_fields = 12

too_many_fields = 13.

IF sy-subrc = 0.

CALL FUNCTION 'FREE_SELECTIONS_DIALOG'

EXPORTING

selection_id = selid

title = title

IMPORTING

where_clauses = twhere

expressions = texpr

field_ranges = trange

number_of_active_fields = actnum

TABLES

fields_tab = fields

EXCEPTIONS

internal_error = 01

no_action = 02

no_fields_selected = 03

no_tables_selected = 04

selid_not_found = 05.

IF sy-subrc = 0.

CLEAR ds_clauses.

MOVE tabname TO ds_clauses-tablename.

READ TABLE twhere WITH KEY ds_clauses-tablename INTO ds_clauses.

IF sy-subrc <> 0.

RAISE other_error.

ENDIF.

ELSE.

RAISE other_error.

ENDIF.

ELSE.

RAISE other_error.

ENDIF.

ENDFUNCTION.

Reward points if useful

Chandra