Showing results for 
Search instead for 
Did you mean: 

bapi_material_maintaindata_rt or bapi_material_upload_save

Former Member
0 Kudos

Hi all,

I am trying to update the field PLIFZ from table MARC using one of these BAPIs, but I can´t get it to work.

Anyone has a tip?

Thanks in advance!


Accepted Solutions (1)

Accepted Solutions (1)

Developer Advocate
Developer Advocate
0 Kudos

I got this code working pretty good......

report zrich_0001.

data begin of i_mara  occurs   0.
        include structure mara_ueb.              "Basic Data Views
data end of i_mara.

data begin of i_marc occurs   0.
        include structure marc_ueb.              "Plant Views
data end   of i_marc.

data: i_marcx type table of marc with header line.
data: tranc(10) value '0000000001'.

parameters: p_matnr type mara-matnr,
            p_werks type marc-werks,
            p_plifz type marc-plifz.

select * into corresponding fields of table i_marcx
      from marc where matnr = p_matnr
                  and werks = p_werks.

tranc = '0000000001'.
loop at i_marcx.

* Reset I_Mara to new material number
  clear i_mara. refresh i_mara.
  select * into corresponding fields of table i_mara
        from mara where matnr = p_matnr.
  read table i_mara index 1.
  i_mara-tcode = 'MM02'.
  i_mara-tranc = tranc.
  modify i_mara index 1.

* Get Plant Data
  clear i_marc. refresh i_marc.
  select * into corresponding fields of table i_marc
        from marc where matnr = i_marcx-matnr
                    and werks = i_marcx-werks.
  read table i_marc index 1.

  i_marc-plifz  = p_plifz.

  i_marc-tranc = tranc.
  modify i_marc index 1.

  tranc = tranc + '0000000001'.

*Create Plant associated views
  perform create_material_views.


form create_material_views.

* Variable for "Maintain_Material_Dark" Function Module
  data: numerror like tbist-numerror.
  data: last_matnr type mara-matnr.

  data: begin of i_delfields occurs 20.
          include structure mfieldres.
  data: end of i_delfields.

  data: begin of i_errors occurs 20.
          include structure merrdat.
  data: end of i_errors.

  call function 'MATERIAL_MAINTAIN_DARK'
              sperrmodus                = ' '
              kz_prf                    = 'W'
              max_errors                = ' '
              p_kz_no_warn              = 'X'
              kz_verw                   = 'X'
              kz_aend                   = 'X'
              kz_dispo                  = 'X'
              kz_test                   = ' '
              flag_muss_pruefen         = ' '
              call_mode                 = 'ACT'
              number_errors_transaction = numerror
              matnr_last     = last_matnr
             amara_ueb      = i_mara    "Basic Data
*             amakt_ueb      = i_makt    "Descriptions
             amarc_ueb      = i_marc    "Plant
*             amard_ueb      = i_mard    "Storage Location
*            AMFHM_UEB      = I_MFHM    "Production Tools
*             amarm_ueb      = i_marm    "Units of Measure
*            AMEA1_UEB      = I_MEA1    "Internal Mangagement -  EANs
*             ambew_ueb      = i_mbew    "Accounting/Costing
*             asteu_ueb      = i_steu    "Tax Data
*             astmm_ueb      = i_steumm  "Tax Data
*            AMLGN_UEB      = I_MLGN    "Warehouse Data
*            AMLGT_UEB      = I_MLGT    "Storage Type Data
*            AMPGD_UEB      = I_MPGD    "Change Documents
*            AMPOP_UEB      = I_MPOP    "Forcast Parameters
*            AMVEG_UEB      = I_MVEG    "Total Consumption Data
*            AMVEU_UEB      = I_MVEU    "Unplanned Consumption Data
*             amvke_ueb      = i_mvke    "Sales Data
*             altx1_ueb      = i_ltx1    "Sales Text
*            AMPRW_UEB      = I_MPRW    "Forcast Values
             amfieldres     = i_delfields
             amerrdat       = i_errors
              kstatus_empty             = 01
              tkstatus_empty            = 02
              t130m_error               = 03
              internal_error            = 04
              update_error              = 05
              too_many_errors           = 06.

  if sy-subrc <> 0.
    rollback work.
    call function 'DEQUEUE_ALL'.
    commit work and wait.
    call function 'DEQUEUE_ALL'.

  clear: i_mara, i_marc.
  refresh: i_mara, i_marc.



Rich Heilman

Former Member
0 Kudos

Hi Rich, thank you very much for your quick response.

I couldn´t get the report to work. There were no error messagges, but the field did not change. I´ll aprecciate any help regarding this subject.

Thanks in advance,

Ezequiel Martin

Developer Advocate
Developer Advocate
0 Kudos

thats kinda weird. it works great for me. Are you sure that we are talking about the same field. Planned Delivery Time on MRP2 view?


Rich Heilman

Active Contributor
0 Kudos

Hi Ezequiel!

Maybe it is a transaction problem. Check MM90, if you got a log message. Some fields are set to 'display only'.

(At least transaction MM42 can be customized this way, hope, this is also possible for MM02.)



Answers (2)

Answers (2)

0 Kudos

Do you need to use Bapi?? I know there is a function that available from SAP that can update MARC/WRPL/MPOP...but this function only available in 4.7.. otherwise.. search oss note for this function..

"MATERIAL_UPDATE_LOGISTICS_DATA".. This is a mass update function and it only update thousands of MARC records within a few seconds....

Former Member
0 Kudos

Thank you all for your help. I just didn´t have the rights to modify the field (when I was suppossed to), It worked great as soon as I got it.

Best Regards,

Ezequiel Martin

Active Contributor
0 Kudos

Nice to hear, next time (if I remember) I will mention SU53, too.