Skip to Content
0
Former Member
Mar 11, 2009 at 02:17 PM

Bapi BAPI_MATERIAL_SAVEDATA

186 Views

Hi

I want to use the bapi BAPI_MATERIAL_SAVEDATA to create the material's

Sales: Sales Org. Data 1

Sales: Sales Org. Data 2

but what i am not able to do is that, i want to create this data for the werks i want, not the default werks.

Here is my code:

ls_headdata-material    = itab-matnr.
    ls_headdata-SALES_VIEW = 'X'.


    ls_salesdata-SALES_ORG = itab-VKORG.
    ls_salesdata-DISTR_CHAN = itab-vtweg.
    ls_salesdata-MATL_STATS = itab-versg."  STGMA CHAR  1 0 Malzeme istatistik grubu
    ls_salesdata-REBATE_GRP = itab-bonus."BONUS CHAR  2 0 Prim grubu
    ls_salesdata-MIN_DELY = itab-lfmng.
    ls_salesdata-SALES_UNIT = itab-vrkme.
    ls_salesdata-DELYG_PLNT = itab-dwerk.
    ls_salesdata-PROD_HIER = itab-prodh.
    ls_salesdata-MAT_PR_GRP = itab-kondm.
    ls_salesdata-ACCT_ASSGT = itab-ktgrm.
    ls_salesdata-MATL_GRP_1 = itab-mvgr1.


    ls_salesdatax-SALES_ORG = itab-vkorg.
    ls_salesdatax-DISTR_CHAN = itab-vtweg.
    ls_salesdatax-MATL_STATS = 'X'.
    ls_salesdatax-REBATE_GRP = 'X'.
    ls_salesdatax-MIN_DELY = 'X'.
    ls_salesdatax-SALES_UNIT = 'X'.
    ls_salesdatax-DELYG_PLNT = 'X'.
    ls_salesdatax-PROD_HIER = 'X'.
    ls_salesdatax-MAT_PR_GRP = 'X'.
    ls_salesdatax-ACCT_ASSGT = 'X'.
    ls_salesdatax-MATL_GRP_1 = 'X'.

  CALL FUNCTION 'BAPI_MATERIAL_SAVEDATA'
    EXPORTING
      headdata             = ls_headdata
      clientdata           = ls_clientdata
      clientdatax          = ls_clientdatax
      plantdata            = ls_plantdata
      plantdatax           = ls_plantdatax
      forecastparameters   = ls_forecastparameters
      forecastparametersx  = ls_forecastparametersx
      planningdata         = ls_planningdata
      planningdatax        = ls_planningdatax
      storagelocationdata  = ls_storagelocationdata
      storagelocationdatax = ls_storagelocationdatax
      valuationdata        = ls_valuationdata
      valuationdatax       = ls_valuationdatax
      warehousenumberdata  = ls_warehousenumberdata
      warehousenumberdatax = ls_warehousenumberdatax
      salesdata            = ls_salesdata
      salesdatax           = ls_salesdatax
      storagetypedata      = ls_storagetypedata
      storagetypedatax     = ls_storagetypedatax
      flag_online          = ls_flag_online
      flag_cad_call        = ls_flag_cad_call
      no_dequeue           = ls_no_dequeue
    IMPORTING
      return               = ls_return
    TABLES
      materialdescription  = lt_materialdescription
      unitsofmeasure       = lt_unitsofmeasure
      unitsofmeasurex      = lt_unitsofmeasurex
      internationalartnos  = lt_internationalartnos
      materiallongtext     = lt_materiallongtext
      taxclassifications   = lt_taxclassifications
      returnmessages       = lt_returnmessages
      prtdata              = lt_prtdata
      prtdatax             = lt_prtdatax
      extensionin          = lt_extensionin
      extensioninx         = lt_extensioninx.

This seems working but not as i want.

How can i say that create Sales: Sales Org. Data 1 and Sales: Sales Org. Data 2

for this(any) werks?

Thanks.