i have written report for BDC for creating of sales order by VA01 tcode by uploading a file...i have done with file pickup and populating to perform fields...i m unable to handle table control becoz i may get many materials and quantity feilds to be created for one sales order..my condition is "A separate Sales Order will be created for each combination of Sold-To & Ship-To parties. A Sold-To party may have several Ship-To parties assigned to it. Lines having same combination of SoldTo u2013 ShipTo parties should be added to one Sales Order. A separate Sales Order will be created if a line has different Ship-To party even if the Sold-To remains same "
below is code for it...
loop at i_input_bdc into wa_input_bdc.
perform bdc_dynpro using 'SAPMV45A' '0101'.
perform bdc_field using 'BDC_CURSOR'
'VBAK-SPART'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'VBAK-AUART'
p_auart.
perform bdc_field using 'VBAK-VKORG'
p_vkorg.
perform bdc_field using 'VBAK-VTWEG'
p_vtweg.
perform bdc_field using 'VBAK-SPART'
p_spart.
perform bdc_dynpro using 'SAPMV45A' '4001'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'VBKD-BSTKD'
v_po_number.
perform bdc_field using 'KUAGV-KUNNR'
wa_input_bdc-soldto.
perform bdc_field using 'KUWEV-KUNNR'
wa_input_bdc-shipto.
perform bdc_field using 'VBAK-BSARK'
p_bsark.
perform bdc_field using 'BDC_CURSOR'
'RV45A-KWMENG(02)'.
perform bdc_field using 'RV45A-MABNR(01)'
* record-MABNR_01_009.
wa_input_bdc-matnr.
perform bdc_field using 'RV45A-MABNR(02)'
* record-MABNR_02_010.
wa_input_bdc-matnr.
perform bdc_field using 'RV45A-KWMENG(01)'
* record-KWMENG_01_011.
v_kwmeng1.
perform bdc_field using 'RV45A-KWMENG(02)'
* record-KWMENG_02_012.
v_kwmeng1.
perform bdc_dynpro using 'SAPLSPO2' '0300'.
perform bdc_field using 'BDC_OKCODE'
'=OPT1'.
ON CHANGE OF wa_input_bdc-soldto.
ON CHANGE OF wa_input_bdc-shipto.
PERFORM insert_bdc USING 'VA01'.
CLEAR wa_input_bdc.
REFRESH i_bdcdata.
*---------------------------------------
ENDON.
ENDON.
ENDLOOP.