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

Error with BAPI_PS_PRECOMMIT

sreeramkumar_madisetty
Active Contributor
0 Likes
5,219

Hello Experts,

To create the WBS Elements along with Settlement Rules,First I'm creating the Project Definitions.

Once Project Definitions were created successfully,to create the WBS Elements,using the below peace of code.

CALL FUNCTION 'BAPI_PS_INITIALIZATION'.

CALL FUNCTION 'BAPI_BUS2054_CREATE_MULTI'

CALL FUNCTION 'BAPI_PS_PRECOMMIT'

BAPI_TRANSACTION_COMMIT

With the 'BAPI_PS_PRECOMMIT',I'm getting Errors as

Final check of the project definition and the WBS elements: Error

Fill in all required entry fields

Can anyone show some light on how to rectify this problem and what may be the origin for this issue.

Regards,

Sreeram

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
2,327

Hi ,

I am not sure about this error but i can help you with my findings in this issue.

I searched for the error message in where used list ,It is used in FM CJ2001_PROJECT_PRECOMMIT.

The Error message is thrown based on flag lv_error .

It is set based on below code. Please debug this part of code and let us know your findings,Thanks

* 'CJWB_CHECK_BEFORE_COMMIT' changes title and status
* Save it before and set it back afterwards
  lv_title = sy-title.
  GET PF-STATUS ls_status.
  CALL FUNCTION 'CJWB_CHECK_BEFORE_COMMIT'
       EXCEPTIONS
            cancel = 1.
  IF sy-subrc <> 0.         "<<<<<<< Check 1
*   error from validation or BAdI ...
    lv_error = 'X'.
  ENDIF.
  SET PF-STATUS ls_status OF PROGRAM sy-cprog.
  sy-title = lv_title.

  IF lv_error IS INITIAL.
    CALL FUNCTION 'CJTR_POST_DATES'
         EXCEPTIONS
              sched_wrong    = 1
              check_top_down = 2
              OTHERS         = 0.
* if nothing is changed no_data_changed is raised in 'CJTR_POST_DATES'
* no error -> OTHERS = 0
    IF sy-subrc <> 0.             "<<<<< Check 2
      sy-msgty = 'E'.
      PERFORM put_sy_message(saplco2o).
      lv_error = 'X'.
    ENDIF.
  ENDIF.

* no number changes after this point ...
  IF lv_error IS INITIAL.
    PERFORM update IN PROGRAM saplcjtr.
    PERFORM get_new_numbers IN PROGRAM saplcjtr.
    PERFORM on_commit IN PROGRAM saplcjwb.
*   Overall success message for PD and all WBS elements involved
    MESSAGE s070(cnif_pi) WITH text-ner INTO null.
  ELSE.
*   Overall error message for PD and all WBS elements involved
    MESSAGE e070(cnif_pi) WITH text-err INTO null.  " <<<<<< Thrown Error  Message 
  ENDIF.

5 REPLIES 5
Read only

Former Member
0 Likes
2,328

Hi ,

I am not sure about this error but i can help you with my findings in this issue.

I searched for the error message in where used list ,It is used in FM CJ2001_PROJECT_PRECOMMIT.

The Error message is thrown based on flag lv_error .

It is set based on below code. Please debug this part of code and let us know your findings,Thanks

* 'CJWB_CHECK_BEFORE_COMMIT' changes title and status
* Save it before and set it back afterwards
  lv_title = sy-title.
  GET PF-STATUS ls_status.
  CALL FUNCTION 'CJWB_CHECK_BEFORE_COMMIT'
       EXCEPTIONS
            cancel = 1.
  IF sy-subrc <> 0.         "<<<<<<< Check 1
*   error from validation or BAdI ...
    lv_error = 'X'.
  ENDIF.
  SET PF-STATUS ls_status OF PROGRAM sy-cprog.
  sy-title = lv_title.

  IF lv_error IS INITIAL.
    CALL FUNCTION 'CJTR_POST_DATES'
         EXCEPTIONS
              sched_wrong    = 1
              check_top_down = 2
              OTHERS         = 0.
* if nothing is changed no_data_changed is raised in 'CJTR_POST_DATES'
* no error -> OTHERS = 0
    IF sy-subrc <> 0.             "<<<<< Check 2
      sy-msgty = 'E'.
      PERFORM put_sy_message(saplco2o).
      lv_error = 'X'.
    ENDIF.
  ENDIF.

* no number changes after this point ...
  IF lv_error IS INITIAL.
    PERFORM update IN PROGRAM saplcjtr.
    PERFORM get_new_numbers IN PROGRAM saplcjtr.
    PERFORM on_commit IN PROGRAM saplcjwb.
*   Overall success message for PD and all WBS elements involved
    MESSAGE s070(cnif_pi) WITH text-ner INTO null.
  ELSE.
*   Overall error message for PD and all WBS elements involved
    MESSAGE e070(cnif_pi) WITH text-err INTO null.  " <<<<<< Thrown Error  Message 
  ENDIF.

Read only

0 Likes
2,327

Any new Inputs please.

Regards,

Sreeram

Read only

Former Member
0 Likes
2,327

[;

Read only

Former Member
0 Likes
2,327

in the following link see the 3.4.4 point

https://wiki.sdn.sap.com/wiki/display/PLM/UsingSub-SystemtosynchronizePS+status?focusedCommentId=145719899

Edited by: Krupajani on Dec 24, 2009 7:26 AM

Read only

Former Member
2,327

Hi Sreeram,

Although this is an old thread, I hope this help anybody that comes here looking for an answer.

The problem is with mandatory fields related to T-Code CJ20N. For me, this was a DATA issue. The problem happened when the BAPI PRECOMMIT was checking the mandatory fields values. If there is one with blank value, it triggers an error.

Regards,

Ricardo