‎2015 Feb 06 6:26 AM
Hi Gurus,
My requirement is to update the storage location in an existing delivery. I tried to achieve this using BAPI " BAPI_OUTB_DELIVERY_CHANGE" and BDC of "VL02" t-code. the results are quite ambigious.
In both the approaches, Sometimes it update sloc and sometimes it doesn't.
In case of error while using BAPI, the error code is VL412.
In case of BDC, no error message is coming but in few cases sloc is not getting updated..
Request your help.
Regards,
Pankaj
‎2015 Feb 06 6:35 AM
Hi,
Before using the material in delivery check whether that material is assigned with storage location in material master. This can be checked in table MARD-LGORT.
If storage location is not existing then not possible to update in delivery also. In that case you skip updating and write it to error log.
‎2015 Feb 06 8:49 AM
Hi Karun,
Thanks for the reply..
in Mard table it is there.. and apart from this i checked in SPRO tcode also... slocs are maintained correctly..
Regards,
Pankaj
‎2015 Feb 06 7:00 AM
‎2015 Feb 06 7:31 AM
Hi,
Thanks a lot for the prompt reply.
Yes i checked this note and the issue exactly matches to my requirement.
Please tell how to apply this SNOTE. I tried by using SNOTE t-code, but unsuccessful..
Regards,
Pankaj
‎2015 Feb 06 7:37 AM
Hi, In order to implement it go to SNOTE in the menu options goto->download SAP note.
Provide the sap note there and download it if it is relevant for your system.
Once the note is downloaded it shall be available under sapnotes->new. Expand the hierarchy and find your note and click on execute button.
Read the note thoroughly before execution in order to take into consideration the manual steps to be performed or if there are any pre-requisites.
Thanks and Regards,
Sriranjani Chimakurthy.
‎2015 Feb 06 8:47 AM
Hi Sriranjani,
Thanks for the reply..
I agree... I tried the steps you are mentioning but this Note is different.
Can you please look into this and tell me..
Version of SAP we are using is ECC6.0
SAP_APPL Stack level is 0020
I am unable to download this snote using SNOTE t-code..
Regards,
Pankaj
‎2015 Feb 06 11:47 AM
Hi,
I tried this but this SNOTE cannot be implemented for ECC6.0 .
It is valid for 4.6C version only..
Now what shall i do..? any suggestion..
Regards,
Pankaj
‎2015 Feb 09 5:38 AM
‎2015 Feb 09 6:44 AM
‎2015 Feb 09 7:04 AM
‎2015 Feb 09 7:12 AM
Hi,
Can you clarify the below.
Is the storage location is not updated from sales order?
Are you trying to add the storage location f in delivery to complete the PGI as this mandatory field to complete the PGI ?
If YES for the above then there are two ways to update storage location in delivery.
1. There is a configuration to update the storage location when creation delivery which may be missing in your system. For this you can contact your function team (Let me know if you need the config screen, then I will try to get it from my function team)
2. You cad add the storage location using coding in sales order user exit program MV45AFZZ.
For name is userexit_move_field_to_vbap.
You can write the coding something like the below.
form userexit_move_field_to_vbap.
data:
lv_lgort type lgort_d.
clear lv_lgort.
select single lgort into lv_lgort from mard
where matnr = vbap-matnr
and werks = vbap-werks.
if sy-subrc eq 0.
vbap-lgort = lv_lgort.
clear lv_lgort.
endif.
endform.
‎2015 Feb 09 7:19 AM
Hi Karun,
Thanks for the reply..
Below is the complete scenario:
1. First i am creating a stock transport order using BAPI ' BAPI_PO_CREATE1' .
This step is working fine.
2. After this I am creating a delivery using BAPI ' BAPI_OUTB_DELIVERY_CREATE_STO'. This is alos working fine. Delivery is getting created.
3. Thereafter In the newly created delivery, I am passing the required SLOC using BAPI 'BAPI_OUTB_DELIVERY_CHANGE'.
At this stage, issue is coming.
Regards,
Pankaj
‎2015 Feb 09 7:38 AM
Hi,
Can you paste your piece of code where you populating data to BAPI?
‎2015 Feb 09 7:41 AM
Hi,
select vbeln kunnr from likp into table it_likpn where vbeln = gv_delivery.
select vbeln
posnr
vgbel
vgpos
matnr
charg
werks
lfimg
meins
vrkme
umvkz
umvkn
into table it_lipsn from lips
where vbeln = gv_delivery.
sort it_lipsn by vbeln.
loop at it_lipsn into wa_lipsn.
lw_item_data-deliv_numb = wa_lipsn-vbeln.
lw_item_data-deliv_item = wa_lipsn-posnr.
lw_item_data-material = wa_lipsn-matnr.
lw_item_data-batch = wa_lipsn-charg.
lw_item_data-dlv_qty = wa_lipsn-lfimg.
lw_item_data-dlv_qty_imunit = wa_lipsn-lfimg.
lw_item_data-sales_unit = wa_lipsn-vrkme.
lw_item_data-sales_unit_iso = wa_lipsn-vrkme.
lw_item_data-base_uom = wa_lipsn-meins.
lw_item_data-base_uom_iso = wa_lipsn-meins.
lw_item_data-fact_unit_nom = wa_lipsn-umvkz.
lw_item_data-fact_unit_denom = wa_lipsn-umvkn.
append lw_item_data to gi_item_data.
lw_item_control-deliv_numb = wa_lipsn-vbeln.
lw_item_control-deliv_item = wa_lipsn-posnr.
lw_item_control-chg_delqty = 'X'.
append lw_item_control to gi_item_control.
iw_sloc-DELIV_NUMB = wa_lipsn-vbeln.
iw_sloc-DELIV_ITEM = wa_lipsn-posnr.
read table it_likpn into wa_likpn with key vbeln = gv_delivery.
if sy-subrc = 0.
call function 'CONVERSION_EXIT_ALPHA_OUTPUT'
exporting
input = wa_likpn-kunnr
IMPORTING
OUTPUT = clgort.
iw_sloc-stge_loc = clgort.
endif.
append iw_sloc to it_sloc.
clear : iw_sloc.
gw_bapiobdlvhdrchg-deliv_numb = wa_lipsn-vbeln.
gw_bapiobdlvhdrctrlchg-deliv_numb = wa_lipsn-vbeln.
gw_bapiobdlvhdrchg-dlv_prio = '06'.
gw_bapiobdlvhdrctrlchg-dlv_prio_flg = 'X'.
at end of vbeln.
call function 'BAPI_OUTB_DELIVERY_CHANGE'
exporting
header_data = gw_bapiobdlvhdrchg
header_control = gw_bapiobdlvhdrctrlchg
delivery = wa_lipsn-vbeln
tables
ITEM_DATA = gi_item_data
ITEM_CONTROL = gi_item_control
return = gi_return
ITEM_DATA_SPL = it_sloc .
call function 'BAPI_TRANSACTION_COMMIT'
exporting
wait = 'X'.
clear: lw_item_data, lw_item_control,gw_bapiobdlvhdrchg,gw_bapiobdlvhdrctrlchg .
refresh : gi_item_control,gi_item_data,gi_item_control.
perform log_error. .
endat.
endloop.
Regards,
Pankaj
‎2015 Feb 09 8:12 AM
Hi,
Are you missing conversion of material?
Can you try replace the line "lw_item_data-material = wa_lipsn-matnr."
from your code with below conversion exit for material?
CALL FUNCTION 'CONVERSION_EXIT_MATN1_INPUT'
EXPORTING
input = wa_lipsn-matnr
IMPORTING
OUTPUT = lw_item_data-material
EXCEPTIONS
LENGTH_ERROR = 1
.
Also check all places to find if you missing any conversions.
‎2015 Feb 09 8:35 AM
Hi Karun,
I checked this in debugging mode. On fetching data from LIPS, Matnr is coming in internal format and i am passing that matnr to BAPI. So It's not an issue. I have checked for other fields also and it is fine. Moreover one important point is sometimes it is updating SLOC and simetimes it is not..
Regards,
Pankaj
‎2015 Feb 09 9:02 AM
Introduce wait upto 2 seconds statement for each commit and try.
‎2015 Feb 09 9:47 AM
Hi Pankaj,
BAPI_TRANSACTION_COMMIT Itself has a wait command.
So try testing this BAPI explicitely from SE37 & check if the data provided is correct or not. and if the Stoarage location is getting updated or not.
Also, in this conversion exit, input field is KUNNR(Customer No. ), so in this KUNNR(10 char field) getting truncated in CLGORT(4 char Field), so may be the kunnr is getting truncated in first 4 characters in SLOC.
call function 'CONVERSION_EXIT_ALPHA_OUTPUT'
exporting
input = wa_likpn-kunnr
IMPORTING
OUTPUT = clgort.
check if this helps you.
Regards,
Ashish