04-03-2007 5:51 PM
Hi folks,
Iam trying to create Outbound delivery using Function module "RV_DELIVERY_CREATE' and passed all the mandatory parameters as input to this function module, but unfortunately it never created outbound delivery.
Every helpful answer will be rewarded. please try to reply with a sample code . plz gurus help me out in this as it is very urgent.
Below is the Snap of my code:
type-pools: VLIKP,VLGGT.
TABLES TVSA.
data: lt_split TYPE VLIKP_T_SPLITPROT.
data: ls_split type VLIKP_S_SPLITPROT.
DATA LF_NUMKI LIKE INRI-NRRANGENR.
data: y type char18.
SELECT SINGLE * FROM TVSA WHERE SMART = 'L'.
LF_NUMKI = TVSA-NUMKI.
CALL FUNCTION 'NUMBER_GET_NEXT'
EXPORTING
NR_RANGE_NR = 'U8'
OBJECT = 'RV_BELEG'
IMPORTING
NUMBER = Y.
tables: VBAK,VBAP,VBEP,VBUP,VBKD .
data: ls_vbsk type VBSK,
ls_vbap type VBAPVB,
lt_vbak type standard table of VBAK,
lt_vbap type standard table of VBAPVB,
lt_vbep type standard table of VBEPVB,
lt_vbfa type standard table of VBFAVB,
lt_vbfs type standard table of vbfs,
lt_vbkd type standard table of VBKDVB,
lt_vbls type standard table of VBLS,
lt_vbpa type standard table of VBPAVB,
lt_vbuk type standard table of vbuk,
lt_vbup type standard table of VBUPVB,
lt_dat type standard table of VLGGT_VORGABE_DATEN_S,
ls_dat type VLGGT_VORGABE_DATEN_S.
select * from VBAK into corresponding fields of table lt_vbak where vbeln = '3100000061'.
select * from VBAP into corresponding fields of table lt_vbap where vbeln = '3100000061'.
select * from VBEP into corresponding fields of table lt_vbep where vbeln = '3100000061'.
select * from VBFA into corresponding fields of table lt_vbfa where VBELV = '3100000061'.
select * from VBFs into corresponding fields of table lt_vbfs where vbeln = '3100000061'.
select * from VBKD into corresponding fields of table lt_vbkd where vbeln = '3100000061'.
select * from VBpa into corresponding fields of table lt_vbpa where vbeln = '3100000061'.
select * from VBUK into corresponding fields of table lt_vbuk where vbeln = '3100000061'.
select * from VBUp into corresponding fields of table lt_vbup where vbeln = '3100000061'.
data: ls_vbap type VBAPVB,
ls_vbls type VBLS.
loop at lt_vbap into ls_vbap.
ls_dat-RFBEL = ls_vbap-vbeln.
ls_dat-RFPOS = ls_vbap-posnr.
move-corresponding ls_vbap to ls_dat .
append ls_dat to lt_dat.
endloop.
ls_vbsk-MANDT = SY-MANDT.
ls_vbsk-PROGRAMM = SY-REPID.
ls_vbsk-SELSET = SY-SLSET.
ls_vbsk-BATCH = SY-BATCH.
ls_vbsk-ERNAM = SY-UNAME.
ls_vbsk-ERDAT = SY-DATLO.
ls_vbsk-UZEIT = SY-TIMLO.
ls_vbsk-SAMMG = Y.
ls_vbsk-VSTEL = 'D320'.
**L_VBSK-VTEXT = TVSTT-VTEXT. "Text zur Versandstelle
select single vtext from tvstt into ls_vtext where spras = 'E' and VSTEL = 'D320'.
Ls_VBSK-VTEXT = ls_vtext .
ls_vbsk-SMART = 'L'.
CALL FUNCTION 'RV_DELIVERY_CREATE'
EXPORTING
SELEKTIONSDATUM = sy-datum
vbsk_i = ls_vbsk
I_LIEFERART = ' '
IT_VORGABE_DATEN = lt_dat
IF_NUR_VORGABE_POS = ' '
IF_VBLS_POS_RUECK =
IF_SYNCHRON = 'X'
IF_NO_COMMIT = 'X'
IF_NO_DEQUE = ' '
IT_HU_SERNR =
IT_HANDLING_UNITS =
IS_DELIVERY_EXTEND =
IS_CONTROL =
IF_CHECK_SPEVI =
IMPORTING
VBSK_E =
ET_SPLITPROT = lt_split
tables
lvbak = lt_vbak
lvbap = lt_vbap
lvbep = lt_vbep
lvbfa = lt_vbfa
lvbfs = lt_vbfs
lvbkd = lt_vbkd
lvbls = lt_vbls
lvbpa = lt_vbpa
lvbuk = lt_vbuk
lvbup = lt_vbup
04-03-2007 5:55 PM
Hi,
You can use the BAPI BAPI_DELIVERYPROCESSING_EXEC..
Check this sample code for creating a delivery from a sales order..
PARAMETERS: p_vbeln LIKE vbak-vbeln.
DATA: BEGIN OF t_vbap OCCURS 0,
vbeln LIKE vbap-vbeln,
posnr LIKE vbap-posnr,
kwmeng LIKE vbap-kwmeng,
matnr LIKE vbap-matnr,
werks LIKE vbap-werks,
END OF t_vbap.
DATA: t_request TYPE STANDARD TABLE OF bapideliciousrequest
WITH HEADER LINE.
DATA: t_created TYPE STANDARD TABLE OF bapideliciouscreateditems
WITH HEADER LINE.
DATA: t_return TYPE STANDARD TABLE OF bapiret2 WITH HEADER LINE.
SELECT vbeln posnr kwmeng matnr werks
INTO TABLE t_vbap
FROM vbap
WHERE vbeln = p_vbeln.
LOOP AT t_vbap.
t_request-document_numb = t_vbap-vbeln.
t_request-document_item = t_vbap-posnr.
t_request-quantity_sales_uom = t_vbap-kwmeng.
t_request-id = 1.
t_request-document_type = 'A'.
t_request-delivery_date = sy-datum.
t_request-material = t_vbap-matnr.
t_request-plant = t_vbap-werks.
t_request-date = sy-datum.
t_request-goods_issue_date = sy-datum.
t_request-goods_issue_time = sy-uzeit.
APPEND t_request.
ENDLOOP.
CALL FUNCTION 'BAPI_DELIVERYPROCESSING_EXEC'
TABLES
request = t_request
createditems = t_created
return = t_return
.
READ TABLE t_return WITH KEY type = 'E'.
IF sy-subrc = 0.
MESSAGE e208(00) WITH 'Delivery creation error'.
ENDIF.
COMMIT WORK.
READ TABLE t_created INDEX 1.
WRITE: / 'Delivery ', t_created-document_numb, ' created'.
Thanks,
Naren
04-03-2007 5:55 PM
Hi,
You can use the BAPI BAPI_DELIVERYPROCESSING_EXEC..
Check this sample code for creating a delivery from a sales order..
PARAMETERS: p_vbeln LIKE vbak-vbeln.
DATA: BEGIN OF t_vbap OCCURS 0,
vbeln LIKE vbap-vbeln,
posnr LIKE vbap-posnr,
kwmeng LIKE vbap-kwmeng,
matnr LIKE vbap-matnr,
werks LIKE vbap-werks,
END OF t_vbap.
DATA: t_request TYPE STANDARD TABLE OF bapideliciousrequest
WITH HEADER LINE.
DATA: t_created TYPE STANDARD TABLE OF bapideliciouscreateditems
WITH HEADER LINE.
DATA: t_return TYPE STANDARD TABLE OF bapiret2 WITH HEADER LINE.
SELECT vbeln posnr kwmeng matnr werks
INTO TABLE t_vbap
FROM vbap
WHERE vbeln = p_vbeln.
LOOP AT t_vbap.
t_request-document_numb = t_vbap-vbeln.
t_request-document_item = t_vbap-posnr.
t_request-quantity_sales_uom = t_vbap-kwmeng.
t_request-id = 1.
t_request-document_type = 'A'.
t_request-delivery_date = sy-datum.
t_request-material = t_vbap-matnr.
t_request-plant = t_vbap-werks.
t_request-date = sy-datum.
t_request-goods_issue_date = sy-datum.
t_request-goods_issue_time = sy-uzeit.
APPEND t_request.
ENDLOOP.
CALL FUNCTION 'BAPI_DELIVERYPROCESSING_EXEC'
TABLES
request = t_request
createditems = t_created
return = t_return
.
READ TABLE t_return WITH KEY type = 'E'.
IF sy-subrc = 0.
MESSAGE e208(00) WITH 'Delivery creation error'.
ENDIF.
COMMIT WORK.
READ TABLE t_created INDEX 1.
WRITE: / 'Delivery ', t_created-document_numb, ' created'.
Thanks,
Naren
04-13-2007 3:46 PM
Hi ,
I am using FM SHP_IBDLV_CREATE_FROM_OBDLV to create inbound delivery from outbound delivery.But its failing with error message
VL561.
Can any body help me ?Is there any better way of doing this?
Scenario is :
In order to transfer material from one plant to other
1)stock transfer PO is created
2)by refecrencing above po outbound delivery is created
we need to create inbound delivery corresponding to this outbound delievry with handling units information
please contact me srinu.pocha@gmail.com