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

Small query on module pool programming

Former Member
0 Likes
887

Hi

I am creating a module pool program. It has one scrren. I have declared a structure in TOP include. I have added one i/o fields in the screen which is not taken from any DB table or any standard structure. let us say it is new_str-abc, where new_str is a structure I have defined in the top include. Now when I enter a value in this fields in the screen, I want to catch this value in PAI of the screen and use this in further process. How to do this??

thanks

sankar

7 REPLIES 7
Read only

seshatalpasai_madala
Product and Topic Expert
Product and Topic Expert
0 Likes
821

Hi,

Data transfer between screen field and Program data happens automatically if the screen field name and the data variable name are same.

If you have created in your top inclide liethis

DATA: new_str type <some type>.

And gave your screen field name as new_str-abc.

Then the value will automatically get transfeered from screen field to your program field.

SO check in PAI if you have that value in the strcutre declared in the top include.

Check in DEBUG mode.

What you can also do is USE

TABLES: structure_type_name.

And then you can get the fields from DDIC using this strcutre type.

Regards,

Sesh

Read only

Former Member
0 Likes
821

Hi sankar,

Data declaration alone is enough.

Check if the data type you have declared in your program for the field matches or is compatible.

_______________________________________________________

If the statement FIELD is used in the event block at point of time PAI, then the statement controls the data transport for the specified dynpro field. <i>By default, all dynpro fields are transported to the ABAP program at the event PAI and before the processing of the corresponding event block. If you use one or multiple FIELD-statements, only such dynpro fields are transported directly at the event PAI, which are not listed after a FIELD-statement.</i>

The transport of the content of a dynpro field dynp_field specified after FIELD to the homonymous global ABAP data object takes place at execution of the corresponding FIELD-statement. If a dynpro field is listed in more than one FIELD-statement, its value is transfered when the first corresponding FIELD-statement is executed.

________________________________________________________

But try the following too..

To transport field values from screen to program the following command helps:

<b>FIELD dynp_field { [ MODULE mod [] ]

| [ [MODULE mod] WITH hlp ] }.</b>

The FIELD statement of the screen flow logic controls the data transport from the dynpro to the ABAP program during the event PAI. It can be combined with the MODULE statement to conditionally call dialog modules, to allow you to check any input, and to allow self-programmed field and input helps at the events POH and POV.

To transfer a group of fields :

<b>CHAIN.

FIELD input3.

FIELD input4.

FIELD input5.

MODULE check_chain ON CHAIN-REQUEST.

ENDCHAIN.</b>

Refer the following documentation:

http://help.sap.com/saphelp_nw2004s/helpdata/en/9f/dbaa4735c111d1829f0000e829fbfe/frameset.htm

http://help.sap.com/saphelp_40b/helpdata/en/9f/dbaa5435c111d1829f0000e829fbfe/content.htm

<i>** Reward Points if useful **</i>

regards,

Naveenan.

Message was edited by:

Naveenan

Read only

former_member196299
Active Contributor
0 Likes
821

hi Sankar ,

Its simple , in module pool programming the screen fields stores values and you can directly use them in the PAI n PBO ..

Regards,

Ranjita

Read only

Former Member
0 Likes
821

Hi Shankar,

Data transfer between Screen fields and ABAP fields happens automatically if the same names are used. The types of these shouls also be same.

To do this,

1. Create a field of the required type in your TOP include.

2. Use Dictianary/Program fileds window' in the screen editor and give the field name defined in step 1 and press the 'Get From Program' button. This will create a screen field with the same definition done in step 1.

Data will now automatically transfer and you need not do any extra coding. Use of this field in PAI will directly fetch you the value the user entered.

Regards,

Suma

Read only

Former Member
0 Likes
821

Hello,

The easiest way to do is to define your field on the screens directly from the program using menu painter....

go to the program ...double click on the screen-> layout->On the top enter your field name"new_str-abc" or structure name"new_str" and click-> get from program->choose fields->paste on screen....This will solve your problem

Reward all useful answers

Regards

Byju

Read only

Former Member
0 Likes
821

your structure is new_str

and filed is abc in that structure.

you want to use the value enterde here at PAI

then simply declare a field of same type

ex.

data: new_field type new_str-abc.

and in pai of the screen

use

new_field = new_str-abc.

Aditya

Read only

Former Member
0 Likes
821

To put it simply, if we want to capture values from screen in the program ( either PAI or PBO ) we have to declare a field with the same name in the program too as you declared on the screen.

Say you have declared a field with name "name1 " on the screen then you have to declare a variable with similar name in the program. In that way whatever value you enter in the field on the screen is automatically put in this field in the program.

That way you can use the value for furthur statements.

Thanks,

Venkat