Dear All,
Hope you are all doing well.
Today I am going to show you on how to create WBS elements to the project definitions using SE38 report.
below is the steps used to create the WBS elements.
1) First we need to initialize the below BAPI to create WBS element.
**BAPI to Initialization to create Project/WBS.
CALL FUNCTION 'BAPI_PS_INITIALIZATION'.
2) Then we need to pass WBS value which is going to create.
**PASS WBS ELEMENT VALUE
IS_WBS_ELEMENT-WBS_ELEMENT = '1234-X445'.
IS_WBS_ELEMENT-DESCRIPTION = 'NEW WBS ELEMENT'.
APPEND IS_WBS_ELEMENT TO IT_WBS_ELEMENT.
3) Next step we need to call the BAPI BAPI_BUS2054_CREATE_MULTI to create WBS element to the respective project definition.
**BAPI TO CREATE WBS
CALL FUNCTION 'BAPI_BUS2054_CREATE_MULTI'
EXPORTING
I_PROJECT_DEFINITION = '1234-XX3'
TABLES
IT_WBS_ELEMENT = IT_WBS_ELEMENT
ET_RETURN = IT_RETURN.
4) After this we need to call Pre commit and commit BAPI's.
READ TABLE IT_RETURN INTO DATA(LS_RETURN) WITH KEY TYPE = 'S'.
IF SY-SUBRC = 0.
**PRE COMMIT
CALL FUNCTION 'BAPI_PS_PRECOMMIT'
TABLES
ET_RETURN = IT_RETURN.
**TRANSACTION COMMIT.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT = 'X'.
ENDIF.
5) Like this we can create WBS element to the project definition using BAPI's in the report. When we go to CJ20 transaction we can see the new WBS elements created to it.
Please find the below source code for your reference.
**Data declarations
DATA: it_return TYPE TABLE OF bapiret2,
it_wbs_element TYPE TABLE OF bapi_bus2054_new,
is_wbs_element TYPE bapi_bus2054_new.
**BAPI to Initialization to create Project/WBS.
CALL FUNCTION 'BAPI_PS_INITIALIZATION'.
**PASS WBS ELEMENT VALUE
is_wbs_element-wbs_element = '1234-X445'.
is_wbs_element-description = 'NEW WBS ELEMENT'.
APPEND is_wbs_element TO it_wbs_element.
**BAPI TO CREATE WBS
CALL FUNCTION 'BAPI_BUS2054_CREATE_MULTI'
EXPORTING
i_project_definition = '1234-XX3'
TABLES
it_wbs_element = it_wbs_element
et_return = it_return.
READ TABLE it_return INTO DATA(ls_return) WITH KEY type = 'S'.
IF sy-subrc = 0.
**PRE COMMIT
CALL FUNCTION 'BAPI_PS_PRECOMMIT'
TABLES
et_return = it_return.
**TRANSACTION COMMIT.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = 'X'.
WRITE : 'WBS Element created succesfully'.
ELSE.
WRITE : 'WBS Element not created, having errors'.
ENDIF.
Hope this will helpful to all.
Regards.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
11 | |
8 | |
7 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 | |
4 |