DELETE Delivery with BAPI BAPI_OUTB_DELIVERY_CHANGE
Hi all
i try delete delivery with the bapi BAPI_OUTB_DELIVERY_CHANGE, but isn't don't.
i don't know why, what's wrong
loop at gt_likp assigning <gs_likp>.
gf_delivery = <gs_likp>-vbeln.
gs_header_data-deliv_numb = <gs_likp>-vbeln.
gs_header_control-deliv_numb = <gs_likp>-vbeln.
gs_header_control-dlv_del = 'X'.
call function 'BAPI_OUTB_DELIVERY_CHANGE'
exporting
header_data = gs_header_data
header_control = gs_header_control
delivery = gf_delivery
* TECHN_CONTROL =
* HEADER_DATA_SPL =
* HEADER_CONTROL_SPL =
* SENDER_SYSTEM =
tables
* HEADER_PARTNER =
* HEADER_PARTNER_ADDR =
* HEADER_DEADLINES =
* ITEM_DATA =
* ITEM_CONTROL =
* ITEM_SERIAL_NO =
* SUPPLIER_CONS_DATA =
* EXTENSION1 =
* EXTENSION2 =
return = gt_bapiret2
* TOKENREFERENCE =
* ITEM_DATA_SPL =
* COLLECTIVE_CHANGE_ITEMS =
thx
Hi,
1) Use BAPI_TRANSACTION_COMMIT after Bapi.
2) Check whether any subsequent documents has been created against the delivery (Refer to VBFA table).
Regards
Vinod
Similar Messages
-
Create Sales Order / Delivery with BAPI
Hi,
I want to create a sales order and the its delivery using BAPI. Is there such BAPI or should i use two different BAPI functions.
I also need to post goods issue after the completition of the delivery. Which BAPI is the most appropriate for my pupose?
thanks for your help,
- ferudunHi,
Check this example of creating a sales order and for creating delivery...and PGI
************SALES ORDER INPUT CREATION.
PARAMETERS: p_auart TYPE auart OBLIGATORY.
PARAMETERS: p_vkorg TYPE vkorg OBLIGATORY.
PARAMETERS: p_vtweg TYPE vtweg OBLIGATORY.
PARAMETERS: p_spart TYPE vtweg OBLIGATORY.
PARAMETERS: p_sold TYPE kunnr OBLIGATORY.
PARAMETERS: p_ship TYPE kunnr OBLIGATORY.
*ITEM
PARAMETERS: p_matnr TYPE matnr OBLIGATORY.
PARAMETERS: p_menge TYPE kwmeng OBLIGATORY.
PARAMETERS: p_plant TYPE werks_d OBLIGATORY.
PARAMETERS: p_itcat TYPE pstyv OBLIGATORY.
DATA DECLARATIONS.
DATA: v_vbeln LIKE vbak-vbeln.
DATA: header LIKE bapisdhead1.
DATA: headerx LIKE bapisdhead1x.
DATA: item LIKE bapisditem OCCURS 0 WITH HEADER LINE.
DATA: itemx LIKE bapisditemx OCCURS 0 WITH HEADER LINE.
DATA: partner LIKE bapipartnr OCCURS 0 WITH HEADER LINE.
DATA: return LIKE bapiret2 OCCURS 0 WITH HEADER LINE.
DATA: lt_schedules_inx TYPE STANDARD TABLE OF bapischdlx
WITH HEADER LINE.
DATA: lt_schedules_in TYPE STANDARD TABLE OF bapischdl
WITH HEADER LINE.
HEADER DATA
header-doc_type = p_auart.
headerx-doc_type = 'X'.
header-sales_org = p_vkorg.
headerx-sales_org = 'X'.
header-distr_chan = p_vtweg.
headerx-distr_chan = 'X'.
header-division = p_spart.
headerx-division = 'X'.
headerx-updateflag = 'I'.
PARTNER DATA
partner-partn_role = 'AG'.
partner-partn_numb = p_sold.
APPEND partner.
partner-partn_role = 'WE'.
partner-partn_numb = p_ship.
APPEND partner.
ITEM DATA
itemx-updateflag = 'I'.
item-itm_number = '000010'.
itemx-itm_number = 'X'.
item-material = p_matnr.
itemx-material = 'X'.
item-plant = p_plant.
itemx-plant = 'X'.
item-target_qty = p_menge.
itemx-target_qty = 'X'.
item-target_qu = 'EA'.
itemx-target_qu = 'X'.
item-item_categ = p_itcat.
itemx-item_categ = 'X'.
APPEND item.
APPEND itemx.
Fill schedule lines
lt_schedules_in-itm_number = '000010'.
lt_schedules_in-sched_line = '0001'.
lt_schedules_in-req_qty = p_menge.
APPEND lt_schedules_in.
Fill schedule line flags
lt_schedules_inx-itm_number = '000010'.
lt_schedules_inx-sched_line = '0001'.
lt_schedules_inx-updateflag = 'X'.
lt_schedules_inx-req_qty = 'X'.
APPEND lt_schedules_inx.
Call the BAPI
CALL FUNCTION 'BAPI_SALESDOCU_CREATEFROMDATA1'
EXPORTING
sales_header_in = header
sales_header_inx = headerx
IMPORTING
salesdocument_ex = v_vbeln
TABLES
return = return
sales_items_in = item
sales_items_inx = itemx
sales_schedules_in = lt_schedules_in
sales_schedules_inx = lt_schedules_inx
sales_partners = partner.
Check the return table.
LOOP AT return WHERE type = 'E' OR type = 'A'.
EXIT.
ENDLOOP.
IF sy-subrc = 0.
WRITE: / 'Error in creating document'.
ELSE.
COMMIT WORK AND WAIT.
WRITE: / 'Document ', v_vbeln, ' created'.
ENDIF.
************DELIVERY CREATION.
DATA: BEGIN OF t_vbap OCCURS 0,
vbeln LIKE vbap-vbeln,
posnr LIKE vbap-posnr,
zmeng 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 zmeng matnr werks
INTO TABLE t_vbap
FROM vbap
WHERE vbeln = v_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-zmeng.
t_request-quantity_base__uom = t_vbap-zmeng.
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.
************Post goods issue.
READ TABLE t_created INDEX 1.
DATA: vbkok_wa TYPE vbkok.
vbkok_wa-vbeln_vl = t_created-document_numb.
vbkok_wa-wabuc = 'X'.
DATA: v_error.
CALL FUNCTION 'WS_DELIVERY_UPDATE'
EXPORTING
vbkok_wa = vbkok_wa
delivery = t_created-document_numb
IMPORTING
ef_error_in_goods_issue_0 = v_error.
COMMIT WORK.
Thanks,
Naren -
Delete delivery document, use: BAPI_OUTB_DELIVERY_CHANGE
hi friends,
I want to delete a delivery document. I think BAPI_OUTB_DELIVERY_CHANGE will be useful for my purpose but I cannot find any field indicating the operation type like 'U'pdate, 'D'elete etc.
is it the right bapi function or should i use a different one?
thanks,
- ferudunI have tried this way but nothing has happened. The return table was containing a row with error E VL 302 and empty message texts. (Delevery document doesn't exist)
header_control-dlv_del = 'X'.
CALL FUNCTION 'BAPI_OUTB_DELIVERY_CHANGE'
EXPORTING
HEADER_DATA = header_data
HEADER_CONTROL = header_control
DELIVERY = delivery_no
TABLES
RETURN = return.
I see the delivery document from VL03 tcode.
what is wrong? what data should i supply?
thanks,
- ferudun
Message was edited by:
Ferudun ATAKAN -
My requirement is to update Pick quantity in the Delivery, which can be acheived via a BDC to VL02N transaction.
But for obvious reason I am looking for some suitable FM or BAPI.
I was looking at BAPI_OUTB_DELIVERY_CHANGE function module to change outbound deliveries. But the TABLE parameter ITEM_DATA do not have any field for supplying Pick quantity.
Any reason why pick quantity is not there. Appreciate your reply or workaround on this.Hi
You can youse this fm "SD_DELIVERY_UPDATE_PICKING"
Regards
Ravish -
Not able to delete line items using BAPI_OUTB_DELIVERY_CHANGE
Hi,
Not able to delete line items of a delivery using BAPI 'BAPI_OUTB_DELIVERY_CHANGE', with thte below code and even return parameter has zero messages.
I have even checked existing below posting.
https://www.sdn.sap.com/irj/scn/logon?redirect=http%3a%2f%2fforums.sdn.sap.com%2fthread.jspa%3fthreadid%3d782509
Below is the code that i am using.........
*wa1-deliv_numb = wa_lips-vbeln.
wa1-deliv_item = wa_lips-posnr.
APPEND wa1 to item_data.
wa-deliv_numb = vbeln_so .
wa-deliv_item = l_item.
wa-del_item = 'X'.
APPEND wa TO item_control.
w_header_data-deliv_numb = vbeln_so .
w_header_control-deliv_numb = vbeln_so .
w_delivery = vbeln_so .
*w_header_control-dlv_del = 'X'. "Delete whole Delivery
CALL FUNCTION 'BAPI_OUTB_DELIVERY_CHANGE'
EXPORTING
header_data = w_header_data
header_control = w_header_control
delivery = w_delivery
TABLES
item_data = item_data
item_control = item_control
return = return.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = 'X'.
I have even tried uncommenting item_data parameter but not able to delete line item.....i am able to delete whole delivery but not line items .........can any one of u help me in resolving this issiue plz ???
Regards,
M, ManoharKindly use WS_DELIVERY_UPDATE to delete the items
Sample code:
L_VBKOK-VBELN_VL = vbeln_so.
clear l_vbpok.
refresh l_vbpok.
l_vbpok-vbeln_vl = vbeln_so
l_vbpok-posnr_vl = wa_deliv_item.
l_vbpok-lips_del = c_x.
append l_vbpok.
set update task local.
call function 'WS_DELIVERY_UPDATE'
exporting
vbkok_wa = l_vbkok
commit = ' '
delivery = lv_delivery
tables
vbpok_tab = l_vbpok
exceptions
others = 0.
commit work and wait. -
How to create Delivery with sales order FM/BAPI
Hi Gurus,I'm new to SAP platform
I have created sales order ,
with this i need to create Delivery(vl01n)
so i need to give 'Shipping Point','Selection Date','SD Number'
so could any one tel me which FM/BAPI is suitable to create
Outbound delivery with 'sales order number', 'Selection date' and
"Plant or Shipping Point'.
With these Import parameters i need FM/BAPI .
Thanks in Advance
Siva Kumar kasa.I have created delivery with that BAPI
giving 'batch number' but it was not updated,so can u tel me
any related field which need give to change batch field also. -
Problem with deleted delivery and cancellation invoice
I have a problem. I have to resolve a cancellation invoice with error saying Missing Export Data. However, when i try to update this invoice, the fields to be updated are all shaded out meaning they cannot be changed. now the problem is, the delivery where the cancellation invoice retrieves its data shows a status of Archived. but when we tried to find it, it seems that it has already been deleted though the status shows Archived. I do not know how they have managed to delete this delivery with the Goods Issue still active, even with the Invoices. All I know is that the user who has deleted the delivery has made a mistake for this.
Can anybody please help me?Can you please check the OSS note 908748. It may be of some help to you. The contents are pasted here.
Symptom
A cancellation document cannot be transferred to accounting because the system has issued error message VF 072:
'Document 90001234 has been saved (foreign trade data incomplete)'.
However, the underlying business process concerns domestic business and the invoice to be cancelled does not contain any foreign trade data.
Other terms
VF02, VF11, VF072, cancellation, EXNUM, incompleteness, export data
Reason and Prerequisites
Prerequisites:
This is a partial cancellation document.
When you create the cancellation document, you inadvertently branch to the foreign trade data and choose 'Set'.
Reason:
When you choose 'Set' in the foreign trade data, the system assigns an export number, which then results in an incomplete document because the other export data is missing.
Solution
Implement the attached correction.
There is no provision to take account of a cancellation scenario in which foreign trade data can be entered or changed.
This correction deactivates the ready for input status of the 'Set' button in order to prevent the system from inadvertently assigning an export number.
In this context, refer also to Note 354222. -
BAPi to create Outbound delivery with PGI
Hi all,
What BAPi , we can use to create Outbound delivery with PGI.
Please help me in this regards.
Deekshitha.Hi,
Use the BAPI BAPI_GOODSMVT_CREATE
check this link.... u will get all help from this code..
http://sap4.com/wiki/index.php?title=BAPI_GOODSMVT_CREATE&printable=yes
<b>rEWARD POINTS</b>
rEGARDS -
Delete PO with clicking ELIKZ (final delivery) is logic?
Hi,
Deleting PO with clicking ELIKZ (final delivery) is logic..no, because final delivery means that the vendor has done his part, has fulfilled what he was supposed to do.
Deleting a Po means that you do not want the material anymore that you had ordered.
However, the deletion indicator has a second meaning - preparation for archiving.
The PREprocessing job in archiving of purchase orders validates if a PO fulfills the archiving criteria and if all checks are positive the deletion indicator is set. The subsequent Write job of archiving will then write these POs to an archive, and the DELete job will erase the POs phyiscally from the database. -
Undo GR with a deleted delivery note
Hello,
I don´t know if somebody has been in the same situation and could help or give us a solution:
We would like to undo the Goods receipt from a Purchase order, but SAP doesn´t allow it due to the delivery note has been canceled by mystake.
Two possibilities
- Undo the deleted Delivery Note.
- Undo the goods receipt in this situation.
Thank you!
Regards,Hello,
I don´t know if somebody has been in the same situation and could help or give us a solution:
We would like to undo the Goods receipt from a Purchase order, but SAP doesn´t allow it due to the delivery note has been canceled by mystake.
Two possibilities
- Undo the deleted Delivery Note.
- Undo the goods receipt in this situation.
Thank you!
Regards, -
HU change on delivery using BAPI
Hi,
I am trying to change Outbound Delivery with the packing details by providing HU details(external number assignement).
BAPI "BAPI_OUT_DELIVERY_CHANGE" could not do the change for the HUs. BAPI "BAPI_OUTB_DELIVERY_CONFIRM_DEC" is not right, as it delete and recreate HUs. We do not want that HUs are deleted!
Is there any BAPI to do changes on Outbound delivery (also HUs) - changes of item quantity, HUs quantity, delete HUs from delivery or add HUs to delivery?
Could you provide some help in this regard.
Thanks MatjazHi Anand,
In the BAPI 'BAPI_OUTB_DELIVERY_CHANGE', import parameter HEADER_DATA ( Associated type is BAPIOBDLVHDRCHG ), there is a field called DLV_BLOCK.
You can get the possible values for this field in table 'TVLS'.
Please find the example possible values.
01 Credit limit
02 Political reasons
03 Bottleneck material
04 Export papers missng
05 Check free of ch.dlv
06 No printing
07 Change in quantity
08 Kanban Delivery
09 JIT delivery (PDS)
Regards,
Vijay -
Add new delivery item using BAPI_OUTB_DELIVERY_CHANGE
Hi expert,
I'll want to add a new item into existing delivery using BAPI_OUTB_DELIVERY_CHANGE;
Unfortunatelly I can't do it becouse the BAPI returns a strange message error (class VL, number 216)
I use the BAPI in the following way:
it_new_item-deliv_numb
it_new_item-deliv_item
it_new_item-material
it_new_item-dlv_qty
it_new_item-fact_unit_nom
it_new_item-fact_unit_denom
item_control-deliv_numb
item_control-deliv_item
item_control-chg_delqty
What alse do I have to do?
Many thanks
RobertaHi,
I have used this way:
Loop at it_vbrp.
CLEAR: wa_hdata, wa_hcont, d_delivy, it_bapiret2.
wa_hdata-deliv_numb = it_vbrp-vgbel.
wa_hcont-deliv_numb = it_vbrp-vgbel.
wa_hcont-dlv_del = c_x.
d_delivy = it_vbrp-vgbel.
*---Deleting delivery doc (VL02)
CALL FUNCTION 'BAPI_OUTB_DELIVERY_CHANGE'
EXPORTING
header_data = wa_hdata
header_control = wa_hcont
delivery = d_delivy
TABLES
return = it_bapiret2.
*---commit
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = 'X'.
Endloop.
Thanks,
Krishna -
Delivery Update BAPI in 5.0
Hi,
We are in ECC 5.0 and have the following requirement.
a. Receive loaded weight information from weight control system for a delivery.
b. Update the delivery with that weight information.
Identify if there is batch split on that line item and the number of batches allocated to that line item.
Check inventory for all those batches.
Allocate the weight (weight and qty are equal in our case) to the batches in ascending order of inventory.
Update delivery qty for each batch equal to that weight.
Update Picked quantity equal to that weight.
Update Text information for that line item with all the info that came from weighing system.
In 4.5b we were using BDC on VL02 to perform these updates and that is OK. Also we did not use batch split in 4.5b. Now we want to use batch split and make changes to this program to handle this.
Our issues now are:
1. We prefer to use BAPIs to update delivery with all the info as explained above (with batch split).
2. There seems to be no delivery bapi which updates text information .
3. Delivery update BAPI also does not support updating the PICK qty. (BAPI_OUTB_DELIVERY_CHANGE)
4. BDC for new transaction VL02N does not support updating of text information and SAP does not advise to use BDCs for new transactions.
5. SAP seems to advise continuation of old transaction VL02 (in BDC) for this kind of update.
Please advise if there are any other BAPI to achieve this functionality or are we missing some thing?
Thanks for your Help.
STRoberto,
Thanks for looking into this.
As I understand DELVRY03 is mainly for outbound. I will check to see if we have standard functionlaity to update batch split data using this IDOC.
Just to restate my problem, we already have a custom IDOC to receive the data.
Problem now is how to update that data into SAP in 5.0 using standard BAPI (with little bit of customisation if required).
With the currect IDOC we have we have our own logic to update delivery using BDC.
Thanks again for looking into this.
ST -
Creating Outbound Delivery using BAPI
Hi All,
Can anyone advice is there any way to create Oubound Delivery using BAPI.
If you have come accross with such developments or idea, can you please share your idea?.
Thanks,
Muruganand.KHi,
Use BAPI_DELIVERYPROCESSING_EXEC - Create Delivery from Delivery Due List
BAPI_OUTB_DELIVERY_CONFIRM_DEC BAPI for Outbound Delivery Confirmation from a Decentralized System
BAPI_OUTB_DELIVERY_SPLIT_DEC BAPI for Subsequent Outbound-Delivery Split from a Decentralized System
BAPI_OUTB_DELIVERY_CHANGE
BAPI_OUTB_DELIVERY_CREATENOREF
BAPI_OUTB_DELIVERY_CREATE_SLS
BAPI_OUTB_DELIVERY_CREATE_STO
BAPI_OUTB_DELIVERY_SAVEREPLICA
Also check
BAPI for Outbound Delivery Creation with reference to Sales Order - VL01N
BAPI / FM for Create Outbound Delivery for PO
Outbound Delivery User Exits
EXIT_SAPLV50I_003 User Exit BAPI Outbound Delivery Replication
EXIT_SAPLV50I_004 User Exit BAPI Outbound Delivery Confirmation
EXIT_SAPLV50K_007 User Exit BAPI Outbound Delivery Replication (Outbound from Sender System)
Function module: OIJ_EL_DOCG_CREATE_DELIVERY - Create outbound delivery -
Problem when updating delivery quantity using 'BAPI_OUTB_DELIVERY_CHANGE'
Hi experts,
I have a requirement in which i need to update the material's delivery quantity in VL03N transaction. For this im trying the BAPI
'BAPI_OUTB_DELIVERY_CHANGE' and im passing the following values.
HEADER_DATA : Delivery no.
DELIVER : Delivery no.
ITEM_DATA : Delivery no,
item no,
DLV_QTY quantity(changed),
FACT_UNIT_NOM ( default to value '1')
FACT_UNIT_DENOM ( default to value '1')
ITEM_CONTROL : Delivey no,
item no,
CHG_DELQTY ( value "X")
Then i use 'BAPI_TRANSACTION_COMMIT' for updating the changes.
Here the problem is, the BAPI is working fine for some quantity , say if i enter the DLV_QTY as 2 in ITEM_DATA, it is gettting updated. But if i pass some other quantity , say 12, it is returning the folowing error.
T ID NUM MESSAGE
E VL 363
Pls tell why this error comes. and how to successfully update the delivery quantity for a set of material?
Regards,
Shanthinot answered
Maybe you are looking for
-
Refresh data in popup by external event
Hi folks, I have got a popup with an alv grid displaying data from a database table. I want to reload the alv grid in case new entries were created outside of this popup. I thought it would be possible to fire an ABAP OO event after writing new data
-
Templates not updating child pages
I am running DM CS3, Version 9.0, Build 3481. When I have the HTTP address listed in the box on the Site Definition page (Local Info), any changes that I make to a template are not saved in the child pages when I save the template. I have the Links s
-
I get the following message " Runtime error! Program : C\program Files\adobe\Reader 10.0\reader\AcroRD32.exe abnormal program termination I have tried the repair but to no effect I have tried to remove and relaod version 9.4 but I cannot
-
Photos - 2 differnet folders (on different drives on Mac)
Hi, I have a requirement to have 2 different folders of images on my Ipod - work and play. These two folders are on different drives and have to remain that way. How can I get my pod to sync both of them - currently it willl delete all of play when g
-
Anyone can block any Apple ID.
I can block any Apple ID, you can block any Apple ID... iDict, Apple ID bruteforcer, could crack account. But, if I reduce the number of passwords, iDict will block accounts! If a person has the access to e-mail, he/she will be able to recover his/he