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: 

Pass value in module

Former Member
0 Kudos

Is it possible to pass value in module?


chain.

field xxx module check_data .....

endchain.

9 REPLIES 9

venkat_o
Active Contributor
0 Kudos

Hi, <li>It is possible to check.


CHAIN.
FIELD MARA-MATNR MODULE check_data.
ENDCHAIN.

MODULE check_data INPUT.
 "Write your code here and validate your input to the field MATNR on screen.
ENDMODULE.
Thanks Venkat.O

MarcinPciak
Active Contributor
0 Kudos

What do you mean by "pass value"? Once you declare corresponding field (same name and type as screen field) in ABAP program, the value for that field will automatically be passed back and forth to program and screen.

Former Member
0 Kudos

Hello Frn,

It is not possible to pass the vaue ...

Thanks and Regards..

Priyank dixit

Former Member
0 Kudos

Hi,

Value will be automatically passed when you create the variable with same name in your ABAP program.

Regards

Milan

0 Kudos

I have the following situation:


chain.
FIELD p9115-data_imputaz MODULE check_data.
.
.
.
.
endchain.


module CHECK_DATA input.

CALL FUNCTION 'ZCHECK_DATA'
  EXPORTING
    data_in       = p9115-data_imputaz
          .

endmodule. 

I want to utilize the module check_data also with other field but I have need to change dinamically the exporting parameter for function module.

0 Kudos

Ok, so this is what you need


"in screen flow logic
chain.
FIELD: field, field2 MODULE check_data.
enchain. 
 
"in program 
DATA: field(14) TYPE c,   "example fields
      field2(14) TYPE c.

DATA: fieldname TYPE string.
FIELD-SYMBOLS <value> TYPE ANY.


module CHECK_DATA input.

  GET CURSOR FIELD fieldname.  "gets current field name (the one which you are in)
  ASSIGN (fieldname) TO <value>.  "get its value

"now declare FM parameter as    data_in TYPE ANY  so you can pass any value
 CALL FUNCTION 'ZCHECK_DATA'
  EXPORTING
    data_in       = <value>.
endmodule. 

Regards

Marcin

sridhar_meesala
Active Contributor
0 Kudos

Hi,

Why do you want to pass the value here ? The value which you are going to give in the module pool screen is going to be validated.

Thanks,

Sri.

Former Member
0 Kudos

It is not requried to pass value becz you have already declared the variable globally.

Former Member
0 Kudos

Hi Alfonso,

In a module pool, when you say:

FIELD var1 MODULE a

the value of 'var1' is automatically passed from the screen to the module. This happens when the field value is entered for the first time, or when the value is changed.

On encountering ENDMODULE, the processed value is returned.

Do you want to do a pass-by-value only? If that is what you ask, no that is not possible. The call is pass-by-reference, so the value of the variable changes as per the module's code.

Hope this is helpful! Please elaborate on your requirement, and I'll revert back.

Cheers,

Shailesh.

Always provide feedback for helpful answers!!