2008 Jun 03 12:16 PM
i have done a bdc f.m for va01 with the items in import table but in all screen mode when the values for order quantity is entered it shows an information error to enter order quantity but as far as i know the coding is right...
my code is..
FUNCTION zfm_sales_ord_create2.
*"----
""Local Interface:
*" IMPORTING
*" VALUE(I_HEADER_DETAILS) LIKE ZVA01HEAD STRUCTURE ZVA01HEAD
*" EXPORTING
*" VALUE(SUBRC) LIKE SYST-SUBRC
*" TABLES
*" MESSTAB STRUCTURE BDCMSGCOLL OPTIONAL
*" IT_ITEM_DETAILS STRUCTURE ZVA01ITEM
*"----
DATA : ctu LIKE apqi-putactive VALUE 'X',
mode LIKE apqi-putactive VALUE 'A',
update LIKE apqi-putactive VALUE 'L',
group LIKE apqi-groupid ,
user LIKE apqi-userid ,
keep LIKE apqi-qerase ,
holddate LIKE apqi-startdate ,
nodata LIKE apqi-putactive VALUE '',
wa_item_details LIKE LINE OF it_item_details..
subrc = 0.
DATA : val TYPE i,
val = 1.
PERFORM bdc_nodata USING nodata.
PERFORM open_group USING group user keep holddate ctu.
PERFORM bdc_dynpro USING 'SAPMV45A' '0101'.
PERFORM bdc_field USING 'BDC_CURSOR'
'VBAK-AUART'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'VBAK-AUART'
i_header_details-order_type.
PERFORM bdc_field USING 'VBAK-VKORG'
i_header_details-sales_org.
PERFORM bdc_field USING 'VBAK-VTWEG'
i_header_details-distri_chann.
PERFORM bdc_field USING 'VBAK-SPART'
i_header_details-division.
LOOP AT it_item_details INTO wa_item_details .
IF val = 1.
PERFORM bdc_dynpro USING 'SAPMV45A' '4001'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=POAN'.
PERFORM bdc_field USING 'KUAGV-KUNNR'
i_header_details-sold_to_party.
PERFORM bdc_field USING 'KUWEV-KUNNR'
i_header_details-ship_to_party.
PERFORM bdc_field USING 'RV45A-KETDAT'
i_header_details-req_deliv_date.
PERFORM bdc_field USING 'RV45A-KPRGBZ'
i_header_details-delivery_date_type.
*perform bdc_field using 'VBKD-PRSDT'
PRSDT_009.
*perform bdc_field using 'BDC_CURSOR'
'RV45A-KWMENG(01)'.
PERFORM bdc_field USING 'RV45A-MABNR(01)'
wa_item_details-material_no.
perform bdc_field using 'RV45A-KWMENG(01)'
wa_item_details-order_quantity.
'22' .
ELSE.
*
*
PERFORM bdc_dynpro USING 'SAPMV45A' '4001'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=POAN'.
*perform bdc_field using 'KUAGV-KUNNR'
KUNNR_012.
*perform bdc_field using 'KUWEV-KUNNR'
KUNNR_013.
*perform bdc_field using 'RV45A-KETDAT'
KETDAT_014.
*perform bdc_field using 'RV45A-KPRGBZ'
KPRGBZ_015.
*perform bdc_field using 'VBKD-PRSDT'
PRSDT_016.
*perform bdc_field using 'VBKD-ZTERM'
ZTERM_017.
PERFORM bdc_field USING 'BDC_CURSOR'
'RV45A-KWMENG(02)'.
PERFORM bdc_field USING 'RV45A-MABNR(02)'
wa_item_details-material_no.
**perform bdc_field using 'BDC_CURSOR'
'RV45A-KWMENG(02)'.
perform bdc_field using 'RV45A-KWMENG(02)'
wa_item_details-order_quantity.
'22'.
ENDIF.
val = val + 1.
ENDLOOP.
PERFORM bdc_dynpro USING 'SAPMV45A' '4001'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=SICH'.
*perform bdc_field using 'KUAGV-KUNNR'
KUNNR_020.
*perform bdc_field using 'KUWEV-KUNNR'
KUNNR_021.
*perform bdc_field using 'RV45A-KETDAT'
KETDAT_022.
*perform bdc_field using 'RV45A-KPRGBZ'
KPRGBZ_023.
*perform bdc_field using 'VBKD-PRSDT'
PRSDT_024.
*perform bdc_field using 'VBKD-ZTERM'
ZTERM_025.
*perform bdc_field using 'BDC_CURSOR'
'RV45A-KWMENG(02)'.
*perform bdc_field using 'RV45A-MABNR(02)'
MABNR_02_026.
*perform bdc_field using 'RV45A-KWMENG(02)'
KWMENG_02_027.
PERFORM bdc_transaction TABLES messtab
USING 'VA01'
ctu
mode
update.
IF sy-subrc <> 0.
subrc = sy-subrc.
EXIT.
ENDIF.
PERFORM close_group USING ctu.
ENDFUNCTION.
if i hard code that value '22' for RV45A-KWMENG its working fine, with out any error but when
get it from the WA it shows an error....
2008 Jun 03 12:27 PM
Hi,
Do one thing before pass quantity value to the screen field, just pass it to one newly defined variable of type char(20), then move this char type value. Your problem may solve if you will do in the above way.
Rgds,
Bujji
2008 Jun 03 12:27 PM
Hi,
Do one thing before pass quantity value to the screen field, just pass it to one newly defined variable of type char(20), then move this char type value. Your problem may solve if you will do in the above way.
Rgds,
Bujji
2008 Jun 03 12:31 PM
Hi ,
try once like this,
change the order quantity data type to Character and try once.
may be u get out the above one.
Regards,
Vishvesh
2008 Jun 03 12:31 PM
Hi,
Check field length of 'RV45A-KWMENG and wa_item_details-order_quantity. Try changing wa_item_details-order_quantity to type CHAR. Alternatively use BAPI_SALESORDER_CREATE*
Cheers.
...Reward if useful.
2008 Jun 03 12:34 PM
Just an extension what Bujji has told,
data char(20)
write: quantity_field to char left-justified.