How to set dynamic icon, text to the screen PF status button
The post describes how to dynamically set the button icon, text in the pf status of a dynpro(screen).
Create a program and create a screen.
It is a normal screen.
The PBO module is implemented to call the PF status and set in this screen.
Give the pf status name and double click on it to create.
Choose Dialog status.
In the application toolbar provide the fcode as- ZADD and double click on it to create the button. Select as static text.
Provide the function text and icon nae.
The button is having static text.
Activate the pf status and activate the program and execute the program. Here we can see the static button appears.
Let’s add another fcode to the pf status but this time choose Dynamic Text.
The below popup appears to select a field (with particular structure ) that is defined in the program. Do a F4 against the field name.
Choose Program field.
In the program we have not yet defined any field. So the search failed.
Do a F1 against the field and the help doc shows, in the program we have to define a data variable that refers to the dictionary structure SMP_DYNTXT.
Dictionary structure- SMP_DYNTXT which contains necessary components that helps to dynamically set the icon, text, info.
In program define a DATA that refers to the structure- SMP_DYNTXT.
Now add the fcode and select dynamic text and the field refers to the program variable that refers to dictionary structure SMP_DYNTXT
Here just a function code is set that refers to the properties of the program field- gv_btn_byn_txt to set the properties of the button.
Activate the PF Status and execute the program. Only static button appears.
‘In the program set the field values and execute the program and the button now appears in the program application toolbar with properties set in the program via coding.
There could be program conditions where the button FCODE remain same but the icon id, text to be set differently. In such a case this could be helpful.