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

Dynamic Selection text.

vimalv
Active Participant
0 Likes
3,038

Hello Experts,

I have a requirement, where one of the select-options on the selection screen needs to get its name on runtime.

To be more precise,

i have the following code in place :


DATA:   G_ATWRT TYPE ATWRT,
G_FIELD_TEXT TYPE DYNFNAM.

G_FIELD_TEXT = 'MYFIELD'. "==> RUNTIME VALUE
                                           
SELECT-OPTIONS: S_VBCOD FOR G_ATWRT.

The requirement is that instead of maintaining the field name value to be displayed for S_VBCOD under SELECTION TEXTS, the value should to be displayed should come from G_FIELD_TEXT.

Hope the question is clear.

I searched extensively on the forum/help for this, unfortunately could not find an answer.

Any ideas, experts?

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,958

Hi,

let me know at condition you need to get the dynamic text .

explain the condition when you need to get the text.

For any condition you have to check in the Intilaization.

Provide me the condition i will Provide logic to you.

Regards,

Madhavi

9 REPLIES 9
Read only

Former Member
0 Likes
1,958

Hi,

if u want to get dynamic text for selection screen field

declare a parameters field (to assign a dynamic value) and

assign that value to that selection-screen field in the initialization event

Reward points if the answer is helpful

Regards

chandu

Read only

Former Member
0 Likes
1,959

Hi,

let me know at condition you need to get the dynamic text .

explain the condition when you need to get the text.

For any condition you have to check in the Intilaization.

Provide me the condition i will Provide logic to you.

Regards,

Madhavi

Read only

0 Likes
1,958

@Madhavi,

On Initialization, I got the value for G_FIELD_TEXT fetched from a table where I have maintained the value.

So, on selection screen initialization, I have the runtime value for G_FIELD_TEXT ready. Now I need to assign this value to the field name for S_VBCOD at SCREEN.

I can not use the SELECTION-SCREEN BEGIN LINE as other parameters have STATIC names maintained in selection texts.

So the solution given by Paul would be my last resort.

@All. Thanks experts! You guys give beginers a hive of confidence out here

Read only

0 Likes
1,958

static text would not be effected using the BEGIN OF LINE option.

Read only

0 Likes
1,958

This works fine


DATA:   g_atwrt TYPE atwrt.
DATA:   sw.
SELECTION-SCREEN: BEGIN OF LINE.
SELECTION-SCREEN COMMENT 1(20) gfldtext for field s_vbcod.
SELECT-OPTIONS: s_vbcod FOR g_atwrt.
SELECTION-SCREEN: END OF LINE.

AT SELECTION-SCREEN OUTPUT.
  CASE sw.
    WHEN 'X'.
      gfldtext = 'Text Two'.
      CLEAR sw.
    WHEN OTHERS.
      gfldtext = 'Text One'.
      sw = 'X'.
  ENDCASE.

Read only

0 Likes
1,958

Thanks Paul!

Read only

Former Member
0 Likes
1,958

Hi,

You can try using parameter & giving comment.

assign dynamic value to comment (i.e. to G_FIELD_TEXT )

Read only

0 Likes
1,958

Comment looks like an option. But a comment would follow the select box. would not substitute the field name

Read only

Former Member
0 Likes
1,958

This is a possiblity.


DATA:   g_atwrt TYPE atwrt.
DATA:   sw.
*G_FIELD_TEXT TYPE DYNFNAM.

*G_FIELD_TEXT = 'MYFIELD'. "==> RUNTIME VALUE

SELECTION-SCREEN: BEGIN OF LINE.
PARAMETERS: gfldtext(20) MODIF ID xxx.
SELECTION-SCREEN: POSITION 23.
SELECT-OPTIONS: s_vbcod FOR g_atwrt.
SELECTION-SCREEN: END OF LINE.

AT SELECTION-SCREEN OUTPUT.
  CASE sw.
    WHEN 'X'.
      gfldtext = 'Text Two'.
      CLEAR sw.
    WHEN OTHERS.
      gfldtext = 'Text One'.
      sw = 'X'.
  ENDCASE.

  LOOP AT SCREEN.
    IF screen-group1 = 'XXX'.
      screen-input = 0.
      MODIFY SCREEN.
    ENDIF.
  ENDLOOP.