Understanding Different Types of SAP Function Modules: Normal, RFC, and Update
1. Normal/Regular Function Module :-
- It can be called inside the system.
- Here Pass by value + Pass by reference both is fine.
2. RFC Function Modules :-
-
You can call from same system or from another possible.
-
In RFC function module you can only have pass by value.
-
In the same system if you are going to add the DESTINATION
NONE’ while calling the RFC then it’ll be called in separate session.
3. UPDATE Function Modules :-
- This is generally used to update the database record.
- Update Function Module can be called from the same system. ( Background RFC / trfc / grfc )
- This is used to achieve generally the SAP LUW.
- Some time we use from performance perspective also.
- When COMMIT WORK gets executed then Update starts getting executed.
Important Questions on Update Function Modules :-
- When Update function Module gets Triggered ?
- ON COMMIT WORK
-
IF a update function module gets failed, under which transaction we can see that ?
OR
What is the T-Code for monitoring the Update function module failures ?
- SM13
let’s create a remote Function Module.
Requirement :-
- Suppose, we have a vendor portal which is extended to SAP.
- So, the requirement is when Vendor Login to the Portal, We have to show him the list of Purchase Order though RFC.
Solution :-
Part 1 :- Creating function Module
-
Step 1 :- Go to SE37.
-
Step 2 :- Give name and function group.
-
Step 3 :- Open the attributes tab and select remote enabled module.
-
Step 4 :- Take import parameters.
-
Step 5:- Give a export parameter to display the message in export section.
-
Step 6 :- define parameters in tables section.
-
Step 7 :- Write the logic in source code.
Part 2 :- Creating RFC Destination
-
Step 1 :- go to SM59 and click on ABAP connections.
-
Step 2 :- Click on create button.
-
Step 3 :- Provide the destination → connection type → description → target host → instance number.
-
Press enter.
-
Step 4 :- Click on Login and security.
-
Step 5 :- In the login and security → provide language → client number → user → password → click on save.
-
Step 6 :- Click on Connection test.
- As you can see connection was successful.
Part 3 :- Calling RFC in the program.
-
Step 1 :- Go to ABAP editor and create a executable program.
-
Step 2 :- Follow the below program.
- We have used the destination of our RFC.
Code.
*****************************************************
*Start of Program
***********************
DATA : lt_ekko TYPE TABLE OF ekko,
lt_ekpo TYPE TABLE OF ekpo,
gv_msg TYPE string.
PARAMETERS : p_lifnr TYPE lifnr,
p_ebeln TYPE ebeln.
START-OF-SELECTION.
CALL FUNCTION 'ZAR_VENDOR_PO' DESTINATION 'ZDRFC'
EXPORTING
ip_lifnr = p_lifnr
ip_ebeln = p_ebeln
IMPORTING
ep_msg = gv_msg
TABLES
ot_ekko = lt_ekko
ot_ekpo = lt_ekpo.
IF lt_ekko is not INITIAL.
CL_DEMO_OUTPUT=>DISPLAY( lt_ekko ).
ELSEIF lt_ekpo[] is not INITIAL.
CL_DEMO_OUTPUT=>DISPLAY( lt_ekpo ).
ELSE.
WRITE : gv_msg.
ENDIF.
**********************************
*End of Program
****************************************************
Execute the Program :-
-
For lifnr first.
-
Press F8.
-
-
For lifnr and ebeln both
-
Press F8.
-
Okay I have understand function module but I'm having a problem creating a Bapi to update customer contract details from an external api how can l solve that one please help
ReplyDelete