Application Development 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: 

associate the comment with the button

0 Kudos
563

hello experts:

I have a problem: do you know how to associate the comment with the button. In Selection Screen, the FOR FIELD is used to associate the comment with the PARAMETERS and SELECT-OPTIONS, but it doesn't work for button.

SELECTION-SCREEN BEGIN OF LINE.

SELECTION-SCREEN PUSHBUTTON 31(57) butt USER-COMMAND rfsh MODIF ID y07.

SELECTION-SCREEN COMMENT 1(30) text-802 y07 MODIF ID y97.

SELECTION-SCREEN END OF LINE.

wrong:

SELECTION-SCREEN BEGIN OF LINE.

SELECTION-SCREEN PUSHBUTTON 31(57) butt USER-COMMAND rfsh MODIF ID y07.

SELECTION-SCREEN COMMENT 1(30) text-802 for field y07 MODIF ID y97.

SELECTION-SCREEN END OF LINE.

Thanks in advance.

Bob

1 ACCEPTED SOLUTION

Former Member
0 Kudos
307

Hi Bob

why u want to use for field statment for providing the comment to a button.

i have seen your code and tried at my end , if u simply write comment statment with text-element fot button text , it will work

here is your code.

SELECTION-SCREEN BEGIN OF LINE.

SELECTION-SCREEN PUSHBUTTON 31(50) text-002 USER-COMMAND rfsh MODIF ID y07.

SELECTION-SCREEN COMMENT 1(25) text-001 MODIF ID y97.

SELECTION-SCREEN END OF LINE.

Hope i understood ur problem correctly

rewards if helpful.

5 REPLIES 5

Former Member
0 Kudos
308

Hi Bob

why u want to use for field statment for providing the comment to a button.

i have seen your code and tried at my end , if u simply write comment statment with text-element fot button text , it will work

here is your code.

SELECTION-SCREEN BEGIN OF LINE.

SELECTION-SCREEN PUSHBUTTON 31(50) text-002 USER-COMMAND rfsh MODIF ID y07.

SELECTION-SCREEN COMMENT 1(25) text-001 MODIF ID y97.

SELECTION-SCREEN END OF LINE.

Hope i understood ur problem correctly

rewards if helpful.

Kanagaraja_L
Active Contributor
0 Kudos
307

SELECTION-SCREEN COMMENT [/]<pos(len)> <comm> FOR FIELD <f>

MODIF ID <key>.

This statement writes the <comm> comment on the selection screen. For <comm>, you can specify a text symbol or a field name with a maximum length of eight characters. This character field must not be declared with the DATA statement, but is generated automatically with length <len>. The field must be filled before the selection screen is called. You must always specify the <pos(len)> addition. Only if there are several elements in one line, can you omit <pos>.

The text <comm> will be displayed, starting in column <pos>, for a length of <len>. If you do not use a slash (/), the comment is written into the current line; otherwise a new line is created.

You use FOR FIELD <f> to assign a field label to the comment. <f> can be the name of a parameter or a selection criterion. As a result, if the user requests help on the comment on the selection screen, the help text for the assigned field <f> is displayed.

The MODIF ID <key> addition has the same function as for the PARAMETERS statement. You can use it to modify the comment before the selection screen is called.

Check the Example

SELECTION-SCREEN BEGIN OF LINE.

SELECTION-SCREEN COMMENT 10(20) TEXT-001 FOR FIELD PARM.

SELECTION-SCREEN POSITION POS_LOW.

PARAMETERS PARM LIKE SAPLANE-PLANETYPE.

SELECTION-SCREEN END OF LINE.

Kanagaraja L

Former Member
0 Kudos
307

Hey Bob

Pass the text in initialization event:


SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN PUSHBUTTON 31(57) butt USER-COMMAND rfsh MODIF ID y07.
*SELECTION-SCREEN COMMENT 1(30) text-802 y07 MODIF ID y97.  " <-- Commented
SELECTION-SCREEN END OF LINE.

INITIALIZATION.
MOVE 'BUTT TEXT' TO BUTT. " <--- Text for Push Button

Regards

Eswar

0 Kudos
307

Thanks, all.

Actually I wanna add a text before the button, just like a label for a input field.

After I searched from the F1 help for Commnect. It seems impossible. "If the addition FOR FIELD is used, the output field is linked to a parameter or sel selection criterion of the same program defined by PARAMETERS or SELECT-OPTIONS ". It doesn't allow to associate to the button.

Now I would use your ways and add the text on the button.

Thanks

0 Kudos
307

Hey Bob

In that case, you can do it as below:


SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 1(30) text-802.  "<--- Label
SELECTION-SCREEN PUSHBUTTON 31(57) butt USER-COMMAND rfsh MODIF ID y07.
SELECTION-SCREEN END OF LINE.

INITIALIZATION.

MOVE 'BUTT TEXT' TO BUTT. "<-- Text to be displayed on button, For no text, ignore passing the value in Initialization event.

Copy the above code, create the text element, execute and check the result.

Regards

Eswar