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: 

variables in screen painter

Former Member
0 Kudos

Hi. I'm creating a SCREEN in screenpainter. I'm painting a Input/Output Field ang give it's name: EKKO-LIFNR. When I launch screen it works correctly (the corresponding records from DB appears after click on the field). But when I choose some value, how to refer to it in the code later? Greetings. P.

1 ACCEPTED SOLUTION

former_member181962
Active Contributor
0 Kudos

Hi Piotr,

YOu have to declare a variable with the same name. This approach may sometimes give some problems.

Hence it is advisable that you define a variable in the program and activate the program. Then go to the painter and use the GET from program button and use the program variable as the screen field.

This way, you do not have to specifically code for the transfer of data from/to screen and to/from program.

Regards,

Ravi

7 REPLIES 7

0 Kudos

Hi,

Use <b>TABLES: EKKO.</b>

And then you can get the value in a filed "EKKO-LIFNR".

<b>HINT:</b> Screen values will come to program only if there is any DATA in the program with the same name as that of the screen field.

That is suppose your screen field name is "TEXT"

now in your program use

DATA: TEXT type STRING.

Then what ever you type in the screen field TEXT you will get it in your program variable TEXT.

TABLES statement creates a strcture with the same name as that of the strcutre or table name that we give. Its really helpfull when you get screen fields from Dictionary.

Regards,

Sesh

former_member181962
Active Contributor
0 Kudos

Hi Piotr,

YOu have to declare a variable with the same name. This approach may sometimes give some problems.

Hence it is advisable that you define a variable in the program and activate the program. Then go to the painter and use the GET from program button and use the program variable as the screen field.

This way, you do not have to specifically code for the transfer of data from/to screen and to/from program.

Regards,

Ravi

0 Kudos

So I declare in code:

DATA: ekorgg LIKE ekko-ekorg.

Then go to screenpainter, create a in/out field, give it's name EKORG and then in attribute window in tab Dict I check 'Get parameter'.

With or without checking that option program looks similarly. When I launch screen the field I've created doesn't have a sarch help and I have to set it manually in screen painter (for ekorg it's H_T024E) Is there some simpler way? Because now I have to find what's the search help for every field I want to display. Greetings. P.

0 Kudos

Hi P,

I think i should re explain it.

1) Declare ekorg type ekko-ekorg.

2) Then go tot the screen painter. There will be a button "Get from Program" on the tool bar.

3) If you click that button, you will get a pop up with all the program variables. You can chose EKORG from that list and drag it in the place you want.

4) activate and test.

Regards,

Ravi

0 Kudos

Ok that works but there is still no search help assigned to that field after launching program. I tried

DATA: ekorg type ekko-ekorg.

DATA: ekorg like ekko-ekorg.

and there is no effect. Do You know how to solve that problem?

0 Kudos

Sometimes the F4 button wil not be visible. Just press F4 on your keyboard and see if get the search help.

Also check if the Possible Entries Checkbox checked in the screen attirbutes for that field.

Regards,

Ravi

0 Kudos

The steps I take when adding a field like this to a dynpro are:

1. Add the field and call it EKKO-EKORG.

2. When the popup asks you "The new name EKKO-EKORG is a field name from the ABAP Dictionary. / Do you want the screen element to refer to the Dictionary", confirm "Yes", and also "Yes" to "Dictionary field EKKO-EKORG / Do you want to copy field from Dictionary all attributes?"... this will bring through all the attributes such as conversion exits and parameter IDs.

3. Rename the field to the name you have defined in your code... typically in my programs this would be something like "GS_0200-EKORG" as I like to set up a structure for all fields on a screen (as it makes it quick to clear them, and document their use)... see step 5 below.

4. Change the settings on the "Poss. entries" if you want to force the Searchhelp icon to be forced on or off.

5. In the top include for the module pool define the variable e.g.

data:
  begin of gs_0200,   "named because g=Global, s=Structure, Dynpro = 0200
    ekorg                  like ekko-ekorg,
    field2                 like something-else, "etc etc
  end of gs_0200.

6. In your code you can refer to gs_0200-ekorg to pick up the value entered, or the value chosen from the picklist.