Friday, September 28, 2018

How to create Update Function Module AND invoke it in normal program

                                UPDATE FUNCTION  MODULE :  
The main update technique for bundling database changes in a single database LUW is to use CALL FUNCTION... IN UPDATE TASK.

Here the main  program runs in normal abap session and the update FM runs in update session. The COMMIT WORK decides an asynchronous where as COMMIT WORK AND WAIT makes synchronous process.
The update work process passes this data to the database for updating, and analyzes the return message from the database.

 If the update was successful, the update work process triggers a database commit after the last database change and deletes the log entries from table VBLOG.

If an error occurred, the update work process triggers a database rollback, leaves the log entries in table VBLOG, flags them as containing errors, and sends a SAPoffice message to the user

 CREATE SE37-FUNCTION MODULE AND SELECT REMOTE FUNCTION MODULE


 ENTER THE FUNCTION GROUP AND DETAILS

 CREATE IM_TEST THAT IS REFERRING TO TABLE THAT YOU CREATED.


 DECLARE THE EXCEPTIONS.
WRITE   SOURCE CODE AND LOGIC THAT YOU WANT TO IMPLEMENT.

   NOW CREATE PROGRAM , CALL THE FUNCTION MODULE  ADD  UPDATE TASK IN
    CALL FUNCTION AFTER FUNCTION MODULE .
 FUNCTION MODULE IS STORED IN VBLOG TABLE WITH PARAMETER , UNTIL IT FINDS  STATEMENT COMMIT WORK AND COMMIT WORK AND WAIT . THEN , IT IS EXECUTED .
WE COULD SEE THE TABLE DATA (ENTRY)

IF AN ERROR OCCURRED THEN , YOU WILL RECIEVE MAIL IN YOUR SAP WORKPLACE,
IF YOU WANT TO ANALYSES THE UPDATE FUNCTION REQUEST'S



 GO TO  T-CODE ---SM13  AND DO NOTHING , JUST CLICK ON EXECUTE




IT WILL SHOW YOU THE UPDATE RECORD THAT WENT INTO ERROR.