CALL function modules in ABAP

Function modules can be called in a program using the keyword CALL. Both system and customer function modules can be called using this statement.

 

Various Syntax usage of CALL for function modules

 

Calling a standard function module

CALL FUNCTION module

[EXPORTING  f1 = a1 ... fn = an]

[IMPORTING  f1 = a1 ... fn = an]

[CHANGING   f1 = a1 ... fn = an]

[TABLES     f1 = a1 ... fn = an]

[EXCEPTIONS e1 = r1 ... en = rn [ERROR_MESSAGE = rE]

[OTHERS = ro]].

 

Calling a customer developed function module

CALL CUSTOMER-FUNCTION <func>

 

Asynchronous calling of RFC function modules

CALL FUNCTION func STARTING NEW TASK task

[DESTINATION {dest|{IN GROUP {group|DEFAULT}}}]

parameter list

[{PERFORMING subr}|{CALLING meth} ON END OF TASK].

 

Call function in background

CALL FUNCTION func IN BACKGROUND TASK

 

CALL FUNCTION – IN UPDATE TASK

CALL FUNCTION update_function IN UPDATE TASK

[EXPORTING p1 = a1 p2 = a2 ...]

[TABLES t1 = itab1 t2 = itab2 ...].

 

This statement registers the update function module specified in update_function.

 

Other important things to remember

EXPORTING and IMPORTING should fill with the parameters we need to send and receive. EXCEPTIONS are for handling and specifying the exception for that function module. ERROR_MESSAGE is for handling the messages. Before calling a customer function, that function module should be created and activated.

Also Read : View Other ABAP Keywords & Syntax -> ABAP Transaction codes

Share this ...FacebookGoogle+LinkedInDiggtumblrTwitter