‎2015 Jun 04 1:55 PM
I'm trying to set a user status on a WBS with BAPI_BUS_2054_SET_STATUS, but when I call BAPI_PS_PRECOMMIT I obtain an error (CNIF_PI 070) with information that are missing required fields.
But if I change the WBS user status by CJ20N transaction I don't have any problems.
Anyone can help me please?
‎2015 Jun 04 2:53 PM
‎2015 Jun 04 3:15 PM
This is my code:
| MOVE 'PRET' TO iwbsuserstatus-set_user_status. | |
| MOVE ls_prps-posid TO iwbsuserstatus-wbs_element. |
CALL FUNCTION 'BAPI_PS_INITIALIZATION'.
CALL FUNCTION 'BAPI_BUS2054_SET_STATUS'
| IMPORTING | ||
| return | = return | |
| TABLES | ||
| i_wbs_user_status = iwbsuserstatus | ||
| e_result | = eresult | |
| EXCEPTIONS | ||
| OTHERS | = 01. |
IF sy-subrc EQ 0 AND return-type NE 'E'.
| READ TABLE eresult INTO ls_eresult WITH KEY status_action = 'E'. | |
| IF sy-subrc NE 0. | |
| CALL FUNCTION 'BAPI_PS_PRECOMMIT' | |
| TABLES | |
| et_return = lt_return. | |
| READ TABLE lt_return INTO ls_return WITH KEY type = 'E'. | |
| IF sy-subrc NE 0. | |
| CALL FUNCTION 'BAPI_TRANSACTION_COMMIT' | |
| EXPORTING | |
| wait = 'X'. | |
| ENDIF. | |
| ENDIF. |
ENDIF.
‎2015 Jun 04 3:22 PM
‎2015 Jun 04 3:26 PM
sorry, in copy and paste the code i forget the append statement but there is in the source code ..
‎2015 Jun 04 3:36 PM
Then it should work.
I got it from the FM doc.
User statuses can be set or revoked in accordance with the status profile assigned to the WBS element structure. This must be assigned using the key in the respective log-on language.
The sequence should be worked through as follows:
1. Revoke system status
2. Revoke user status
3. Set system status
4. Set user status
Check in table TJ30/TJ30T if your status is not dependent on any other status.
One more thing check the POSID is being sent in in accordance to ABPSN conv exit.
‎2015 Jun 04 3:21 PM
But if I change the WBS user status by CJ20N transaction I don't have any problems.
So problem doesn't come from SAP and current status of WBS but from your code
Seems you have forgotten to fill some data in your code (but then without my crystall ball....)
Hint: look for some records without WBS_ELEMENT field or neither UNDO_USER_STATUS nor SET_USER_STATUS field, did you use BAPI_BUS2054_GET_STATUS before calling the SET BAPI or did you builkd the itab from scrap (from JEST) ?
Regards,
Raymond
‎2015 Jun 04 3:33 PM
the table a runtime have 1 entry (the wbs element) and the NEW user status in the SET_USER_STATUS ... UNDO_USER_STATUS is null ..
If I call the BAPI_BUS2054_GET_STATUS previously I get the correct current user status ..
‎2015 Jun 04 3:57 PM