Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

data not getting inserted in table vbsn

Hi Experts

Here I am giving a part of my code which i am using to upload data in database usind bdc. data is inserted successfully in all tables . What i have given here is data insertion in table VBSN ....here i am getting only one record, for next record i want a new line should be added and so on ...but whats happening is its showing only very first record i uploaded, no new record is inserting in my table..Please check my code and suggest me what wrong in my code?

<b>*********THIS IS NOT THE COMPLETE CODE************</b>

tables: vbsn , vbap.

DATA: itab_vbsn type table of vbsn with header line.

DATA: w_vbeln LIKE vbap-vbeln.

DATA : wa2 TYPE vbsn.

DATA: l_itmcd LIKE vbap-matnr,

l_pos LIKE vbap-posnr,

l_unit LIKE mara-meins.

DATA: BEGIN OF itab_nag OCCURS 0,

nagdt(8) TYPE c,

time(6) TYPE c,

itmcd(18) TYPE c,

qty(10) TYPE c,

gate(4) TYPE c,

a11(4) TYPE c, "New Field

nagno(35) TYPE c,

vbeln(10) TYPE c,"SCHEDULING AGREEMENT

END OF itab_nag.

SELECT SINGLE * INTO CORRESPONDING FIELDS OF itab_vbsn FROM vbsn WHERE vbeln EQ w_vbeln

AND posnr EQ l_pos.

IF sy-subrc NE 0.

wa2-vbeln = w_vbeln.

wa2-posnr = l_pos.

wa2-aeskd = itab_nag-nagno.

INSERT vbsn FROM wa2.

ENDIF.

Tags:
Former Member
Not what you were looking for? View more on this topic or Ask a question