ā2014 Jul 01 9:57 AM
Hello!
Am struggling for past two days for changing the WBS element status. Am usign the BAPI_BUS2001_SET_STATUS. am not able to update the project status to 'CLSD'. Kindly see my below code and correct me if am wrong. I dont know which are the parameters to pass.
REPORT ZV_TEST_BAPI_HAARISH2.
DATA : gs_project_definition TYPE PS_PSPID value 'O-AM278 -1'.
DATA :
gt_wbs_element_table TYPE PS_POSID
OCCURS 0 WITH HEADER LINE,
gt_return type BAPI_MTYPE
OCCURS 0 WITH HEADER LINE,
gt_message_table LIKE bapi_meth_message
OCCURS 0 WITH HEADER LINE,
gt_result TYPE BAPI_STATUS_RESULT
OCCURS 0 WITH HEADER LINE.
*data : l_SET_system_STATUS like BAPI_SYSTEM_STATUS-SYSTEM_STATUS value 'CLSD'.
CALL FUNCTION 'BAPI_PS_INITIALIZATION'.
CALL FUNCTION 'BAPI_BUS2001_SET_STATUS'
EXPORTING
PROJECT_DEFINITION = gs_project_definition
UNDO_SYSTEM_STATUS = 'REL'
* UNDO_USER_STATUS =
SET_SYSTEM_STATUS = 'CLSD'
* SET_USER_STATUS =
*IMPORTING
* RETURN = gt_return
*TABLES
* E_RESULT = gt_result
.
CALL FUNCTION 'BAPI_PS_PRECOMMIT'
TABLES
ET_RETURN = gt_return
.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
*EXPORTING
* WAIT ='X'
*IMPORTING
* RETURN =
.
ā2014 Jul 01 10:02 AM
Hi,
Check the documentation:
With the BAPI BAPI_BUS2001_SET_STATUS, one system status (UNDO_SYSTEM_STATUS) and one user status (UNDO_USER_STATUS) can be revoked each time, and one system status (SET_SYSTEM_STATUS) and one user status (UNDO_USER_STATUS) can be set each time for a project definition (PROJECT_DEFINITION).
hence you can not change UNDO_SYSTEM_STATUS and SET_SYSTEM_STATUS at the same time.
So you need to call the BAPI sequentially to change each status.
Regards,
ā2014 Jul 01 10:48 AM
My client's requirement is to change the user status to closed-CLSD for 100 assets in the single transaction. they want me to develope the customer code for this using BAPI. The BAPI that can be used is BAPI_BUS2001_SET_STATUS. Even the am following the correct sequence of this BAPI am not getting the result.
CALL FUNCTION 'BAPI_PS_INITIALIZATION'.
CALL FUNCTION 'BAPI_BUS2001_SET_STATUS'
PROJECT_DEFINITION = LV_PRJDEF
\UNDO_SYSTEM_STATUS =
* UNDO_USER_STATUS =
SET_SYSTEM_STATUS = LV_CLSD
* SET_USER_STATUS =
IMPORTING
RETURN = LV_RETURN
TABLES
E_RESULT = LT_RESULT
* .
CALL FUNCTION 'BAPI_PS_PRECOMMIT'.
TABLES
ET_RETURN = IT_RETURN.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
* EXPORTING
* WAIT =
* IMPORTING
* RETURN =
(Here LV_PRJDEF contains all the projects whose status needs to be
changed Lv_CLSD contains the status to be set like "CLSD'.
Whenever the BAPI is executed, the results are stored in LV-RETURN.
If LV_RETURN is initial , BAPI execution is successful else the
errors are stored in the table LT_RESULT.
As soon as an error occurs in an individual BAPI or in the
BAPI "BAPI_PS_PRECOMMIT", you have the following options:
* Exit the report or the program that calls the BAPIs, the
PRECOMMIT and the COMMIT WORK.
* Execute a rollback in the current processing unit.
If someone share me the correct source code for my req it will be very helpful since am a fresher.