Skip to Content
0
Former Member
Jan 15, 2007 at 05:04 AM

Insert WBS for existing project using BAPI_BUS2054_CREATE_MULTI

592 Views

Hi All,

I need to create or insert WBS structure to existing project. I got WBS details and project it related in file. I try to use BAPI “BAPI_BUS2054_CREATE_MULTI” to create WBS But I following erros

Errors

1.Object WBS Element XXX could not be created

2.WBS element XXX is not released

3.The dates for WBS element XXX cannot be changed

4.The dates for WBS element XXX could not be processed

Warning

1.Factory calendar in project differs from plant factory calendar

I am not sure what the issue, I am passing WBS_UP via file to build hierarchy. Please find code below for more details. If any anyone can provide some that will be great. Thanks in advance.

Regards,

Trim

LOOP AT gt_wbs_element .

MOVE-CORRESPONDING gt_wbs_element to gt_wbs_element_bapi.

MOVE : gt_wbs_element-mims_id to gt_wbs_element_bapi-USER_FIELD_CHAR20_1.

MOVE : gt_wbs_element-PROJECT_DEFINITION to gv_proj.

  • Convert all dates

split_date gt_wbs_element-WBS_BASIC_START_DATE gt_wbs_element_bapi-WBS_BASIC_START_DATE.

split_date gt_wbs_element-WBS_BASIC_FINISH_DATE gt_wbs_element_bapi-WBS_BASIC_FINISH_DATE.

split_date gt_wbs_element-WBS_FORECAST_START_DATE gt_wbs_element_bapi-WBS_FORECAST_START_DATE.

split_date gt_wbs_element-WBS_FORECAST_FINISH_DATE gt_wbs_element_bapi-WBS_FORECAST_FINISH_DATE.

split_date gt_wbs_element-WBS_ACTUAL_START_DATE gt_wbs_element_bapi-WBS_ACTUAL_START_DATE.

split_date gt_wbs_element-WBS_ACTUAL_FINISH_DATE gt_wbs_element_bapi-WBS_ACTUAL_FINISH_DATE.

APPEND gt_wbs_element_bapi.

  • Update Custome 'Z' Fields

clear : BAPI_TE_WBS_ELEMENT, gv_error.

BAPI_TE_WBS_ELEMENT-WBS_ELEMENT = gt_wbs_element-WBS_ELEMENT.

BAPI_TE_WBS_ELEMENT-ZZCP_APPRBUD = gt_wbs_element-ZZCP_APPRBUD.

BAPI_TE_WBS_ELEMENT-ZZCP_ELECT = gt_wbs_element-ZZCP_ELECT.

BAPI_TE_WBS_ELEMENT-ZZCP_AREA = gt_wbs_element-ZZCP_AREA.

BAPI_TE_WBS_ELEMENT-ZZCP_PROG = gt_wbs_element-ZZCP_PROG.

BAPI_TE_WBS_ELEMENT-ZZCP_SUBPR = gt_wbs_element-ZZCP_SUBPR.

  • BAPI_TE_WBS_ELEMENT-ZZCP_FINALDAT = gt_wbs_element-ZZCP_FINALDAT.

BAPI_TE_WBS_ELEMENT-ZZCP_TOTBUD = gt_wbs_element-ZZCP_TOTBUD.

  • BAPI_TE_WBS_ELEMENT-ZZCP_DADHC_REG = gt_wbs_element-ZZCP_DADHC_REG.

  • BAPI_TE_WBS_ELEMENT-ZZCP_DADHC_CEP = gt_wbs_element-ZZCP_DADHC_CEP.

BAPI_TE_WBS_ELEMENT-ZZCP_PREDBUD = gt_wbs_element-ZZCP_PREDBUD.

BAPI_TE_WBS_ELEMENT-ZZCP_CLIENT = gt_wbs_element-ZZCP_CLIENT.

BAPI_TE_WBS_ELEMENT-ZZCP_PM_NAME = gt_wbs_element-ZZCP_PM_NAME.

GT_EXTENSION_IN-STRUCTURE = 'BAPI_TE_WBS_ELEMENT'.

GT_EXTENSION_IN-VALUEPART1 = BAPI_TE_WBS_ELEMENT+0(199).

GT_EXTENSION_IN-VALUEPART2 = BAPI_TE_WBS_ELEMENT+199(171).

APPEND GT_EXTENSION_IN.

MOVE-CORRESPONDING gt_wbs_element to wa_wbs_elem.

AT END OF PROJECT_DEFINITION.

  • Inalise BAPI

CALL FUNCTION 'BAPI_PS_INITIALIZATION'.

clear gt_return[].

CALL FUNCTION 'BAPI_BUS2054_CREATE_MULTI'

EXPORTING

I_PROJECT_DEFINITION = gv_proj

TABLES

IT_WBS_ELEMENT = gt_wbs_element_bapi

ET_RETURN = gt_return

EXTENSIONIN = gt_extension_in

  • EXTENSIONOUT =

EXCEPTIONS

error_message = 1

others = 2.

  • Check GT_RESULT for success

LOOP AT gt_return where type co 'EA'.

gv_error = 'X'.

ENDLOOP.

IF gv_error is initial.

CALL FUNCTION 'BAPI_PS_PRECOMMIT'

TABLES

ET_RETURN = gt_return_pre.

LOOP AT gt_return_pre where type co 'EA'.

gv_error = 'X'.

ENDLOOP.

ENDIF.

IF gv_error is INITIAL.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

EXPORTING

WAIT = '1'

IMPORTING

RETURN = GT_RETURN_COMMIT.

endif.

endloop.