BAPI for posting cost into CJR2 “Resource cost post”
At top (data declaration)
L_R_HEADER TYPE BAPIPLNHDR, L_R_COOBJECT TYPE BAPIACIOBJ, L_T_COOBJECT TYPE STANDARD TABLE OF BAPIACIOBJ, *Post the effort into CJR2 Tcode CALL FUNCTION 'BAPI_COSTACTPLN_POSTACTINPUT' EXPORTING HEADERINFO = L_R_HEADER “header table that contain * delta = g_c_x "Add in the exiting value TABLES INDEXSTRUCTURE = L_T_INDEXSTR COOBJECT = L_T_COOBJECT PERVALUE = L_T_PERVALUE RETURN = P_G_T_RETURN. Header details L_R_HEADER-CO_AREA = '0010'. "Controlling area L_R_HEADER-FISC_YEAR = P_L_F_YEAR. "Fiscal year L_R_HEADER-PERIOD_FROM = '1'. L_R_HEADER-PERIOD_TO = '12'. L_R_HEADER-VERSION = '0'. " Version L_R_HEADER-PLAN_CURRTYPE = 'O'. "'O'-Object currency L_R_COOBJECT-OBJECT_INDEX = '1'. "Object index L_R_COOBJECT-WBS_ELEMENT = ‘Project ID’ or ‘WBSID’. APPEND L_R_COOBJECT TO L_T_COOBJECT. CLEAR L_R_COOBJECT. Now populate the quantity field "For H1 Acty type READ TABLE P_L_T_INPUT INTO G_R_INPUT INDEX 1. IF SY-SUBRC = 0. L_R_INDEXSTR-OBJECT_INDEX = '1'. L_R_INDEXSTR-VALUE_INDEX = '1'. APPEND L_R_INDEXSTR TO L_T_INDEXSTR. CLEAR L_R_INDEXSTR. L_F_VAL_INDEX = '1'."value index L_F_ACT = 'H1'."Activity type PERFORM FILL_QTY USING G_R_INPUT " Work area of internal table P_L_F_COST " Cost center L_F_ACT " Activity type L_F_VAL_INDEX " value index P_G_F_UNIT " Unit CHANGING L_T_PERVALUE. " Qty values ENDIF. "For H2 Acty type READ TABLE P_L_T_INPUT INTO G_R_INPUT INDEX 2. IF SY-SUBRC = 0. L_R_INDEXSTR-OBJECT_INDEX = '1'. L_R_INDEXSTR-VALUE_INDEX = '2'. APPEND L_R_INDEXSTR TO L_T_INDEXSTR. CLEAR L_R_INDEXSTR. L_F_VAL_INDEX = '2'. "value index L_F_ACT = 'H2'."Activity type PERFORM FILL_QTY USING G_R_INPUT ”Work area of internal table P_L_F_COST " Cost center L_F_ACT ”Activity type L_F_VAL_INDEX ” value index P_G_F_UNIT " Unit CHANGING L_T_PERVALUE. " Qty values ENDIF. Same for other activity types………………. IF P_G_T_RETURN [] IS INITIAL. COMMIT WORK AND WAIT. Endif.
No comments:
Post a Comment