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

function module in form.

Former Member
0 Likes
755

Hi,

i have to call a function module called date_check_plausibility in my code twice once for "from date "and for "to date".how to pass my date as parameter to the from.

all replies will be rewarded.

Thanks in advance,

Anand.

6 REPLIES 6
Read only

Former Member
0 Likes
735

do this way ...


perform check_date using p_date_from changing p_from_date.

perform check_date using p_date_to   changing p_to_date.

Read only

Former Member
0 Likes
735

perform test using date1.

perform test using date2

form test using p_date.

in FM use the p_date.

endform.

Read only

Former Member
0 Likes
735

Hi

FORM f_check_date USING p_date TYPE sy-datum.

CALL FUNCTION 'DATE_CHECK_PLAUSIBILITY'

EXPORTING

date = p_date

EXCEPTIONS

plausibility_check_failed = 1

OTHERS = 2.

endform.

PERFORM f_check_date using <pass_req_date - from date.>

PERFORM f_check_date using <pass_req_date - to date.>

Thanks

Vijay

PLZ reward points if helpful

Read only

0 Likes
735

Hi Vijay,

thanks for replying so soon.can u help me with one more thing :

when i define the perform initially in the program am i supposed to write perform f_date_check using.....p_date. or just perform f_check_date.

also what is the syntax for passing parameter later.

is just this way:

loop at itab into wa_tab.

perform f_date_check using wa_tab-fdate.

plz reply.

Read only

Former Member
0 Likes
735

Hi,

While you create your function module. Specify IMPORT and EXPORT parameters with corresponding types.

In your program when you call the function module via Patterns, the function call will be displayed with EXPORTING and IMPORTING parameters.

You have to pass in the EXPORTING parameter the IMPORT TYPE declared in your function module.

The IMPORTING parameter in the function is the value it returns which you need to store in an appropriate variable.

DATA: ex_var TYPE C.

DATA: im_var TYPE C.

CALL FUNCTION 'my_own_function' "using patterns

EXPORTING

import_var_defined_in_fm = ex_var.

.

.

.

IMPORTING

export_var_defined_in_fm = im_var.

Reward if Helpful.

Read only

Former Member
0 Likes
735

hi anand,

' Using' is one of additional that we can use with the perform function..that is like pass by value in other languages. if u use 'changing' means its like pass by reference