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

PUSH BUTTON text and tooltip dynamic in module pool

Former Member
0 Likes
2,186

I want to change at runtime the text and tooltip of a push button which belongs to a screen of module pool (not a pf_status).

Is there anyone who can help me?

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
815

Hello Eric,

A similar sort of question was raised by anuj and was answered by vinod...plz go through and it may meet your requirement.

I am creating a Dialog transaction.

I have the Following requirement:

I have say 5 push-buttons on the screen.

In PBO, i will make based on some condition the pushbutton as visible / invisible.

(This i can do using the loop at screen.. modify screen.. etc..

Now I wnat to keep the text of this pushbutton also to be dynamic...(though the name remains same )

So it's like this :

Pushbutton defined on the Screen with Name = 'Trans1'

and text = 'Trans1'.

Now at Runtime i just need to change the text to say 'MARA'.So internally the FCODE of the pushbutton still remains 'Trans1', For the user only the text would change.

If this is not possible then is there a way to generate the screen element dynamically. (Please note that this is a dialog transaction and i cannot use the method that is used for the dynmic code generation of selection screen of reports. )

Any help or inputs would be great!

Thanks,

Anuj D.

Hi,

This can be done. In the screen painter change attribute of the button as ‘Output Field’. In the program define a field called Trans1, which is the name of your button.

Data: Trans1(10).

In PBO, give the value for Trans1.

Trans1 = ‘MARA’.

This is it...

Please try this.

Thanks

Vinod

3 REPLIES 3
Read only

Former Member
0 Likes
815

HEllo,

Check this report done by Rich,

Ok..here is my example. Most of the code was generated by screen painter via the tabstrip control wizard. Create screen 100, use the tabstrip control wizard to create your tabstrip, name it TABSTRIP. Double click on the tab text elements, rename them TABSTRIP_TEXT1 and TABSTRIP_TEXT2 for the tab text elements, make sure that the output only check box is checked.

REPORT ZRICH_0003 .

data: TABSTRIP_TEXT1(30) type c,

TABSTRIP_TEXT2(30) type c.

start-of-selection.

call screen 100.

&----


*& Module STATUS_0100 OUTPUT

&----


  • text

----


module STATUS_0100 output.

  • SET PF-STATUS 'xxxxxxxx'.

  • SET TITLEBAR 'xxx'.

  • Fill the tabstrip text elements here!

TABSTRIP_TEXT1 = 'Text 1'.

TABSTRIP_TEXT2 = 'Text 2'.

endmodule. " STATUS_0100 OUTPUT

&----


*& Module USER_COMMAND_0100 INPUT

&----


  • text

----


module USER_COMMAND_0100 input.

endmodule. " USER_COMMAND_0100 INPUT

  • FUNCTION CODES FOR TABSTRIP 'TABSTRIP'

CONSTANTS: BEGIN OF C_TABSTRIP,

TAB1 LIKE SY-UCOMM VALUE 'TABSTRIP_FC1',

TAB2 LIKE SY-UCOMM VALUE 'TABSTRIP_FC2',

END OF C_TABSTRIP.

  • DATA FOR TABSTRIP 'TABSTRIP'

CONTROLS: TABSTRIP TYPE TABSTRIP.

DATA: BEGIN OF G_TABSTRIP,

SUBSCREEN LIKE SY-DYNNR,

PROG LIKE SY-REPID VALUE 'ZRICH_0003',

PRESSED_TAB LIKE SY-UCOMM VALUE C_TABSTRIP-TAB1,

END OF G_TABSTRIP.

DATA: OK_CODE LIKE SY-UCOMM.

  • OUTPUT MODULE FOR TABSTRIP 'TABSTRIP': SETS ACTIVE TAB

MODULE TABSTRIP_ACTIVE_TAB_SET OUTPUT.

TABSTRIP-ACTIVETAB = G_TABSTRIP-PRESSED_TAB.

CASE G_TABSTRIP-PRESSED_TAB.

WHEN C_TABSTRIP-TAB1.

G_TABSTRIP-SUBSCREEN = '0101'.

WHEN C_TABSTRIP-TAB2.

G_TABSTRIP-SUBSCREEN = '0102'.

WHEN OTHERS.

  • DO NOTHING

ENDCASE.

ENDMODULE.

  • INPUT MODULE FOR TABSTRIP 'TABSTRIP': GETS ACTIVE TAB

MODULE TABSTRIP_ACTIVE_TAB_GET INPUT.

OK_CODE = SY-UCOMM.

CASE OK_CODE.

WHEN C_TABSTRIP-TAB1.

G_TABSTRIP-PRESSED_TAB = C_TABSTRIP-TAB1.

WHEN C_TABSTRIP-TAB2.

G_TABSTRIP-PRESSED_TAB = C_TABSTRIP-TAB2.

WHEN OTHERS.

  • DO NOTHING

ENDCASE.

ENDMODULE.

Screen Flow is ....

PROCESS BEFORE OUTPUT.

  • PBO FLOW LOGIC FOR TABSTRIP 'TABSTRIP'

MODULE TABSTRIP_ACTIVE_TAB_SET.

CALL SUBSCREEN TABSTRIP_SCA

INCLUDING G_TABSTRIP-PROG G_TABSTRIP-SUBSCREEN.

MODULE STATUS_0100.

PROCESS AFTER INPUT.

  • PAI FLOW LOGIC FOR TABSTRIP 'TABSTRIP'

CALL SUBSCREEN TABSTRIP_SCA.

MODULE TABSTRIP_ACTIVE_TAB_GET.

MODULE USER_COMMAND_0100.

Vasanth

Read only

0 Likes
815

Thank you Vasanth ,

But my problem has nothing append with tabstrip but only push button

Read only

Former Member
0 Likes
816

Hello Eric,

A similar sort of question was raised by anuj and was answered by vinod...plz go through and it may meet your requirement.

I am creating a Dialog transaction.

I have the Following requirement:

I have say 5 push-buttons on the screen.

In PBO, i will make based on some condition the pushbutton as visible / invisible.

(This i can do using the loop at screen.. modify screen.. etc..

Now I wnat to keep the text of this pushbutton also to be dynamic...(though the name remains same )

So it's like this :

Pushbutton defined on the Screen with Name = 'Trans1'

and text = 'Trans1'.

Now at Runtime i just need to change the text to say 'MARA'.So internally the FCODE of the pushbutton still remains 'Trans1', For the user only the text would change.

If this is not possible then is there a way to generate the screen element dynamically. (Please note that this is a dialog transaction and i cannot use the method that is used for the dynmic code generation of selection screen of reports. )

Any help or inputs would be great!

Thanks,

Anuj D.

Hi,

This can be done. In the screen painter change attribute of the button as ‘Output Field’. In the program define a field called Trans1, which is the name of your button.

Data: Trans1(10).

In PBO, give the value for Trans1.

Trans1 = ‘MARA’.

This is it...

Please try this.

Thanks

Vinod