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

Insert internal table into datbase table

0 Likes
1,809

Hi, i've got some problem,,, and would be grate if someone help me pls.

------------------------------------------------------------

DATA : GT_BKPF TYPE TABLE OF BKPF,

GS_BKPF TYPE BKPF.

GS_BKPF-BUKRS = 'MG00'.
GS_BKPF-BELNR = '1000000000'.
GS_BKPF-GJAHR = '2019'.
APPEND GS_BKPF TO GT_BKPF.

GS_BKPF-BUKRS = 'MG00'.
GS_BKPF-BELNR = '1000000001'.
GS_BKPF-GJAHR = '2020'.
APPEND GS_BKPF TO GT_BKPF.

GS_BKPF-BUKRS = 'MG00'.
GS_BKPF-BELNR = '1000000002'.
GS_BKPF-GJAHR = '2021'.
APPEND GS_BKPF TO GT_BKPF.

GS_BKPF-BUKRS = 'MG00'.
GS_BKPF-BELNR = '1000000003'.
GS_BKPF-GJAHR = '2021'.
APPEND GS_BKPF TO GT_BKPF.

INSERT BKPF FROM TABLE GT_BKPF.

-------------------------------------------------------

no problem to activate... but

this kind of problem happens. how can I Insert internal table into datbase table using Insert or Modify ?

Thank you very much to read this ��

7 REPLIES 7
Read only

former_member34
Product and Topic Expert
Product and Topic Expert
0 Likes
1,733

Thank you for visiting SAP Community to get answers to your questions. Since this is your first question, I recommend that you familiarize yourself with our Q&A Tutorial: https://developers.sap.com/tutorials/community-qa.html, as it provides tips for preparing questions that draw responses from our members. Should you wish, you can revise your question by selecting Actions, then Edit.

By adding a picture to your profile you encourage readers to respond: https://www.youtube.com/watch?v=46bt1juWUUM

Many thanks!

Read only

former_member736527
Active Participant
0 Likes
1,733

Looks like your BKPF table already has records that have the same key (BUKRS, BELNR, GJAHR) as the ones you're trying to insert.

Read only

0 Likes
1,733

thank you! but it works when i use MODIFY T.T

Read only

0 Likes
1,733

That's because modify modifies existing entries. It does not create new entries. Insert on the other hand creates new entries with those primary keys, hence the dump.

Read only

MateuszAdamus
Active Contributor
1,733

Hello chw0222

You should never update standard SAP tables directly. There is always a function for this purpose. In your case it's BAPI called BAPI_ACC_DOCUMENT_POST.

Kind regards,
Mateusz
Read only

0 Likes
1,733

thank you, i got it. I deleted it again! thanks

Read only

touzik_itc
Active Participant
0 Likes
1,733

Violation of primary key or some unique index.