-1

I am facing a problem to create a costcenter via BAPI. I hope someone has a solution for me.

After filling the table COSTCENTERLIST with obligatory data and commit the test of the BAPI there is no new inactive costcenter db record in my Costcenters list. I haven’t got any failmessage. Here my Test data:

enter image description here

I have tried to find the test record via BAPI_COSTCENTER_GETDETAIL1with a MASTER_DATA_INACTIVE parameter on but without success. The error is: “there is no inactive costcenter ‘TEST_Z123’ in the costarea 2000”.

I have also tried to activate my new Costcenter via BAPI_CTR_ACTIVATE_MULTIPLE and I got no failmessage and no active costcenter record.

Sandra Rossi
  • 11,934
  • 5
  • 22
  • 48
LStrike
  • 1,598
  • 4
  • 26
  • 58
  • Please provide a minimal working example. You are not telling us anything about the values of the other paramers (e. g. `TESTRUN`) or the surrounding code (are you calling `BAPI_TRANSACTION_*`) nor any of the results (what does `RETURN` contain?). – vwegert Apr 13 '15 at 08:45
  • the screens are showing all input parameters which were needed. Actually I am testing only in transaction se37. The example is running, but it seems the new costcenter is not commited. I got a hint on scn (sap community), I will try if BAPI_TRANSACTION_COMMIT is needed. – LStrike Apr 13 '15 at 08:50
  • Of course a commit is required. Use a test sequence to first invoke your BAPIs and at the end call `BAPI_TRANSACTION_COMMIT`. – Jagger Apr 13 '15 at 09:15
  • Why "of course"? Not every writing BAPI needs a "commit". For this problem "BAPI_TRANSACTION_COMMIT" was the solution. – LStrike Apr 13 '15 at 09:18
  • @LStrike which writing BAPI does not need a commit? Some examples please. – Jagger Apr 14 '15 at 20:45
  • BAPI_MATERIAL_SAVEDATA or BAPI_CUSTOMER_CREATEFROMDATA – LStrike Apr 15 '15 at 09:29

1 Answers1

0

Problem solved:

Call "BAPI_TRANSACTION_COMMT" after "BAPI_COSTCENTER_CREATEMULTIPLE"

LStrike
  • 1,598
  • 4
  • 26
  • 58