‎2010 Jun 01 6:32 AM
Hi experts
Anyone know how to pass the value of Means of Transport(VBKD-TRATY) to
BAPI BAPI_SALESORDER_CREATEFROMDAT2?
Thanks in Advance,
Shichun qing
‎2010 Jun 01 7:39 AM
hi,
hope this will help you.
data : ORDER_HEADER_IN like BAPISDHD1.
DATA : SALESDOCUMENT LIKE BAPIVBELN-VBELN.
data : RETURN like BAPIRET2 occurs 0 with header line.
data : ORDER_ITEMS_IN like BAPISDITM occurs 0 with
header line.
data : ORDER_PARTNERS like BAPIPARNR occurs 0 with
header line.
data : ORDER_SCHEDULES_IN like BAPISCHDL occurs 0 with
header line.
DATA : ORDER_KEYS LIKE BAPISDKEY OCCURS 0 WITH HEADER
LINE.
CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT2'
EXPORTING
ORDER_HEADER_IN = ORDER_HEADER_IN
IMPORTING
SALESDOCUMENT = SALESDOCUMENT
TABLES
RETURN = RETURN
ORDER_ITEMS_IN = ORDER_ITEMS_IN
ORDER_PARTNERS = ORDER_PARTNERS
ORDER_SCHEDULES_IN = ORDER_SCHEDULES_IN
ORDER_KEYS = ORDER_KEYS
.you can find all code from : http://www.sap-img.com/abap/bapi-salesorder-createfromdat2.htm
regards,
Orhan
‎2010 Jun 01 7:49 AM
Thanks,
But your sample have not field traty. I just want how to pass the field to BAPI. Anyway ,Thanks your reply.
‎2010 Jun 01 8:19 AM
hey,
if you want to use TRATY you can use function SD_SALESDOCUMENT_CREATE.
data: BUSINESS_EX_IN LIKE BAPISDBUSI.
BUSINESS_EX_IN-TRANS_CAT = 'YOUR'. " this field type is traty
APPEND BUSSINESS_EX_IN.
CALL FUNCTION 'SD_SALESDOCUMENT_CREATE'
EXPORTING
SALES_HEADER_IN = SALES_HEADER_IN
TABLES
BUSINESS_EX = BUSINESS_EX_IN
* RETURN =
.BAPISDBUSI has a field named TRANS_CAT type Traty. So i think u can use it. Or you can look other tables at FM SD_SALESDOCUMENT_CREATE to find a field typed TRATY.
Regards,
Orhan
‎2010 Jun 01 2:39 PM
Dear goktasor
We need create Sale order with BAPI_SALESORDER_CREATEFROMDAT2 .
No way update "vbkd-traty" using BAPI_SALESORDER_CREATEFROMDAT2 ?
‎2010 Jun 01 2:53 PM
hi,
u cannot use traty with this bapi. SD_SALESDOCUMENT_CREATE also create sales order so you can use it with code i wrote above.
regards,
orhan
‎2010 Jun 01 8:12 PM
Hi,
Regrettably is not possible use traty in this function, I have had the same problem and after of to search in the web I have decided after the function return the order number, Update it with a sql sentence.
The sentence is:
IF NOT salesdocument IS INITIAL.
Si no hubo error
resultado = 0.
mensaje = 'OK'.
idpedido = salesdocument.
Actualizo Clase de material de embalaje (Utilizado para tratamiento de fecha de entrega)
update vbkd
set vbkd~traty = cabecera-clase
where vbkd~VBELN = salesdocument.
ENDIF.
Perhaps it is not the better form, but this form was effective for me.
‎2010 Aug 12 5:59 AM