* Initialization of BAPIs CALL FUNCTION 'BAPI_PS_INITIALIZATION'. CALL FUNCTION 'BAPI_BUS2054_DELETE_MULTI' EXPORTING I_PROJECT_DEFINITION = G_F_PROJECT_DEF TABLES IT_DELETE_WBS_ELEMENT = P_G_T_DELETE_WBS “(All WBS which needs to be Deleted) ET_RETURN = P_G_T_RETURN. CLEAR G_F_ERROR. LOOP AT P_G_T_RETURN INTO G_R_RETURN. IF G_R_RETURN-TYPE CA G_C_AEX."Error Type A E or X G_F_ERROR = G_C_X. ENDIF. ENDLOOP. * Error handling / end processing IF G_F_ERROR IS INITIAL. *-- Post changes REFRESH L_T_RETURN2. CALL FUNCTION 'BAPI_PS_PRECOMMIT' TABLES ET_RETURN = L_T_RETURN2. *-- Check for errors LOOP AT L_T_RETURN2 INTO G_R_RETURN. " IF G_R_RETURN-TYPE CA G_C_AEX. G_F_ERROR = G_C_X. ENDIF. ENDLOOP. APPEND LINES OF L_T_RETURN2 TO P_G_T_RETURN. *-- Everything ok IF G_F_ERROR IS INITIAL. CALL FUNCTION 'BAPI_TRANSACTION_COMMIT' EXPORTING WAIT = G_C_X. COMMIT WORK. ELSE. CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'. REFRESH L_T_RETURN2. CALL FUNCTION 'BAPI_PS_PRECOMMIT' TABLES ET_RETURN = L_T_RETURN2. APPEND LINES OF L_T_RETURN2 TO P_G_T_RETURN. REFRESH L_T_RETURN2. CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'. ENDIF. * Error occured ELSE. CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'. REFRESH L_T_RETURN2. CALL FUNCTION 'BAPI_PS_PRECOMMIT' TABLES ET_RETURN = L_T_RETURN2. APPEND LINES OF L_T_RETURN2 TO P_G_T_RETURN. REFRESH L_T_RETURN2. CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'. ENDIF.
Delete multiple WBS for a project ID
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment