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

problem with function module calling

Former Member
0 Likes
361

Hi,

I have two questions here

i have a function moduel 'Z_GET_MATL_BALANCE'

in my code it called in the below said way

CALL FUNCTION 'Z_GET_MATL_BALANCE'

DESTINATION 'NONE'

STARTING NEW TASK 'A'

PERFORMING f_back ON END OF TASK

EXPORTING

ref_dte = s_datum-low

str_dte = s_datum-high

end_dte = s_datum-high

i_werks = p_werks

i_past = 'X'

i_future = 'X'

verselem = p_mrpver

plscn = p_scenar

r_outrec = r_outrec

supstk = p_supstk

days_ahead = w_days_ahead

shipnt = p_shipnt

TABLES

mat_bals = w_zmat_bals_a

i_zdatum = i_datum

mat_movmts = w_mat_movmts_a

mat_ship = i_mat_ship_a.

IF sy-subrc NE 0.

MESSAGE e005(ZMIM) WITH

text-009 text-166 text-054 sy-subrc.

ENDIF.

FORM f_back USING task.

CASE task.

WHEN 'A' .

RECEIVE RESULTS FROM FUNCTION 'Z_GET_MATL_BALANCE'

TABLES

mat_bals = w_zmat_bals_a

mat_movmts = w_mat_movmts_a

mat_ship = i_mat_ship_a

EXCEPTIONS

call_material_lesen_fail = 1

call_t450n_fail = 2

call_t399d_fail = 3

call_aufbauen_mdpsx_fail = 4

call_mdezx_aufbauen_fail = 5

call_t001w_fail = 6

call_zmrpelem_failed = 7

call_aufbauen_mdpsx_sim_fail = 8

OTHERS = 9.

IF SY-SUBRC NE 0.

RET_CODE1 = SY-SUBRC.

ENDIF.

now my first question is what is the difference between function modules calling normally and in the above said way

and the second question is

under tables parameter i have four internal tables defined where as while calling the same function module using recive results i have three internal tables. is this correct?

i am asking this because i am getting an error message while using this funciton module

please do not give generic answers, all the helpful answers will get a def reward

2 REPLIES 2
Read only

former_member195698
Active Contributor
0 Likes
342

Call function starting new task is used to make Asynchronus RFC Call. In this case your function module will be called in a NEW SESSION and it will exceute independently from the Main program which is calling the FM. Also, the main program will continue its own processing and it will not wait for the RFC FM to complete.

Its not mandatory to have all the TABLES parameters in the RETURN Perform (..Receive results from ...)

Read only

Former Member
0 Likes
342

thanks