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: 

appending the values of fields from ztable to vbap

Former Member
0 Kudos

i have 3 fields in my ztable zvxxallocobj. i have to append the values of these 3 fields into Vbap table.using the user exit

USEREXIT_SOURCE_DETERMINATION .

how can i write logic for this inside the user exit.

plz provide me some inputs.

VKORG,VTWEG,SPART,MATNR,KDGRP,KUNNR are the primary keys in my Ztable.

any rought inputs will be enough

Regards.

5 REPLIES 5

former_member217544
Active Contributor
0 Kudos

Hi,

Use select query to get the values from the ztable into an internal table .

Now loop at this internal table and use Insert statement to insert the same values into the database table.

Hope this will help.

Regards,

Swarna Munukoti

Former Member
0 Kudos

Hi,

I hope the following link will help you,

https://forums.sdn.sap.com/click.jspa?searchID=14807299&messageID=4010983

Regards,

Harish

Former Member

Former Member
0 Kudos

hi,

u need to read the ztable with the sales orderno of ur current sale order and other details and then modify the ztable with the sales order details,

modify dbtab from inttab.

Regards,

Sumanjeet.

Former Member
0 Kudos

Hello Pavan,

In the user-exit, retrive the required date using SELECT stmt into and itab and use the stmt,

INSERT <target> FROM TABLE <itab> [ACCEPTING DUPLICATE KEYS].

to insert them into the vbap table.

e.g.:

SELECT <fields>

FROM zvxxallocobj

INTO <itab>

WHERE <condition>.

if sy-subrc eq 0.

INSERT vbap

FROM <itab>

ACCEPTING DUPLICATE KEYS.

endif.

p.s.: If the system is able to insert all of the lines from the internal table, SY-SUBRC is set to 0. If one or more lines cannot be inserted because the database already contains a line with the same primary key, a runtime error occurs. You can prevent the runtime error occurring by using the addition ACCEPTING DUPLICATE KEYS. In this case, the lines that would otherwise cause runtime errors are discarded, and SY-SUBRC is set to 4.

Regards

Indu.