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

Changing text fields in module pool dynamically

Former Member
0 Likes
7,647

Hello,

I want to change the text fields during runtime in screens.

If the label is 'EMPLOYEE'.

I want to change it to 'EMPLOYER'.

1 ACCEPTED SOLUTION
Read only

Former Member
4,065

Hi,

Try this.

In the TOP include declare a variable of type string or c.(say w_test).

Now in the screen painter go to dictionary/program fields window(F6) and give w_test as input and click Get from program.Select the field and put it on the screen.Now go to the attribute window of the I/O field and in Program tab give output only.

Now the I/O field on the screen has been linked to the variable in your program.

Now whatever value you will assign to this variable(w_test) will be reflected on screen.

According to the condition dynamically change the values of the variable in the PBO ("employee" or"employer" in your case).

This should solve your problem.

Thanks and regards

Avinash

9 REPLIES 9
Read only

Rocky1
Product and Topic Expert
Product and Topic Expert
0 Likes
4,065

Hi,

We cannot change label directly but the same thing can be achieved in a different way. Instead of label create a I/O field

and go to Program and make it output only. it will now behave as label but the text can be changed iin the following way.

Step 1 : Declare a variable of TYPE STRING in your Program and map that i/o field(on screen) to this variable.

DATA: V_VAR1 TYPE STRING.

Now map it to from i/o field of screen.

Step 2: In the PBO of the screen write the following :

Loop AT SCREEN.

V_VAR1 = 'HII'.

ENDloop.

Thanks & Regards

Rocky kr. Agarwal

Read only

0 Likes
4,065

Hi,

In addition to Rocky's responce, You can select the screen field attribute 2D display in display tab to avoid displaying the borders for the input fields.

Thanks,

Vinod.

Read only

Rocky1
Product and Topic Expert
Product and Topic Expert
0 Likes
4,065

Hi,

Even if you want any other modufication you can check for more options in display tabs and you can go ahead.

Thanks & Regards

Rocky Kr. Agarawal

Read only

Former Member
0 Likes
4,065

Hi ROCKY and Vinod I tried by using OUTPUT ONLY but then the field becomes invisible.

So what should be done about it?

Read only

Rocky1
Product and Topic Expert
Product and Topic Expert
0 Likes
4,065

Hi,

In top declare a variable .

tables: vekp.

Data: V_var1 TYPE STRING.

Go to screen layout create a textbox. Double click on it, a dialog box will appear. Click on program tab. make it output only. Now map it to the variable declared in top.

Mapping the variable:

Click on the text field. press F6. you will get a dialog box. Enter the name of the variable (V_var1) and click on get from program.

But before clicking on Get to program make sure that your top declaration is active. After clicking on Get from program select the listed variable and click on check.

Activate the screen.

In the PBO of the screen assign a value to the variable

module STATUS_0100 output.

  • SET PF-STATUS 'xxxxxxxx'.

  • SET TITLEBAR 'xxx'.

Loop AT SCREEN.

V_var1 = 'HII'.

ENDloop.

endmodule.

It will work. It has to work. Try and see. If still not working then paste the code that u have written.

Thanks & regards

Rocky

Read only

Rocky1
Product and Topic Expert
Product and Topic Expert
0 Likes
4,065

Hi,

I wrongly added table in top include. Please avoid that.

Thanks & Regards

Rocky

Read only

Former Member
0 Likes
4,065

Hi Rocky,sgrshah,

We do not need to "loop at screen" for assigning the value to the variable and displaying it on screen.

Only V_var1 = 'HII' will work fine.

Thanks

Avinash

Read only

Former Member
0 Likes
4,065

Hi, In PBO you will have to put code as follows

loop at screen

  • make the text fieldvisible/invisible according to the condition.

modify screen.

endloop.

Edited by: bhushankotwal on Nov 19, 2009 9:44 AM

Read only

Former Member
4,066

Hi,

Try this.

In the TOP include declare a variable of type string or c.(say w_test).

Now in the screen painter go to dictionary/program fields window(F6) and give w_test as input and click Get from program.Select the field and put it on the screen.Now go to the attribute window of the I/O field and in Program tab give output only.

Now the I/O field on the screen has been linked to the variable in your program.

Now whatever value you will assign to this variable(w_test) will be reflected on screen.

According to the condition dynamically change the values of the variable in the PBO ("employee" or"employer" in your case).

This should solve your problem.

Thanks and regards

Avinash