2009 Oct 30 8:57 PM
Hello,
This is a requirement of mine to update packing data of AFS materials for multiple sales org at a time. I'm using AFS BAPI /AFS/BAPI_MATERIAL_SAVEDATA to update the packing data in /AFS/MVKE table for one material-size across mtuple sales orgs. This BAPI inturn calls BAPI_MATERIAL_SAVEDATA from with in.
But the BAPI is considering only one sales org and distribution channel to update. But I need it to update to multiple sales orgs and distibution channel.
Here is the BAPI call in my program,
Call /AFS/BAPI_MATERIAL_SAVEDATA to update /AFS/MARM & /AFS/MVKE records
CALL FUNCTION '/AFS/BAPI_MATERIAL_SAVEDATA'
EXPORTING
headdata = s_bapihead
IMPORTING
return = s_bapiret
TABLES
skuunitsofmeasure = t_bapi_marm "/AFS/MARM records
sku_salesdata = t_bapi_mvke. "/AFS/MVKE records for mutiple sales orgs
I'm setting BASIC_VIEW and AFS_SALES_VIEW flag in the BAPI header.
Thanks,
Partha.
Edited by: Parthasarathy G on Oct 30, 2009 11:41 PM
2009 Oct 30 11:35 PM
Hi Parthasarathy G,
please post the complete function call and a few lines where you fill the table for different sales organizations.
After pasting the code, please select it with the mouse and press the above <_> code button.
Thank you.
Regards,
Clemens
2009 Oct 31 2:08 AM
Hi Clemens,
Here is a more detailed picture of the code
I'm populating two tables - /AFS/MARM and /AFS/MVKE using the BAPI
1.
LOOP AT im_t_wt_vol_pk ASSIGNING <s_wt_vol_pk>.
* Populate /AFS/MARM exporting table
s_afs_marm-matnr = <s_wt_vol_pk>-matnr.
s_afs_marm-j_3asize = <s_wt_vol_pk>-j_3asize.
s_afs_marm-meinh = <s_wt_vol_pk>-meinh.
s_afs_marm-brgew = <s_wt_vol_pk>-brgew.
s_afs_marm-ntgew = <s_wt_vol_pk>-ntgew.
s_afs_marm-volum = <s_wt_vol_pk>-volum.
append s_afs_marm to t_afs_marm
.......
* Store /AFS/MVKE data in temp table for copying across sales org
s_afs_mvke-matnr = <s_wt_vol_pk>-matnr.
s_afs_mvke-j_3asize = <s_wt_vol_pk>-j_3asize.
s_afs_mvke-j_3apqty = <s_wt_vol_pk>-j_3apqty.
s_afs_mvke-j_3apqun = <s_wt_vol_pk>-j_3apqun.
s_afs_mvke-j_3acase = <s_wt_vol_pk>-j_3acase.
append s_afs_mvke to t_afs_mvke2. Now I copy the /AFS/MVKE which is at Material-size level to all sales org the material is extended to
3. Then I map these tables to BAPI interface parameters
IF NOT im_t_afsmarm IS INITIAL.
LOOP AT im_t_afsmarm ASSIGNING <s_afs_marm>.
s_bapi_marm-alt_unit = <s_afs_marm>-meinh.
s_bapi_marm-grid_value = <s_afs_marm>-j_3asize.
s_bapi_marm-volume = <s_afs_marm>-volum.
s_bapi_marm-gross_wt = <s_afs_marm>-brgew.
s_bapi_marm-net_weight = <s_afs_marm>-ntgew.
s_bapi_marm-zz_hoehe = <s_afs_marm>-zz_hoehe.
s_bapi_marm-zz_laeng = <s_afs_marm>-zz_laeng.
s_bapi_marm-zz_breit = <s_afs_marm>-zz_breit.
s_bapi_marm-zz_ufold_hoehe = <s_afs_marm>-zz_ufold_hoehe.
s_bapi_marm-zz_ufold_hoehe = <s_afs_marm>-zz_ufold_hoehe.
s_bapi_marm-zz_ufold_hoehe = <s_afs_marm>-zz_ufold_hoehe.
s_bapi_marm-zz_fcty_shp_cart = <s_afs_marm>-zz_fcty_shp_cart.
APPEND s_bapi_marm TO ex_t_bapimarm.
CLEAR : s_bapi_marm.
ENDLOOP.
UNASSIGN : <s_afs_marm>.
ENDIF.
* Populate BAPI interface for /AFS/MVKE records
IF NOT im_t_afsmvke IS INITIAL.
LOOP AT im_t_afsmvke ASSIGNING <s_afs_mvke>.
s_bapi_mvke-sales_org = <s_afs_mvke>-vkorg.
s_bapi_mvke-distr_chan = <s_afs_mvke>-vtweg.
s_bapi_mvke-grid_value = <s_afs_mvke>-j_3asize.
s_bapi_mvke-pack_quantity = <s_afs_mvke>-J_3APQTY.
s_bapi_mvke-pack_quan_uom = <s_afs_mvke>-J_3APQUN.
s_bapi_mvke-CASE_TYPE = <s_afs_mvke>-j_3acase.
APPEND s_bapi_mvke TO ex_t_bapimvke.
CLEAR : s_bapi_mvke.
ENDLOOP.
UNASSIGN : <s_afs_mvke>.
ENDIF.
* Populate BAPI header
ex_s_bapihead-material = im_v_matnr.
ex_s_bapihead-basic_view = c_on.
ex_s_bapihead-afs_sales_view = c_on.4. Then I call the BAPI passing header, SKUUNITSOFMEASURE(/AFS/MARM) and SALES_SKU (/AFS/MVKE)
Call /AFS/BAPI_MATERIAL_SAVEDATA to update /AFS/MARM & /AFS/MVKE records
CALL FUNCTION '/AFS/BAPI_MATERIAL_SAVEDATA'
EXPORTING
headdata = s_bapihead
IMPORTING
return = s_bapiret
TABLES
skuunitsofmeasure = t_bapi_marm
sku_salesdata = t_bapi_mvke.Please let me know if you need any more info.
Thanks,
Partha.
2009 Oct 31 10:21 AM
2009 Oct 31 10:24 AM
Check SAP Notes
1. 0.510 IS-AFS-BD 662620 UPC AT SKU LEVEL ERROR IN /AFS/BAPI_MATERIAL_SAVEDATA 19.09.2003
2. 0.420 IS-AFS-BD 872141 Duplicate EANs/UPCs generated when EAN recycling is used 01.09.2005
3. 0.320 IS-AFS-BD 999259 Error 8J 669 during AFS material master direct input process 08.06.2007
4. 0.300 IS-AFS-BD 666569 EAN/UPC's created for invalid grid/category values by BAPI 30.09.2003
5. 0.300 IS-AFS-BD 994938 Used ind. for Grids not set when material is created via DI 20.03.2007
6. 0.300 IS-AFS-BD 871406 AFS material master changes not recorded for deletion via DI 26.08.2005
7. 0.290 IS-AFS-BD 943013 Assigning recycled EAN takes a long time for an AFS material 16.05.2006
8. 0.290 IS-AFS-BD 877735 Unable to change default grid/category via direct input 28.03.2008
9. 0.270 IS-AFS 1075141 BAPIs valid for usage with AFS6.0 17.07.2007
Regards,
Clemens
2009 Nov 02 11:58 PM
Hi Clemens
Sorry, could nt get the code more readable. The issue seems to be with the basic structure of AFS BAPI which updates one sales org or one plant at a time(mimicking the material master screen entry). All the OSS notes have been applied to the system.
Thanks for your help.
Regards,
Partha.
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |