2006 Nov 22 6:20 AM
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
2006 Nov 22 6:30 AM
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
2006 Nov 22 6:30 AM
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
2006 Nov 22 8:03 AM
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...
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |