06-27-2008 12:38 PM
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?
06-27-2008 1:08 PM
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
06-27-2008 12:55 PM
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
06-27-2008 1:08 PM
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
06-27-2008 1:53 PM
@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
06-27-2008 3:16 PM
static text would not be effected using the BEGIN OF LINE option.
06-27-2008 3:22 PM
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.
06-30-2008 7:37 AM
06-27-2008 1:15 PM
Hi,
You can try using parameter & giving comment.
assign dynamic value to comment (i.e. to G_FIELD_TEXT )
06-27-2008 1:38 PM
Comment looks like an option. But a comment would follow the select box. would not substitute the field name
06-27-2008 1:28 PM
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.