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

problem in recording va02

Former Member
0 Likes
547

Hi All,

Am using recording to create sales order with reference to another SO,delete all the items,and upload the new items with several new conditions for the new sales order.

The problem is while Iam uploading the new items,the second item overwriting the first one.

Can anyone suggest me the cause,or post a sample of the

recording code.

Am posting the part of the recording code used for generating the new-items.

perform bdc_transaction using 'VA01'.

perform bdc_dynpro using 'SAPMV45A' '0102'.

perform bdc_field using 'BDC_CURSOR'

'VBAK-VBELN'.

perform bdc_field using 'BDC_OKCODE'

'=ENT2'.

loop at itab.

perform bdc_dynpro using 'SAPMV45A' '4001'.

perform bdc_field using 'BDC_OKCODE'

'=POAN'.

perform bdc_field using 'BDC_CURSOR'

' RV45A-KWMENG(01)'.

perform bdc_field using 'VBAP-MATNR(01)'

itab-matnr.

perform bdc_field using 'RV45A-KWMENG(01)'

itab-kwmeng.

perform bdc_dynpro using 'SAPMV45A' '4001'.

perform bdc_field using 'BDC_OKCODE'

'=POAN'.

perform bdc_field using 'BDC_CURSOR'

'VBAP-MATNR(02)'.

perform bdc_dynpro using 'SAPMV45A' '4001'.

perform bdc_field using 'BDC_OKCODE'

'=POPO'.

perform bdc_field using 'BDC_CURSOR'

'VBAP-MATNR(04)'.

Endloop.

Thanks

Mahendhar

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
484

Hi Mahendhar

For each loop pass you have to increment the record position, have highlighted the same.

perform bdc_field using 'BDC_CURSOR'

' RV45A-KWMENG<b>(01)</b>'.

perform bdc_field using 'VBAP-MATNR<b>(01)</b>'

itab-matnr.

perform bdc_field using 'RV45A-KWMENG<b>(01)'</b>

itab-kwmeng.

I would advice you to consider doing the same via BAPI: BAPI_SALESORDER_CREATEFROMDAT2

Kind Regards

Eswar

Hi All,

Am using recording to create sales order with reference to another SO,delete all the items,and upload the new items with several new conditions for the new sales order.

The problem is while Iam uploading the new items,the second item overwriting the first one.

Can anyone suggest me the cause,or post a sample of the

recording code.

Am posting the part of the recording code used for generating the new-items.

perform bdc_transaction using 'VA01'.

perform bdc_dynpro using 'SAPMV45A' '0102'.

perform bdc_field using 'BDC_CURSOR'

'VBAK-VBELN'.

perform bdc_field using 'BDC_OKCODE'

'=ENT2'.

loop at itab.

perform bdc_dynpro using 'SAPMV45A' '4001'.

perform bdc_field using 'BDC_OKCODE'

'=POAN'.

perform bdc_field using 'BDC_CURSOR'

' RV45A-KWMENG(01)'.

perform bdc_field using 'VBAP-MATNR(01)'

itab-matnr.

perform bdc_field using 'RV45A-KWMENG(01)'

itab-kwmeng.

perform bdc_dynpro using 'SAPMV45A' '4001'.

perform bdc_field using 'BDC_OKCODE'

'=POAN'.

perform bdc_field using 'BDC_CURSOR'

'VBAP-MATNR(02)'.

perform bdc_dynpro using 'SAPMV45A' '4001'.

perform bdc_field using 'BDC_OKCODE'

'=POPO'.

perform bdc_field using 'BDC_CURSOR'

'VBAP-MATNR(04)'.

Endloop.

Thanks

Mahendhar

2 REPLIES 2
Read only

Former Member
0 Likes
485

Hi Mahendhar

For each loop pass you have to increment the record position, have highlighted the same.

perform bdc_field using 'BDC_CURSOR'

' RV45A-KWMENG<b>(01)</b>'.

perform bdc_field using 'VBAP-MATNR<b>(01)</b>'

itab-matnr.

perform bdc_field using 'RV45A-KWMENG<b>(01)'</b>

itab-kwmeng.

I would advice you to consider doing the same via BAPI: BAPI_SALESORDER_CREATEFROMDAT2

Kind Regards

Eswar

Read only

former_member69765
Contributor
0 Likes
484

Very Simple... It is the case of table controls...

see the statement u have written - perform bdc_field using 'VBAP-MATNR(01)'

here the (01) says that u are entering in the 1st row. This no has to change every time u are entering a new row.

Either use some BAPI to create sales order or if you want to do BDC then u will have to take care of table controls.

To know more about table controls in BDC refer to this thread...

I have explained the funda and also have given an example in this.

This will help yu.

Plz reward points for correct and helpful answers...