Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

BAPI_BUS_2054_SET_STATUS Error

Former Member
0 Likes
2,417

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?

8 REPLIES 8
Read only

Former Member
0 Likes
1,876

Ciao,

Can you please paste the code that you are using?

R

Read only

0 Likes
1,876

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.

Read only

0 Likes
1,876

And where is the APPEND statement ?

Hint: Also internal table with header line are obsolete statement, forbidden in OO, now you should understand why...

Regards,

Raymond

Read only

0 Likes
1,876

sorry, in copy and paste the code i forget the append statement but there is in the source code ..

Read only

0 Likes
1,876

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.

Read only

RaymondGiuseppi
Active Contributor
1,876

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

Read only

0 Likes
1,876

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 ..

Read only

0 Likes
1,876

Is it a "sequential" user status, if yes you may be required to add the current status in undo field ?

(I just tried your code and it worked for me, for an "independent" user status on a single WBS)