Application Development 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: 

unable to insert records in PRPS and PROJ tables.

Former Member
0 Kudos

I want to insert entries in PROJ and PRPS tables with new company code.

I am selecting entries with existing company code and changing old co. code to new co. code in work area.

Then I am using insert PRPS from work area in the same way inserting in PROJ.

Please help, why insert statement is not working with these tables..

1 ACCEPTED SOLUTION

raymond_giuseppi
Active Contributor
0 Kudos

I hope you are in a sandbox system.

The internal and primary key is PSPNR, and this key is associated with an internal range number. If you don't want to use program, you have to get yourself the next number for PROJ and each PRPS, then you MUST insure that related objects like OBJNR the CO object number is adjusted (PR or PD + internal number/) else you will incur severe problem with your database. You MUST insure that other unique indexes are respected PSPID, etc.

*The correct way is reached via BAPI or Batch Input/Call Transaction*

For BTC or call transaction just record via [SHDB|https://www.sdn.sap.com/irj/sdn/advancedsearch?cat=sdn_all&query=shdb&adv=false&sortby=cm_rnd_rankvalue] a single run with [CJ2D transaction|https://www.sdn.sap.com/irj/sdn/advancedsearch?cat=sdn_all&query=cj2d+transaction&adv=false&sortby=cm_rnd_rankvalue].

BAPI suitable are :

- [BAPI_PS_INITIALIZATION|https://www.sdn.sap.com/irj/sdn/advancedsearch?cat=sdn_all&query=bapi_ps_initialization&adv=false&sortby=cm_rnd_rankvalue] to start the job

- to read the model use BAPIs like [BAPI_PROJECTDEF_GETDETAIL|https://www.sdn.sap.com/irj/sdn/advancedsearch?cat=sdn_all&query=bapi_projectdef_getdetail&adv=false&sortby=cm_rnd_rankvalue]

- to create the new project use BAPIs like [BAPI_PROJECTDEF_CREATE|https://www.sdn.sap.com/irj/sdn/advancedsearch?cat=sdn_all&query=bapi_projectdef_create&adv=false&sortby=cm_rnd_rankvalue]

- [BAPI_PS_PRECOMMIT|https://www.sdn.sap.com/irj/sdn/advancedsearch?cat=sdn_all&query=bapi_ps_precommit&adv=false&sortby=cm_rnd_rankvalue] and then BAPI_TRANSACTION_COMMIT or ROLLBACK to end.

Regards

14 REPLIES 14

JozsefSzikszai
Active Contributor
0 Kudos

do you mean that you update SAP tables directly? better to create a Z... table for practicing!

anyway, company code is not part of the table key, so that is the reason it does not work (your good fortune...)

0 Kudos

Im inserting new entrins with new co. code.If entries go wrong then i can delete them, but i am not able to find that why insertion is not possible with these two tables only..

0 Kudos

looks like you have no idea about table keys, no clue about SAP... but you have developer key!

0 Kudos

if u have understood my question..then atleast please don't create any false impressions ..................

0 Kudos

I already told what is the problem in my very first reply: "company code is not part of the table key"

0 Kudos

>

> if u have understood my question..then atleast please don't create any false impressions ..................

Eric is Exactly right.

Insert only work, when key is different or not exist in table either.

in your case you are checking only PBUKR VBUKR(Co code)

values which seem not suffcient to update this table

PSPNR is the key of both table so you need to use Update statement instead of Insert.

Cheers

Former Member
0 Kudos

Hi ,

Use Commit work .

Best Regards,

Siva Reddy

Former Member
0 Kudos

use other statements like Modify , update ... if these are not working then your database profile is write protected.

0 Kudos

How can i check that database profile is write protected...

0 Kudos

T-code : OPTX

0 Kudos

Thank you siva,

It helped, database profile is write protected only.

Regards,

meena

0 Kudos

You are welcome Meena ..

raymond_giuseppi
Active Contributor
0 Kudos

I hope you are in a sandbox system.

The internal and primary key is PSPNR, and this key is associated with an internal range number. If you don't want to use program, you have to get yourself the next number for PROJ and each PRPS, then you MUST insure that related objects like OBJNR the CO object number is adjusted (PR or PD + internal number/) else you will incur severe problem with your database. You MUST insure that other unique indexes are respected PSPID, etc.

*The correct way is reached via BAPI or Batch Input/Call Transaction*

For BTC or call transaction just record via [SHDB|https://www.sdn.sap.com/irj/sdn/advancedsearch?cat=sdn_all&query=shdb&adv=false&sortby=cm_rnd_rankvalue] a single run with [CJ2D transaction|https://www.sdn.sap.com/irj/sdn/advancedsearch?cat=sdn_all&query=cj2d+transaction&adv=false&sortby=cm_rnd_rankvalue].

BAPI suitable are :

- [BAPI_PS_INITIALIZATION|https://www.sdn.sap.com/irj/sdn/advancedsearch?cat=sdn_all&query=bapi_ps_initialization&adv=false&sortby=cm_rnd_rankvalue] to start the job

- to read the model use BAPIs like [BAPI_PROJECTDEF_GETDETAIL|https://www.sdn.sap.com/irj/sdn/advancedsearch?cat=sdn_all&query=bapi_projectdef_getdetail&adv=false&sortby=cm_rnd_rankvalue]

- to create the new project use BAPIs like [BAPI_PROJECTDEF_CREATE|https://www.sdn.sap.com/irj/sdn/advancedsearch?cat=sdn_all&query=bapi_projectdef_create&adv=false&sortby=cm_rnd_rankvalue]

- [BAPI_PS_PRECOMMIT|https://www.sdn.sap.com/irj/sdn/advancedsearch?cat=sdn_all&query=bapi_ps_precommit&adv=false&sortby=cm_rnd_rankvalue] and then BAPI_TRANSACTION_COMMIT or ROLLBACK to end.

Regards

0 Kudos

Thanks a lot..your solution has solved my problem......

Regards,

Meena