Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Function Module to modify MARC table

Former Member
0 Likes
5,020

Hi all,

Is There any Function Module which modifys the table MARC.

please suggest.

regards,

chandra.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
3,021

Hello,

Use <b>BAPI_MATERIAL_SAVEDATA</b>

Regards,

Vasanth

11 REPLIES 11
Read only

Former Member
0 Likes
3,021

Hi ,

Which feild do you want to update in MARC , as there are many FM which update the table MARC , but they update specific feilds only e.g. KE_PRCTR_MARC_UPDATE.

To get a list of similar FM enter MARC in SE37 and search for the list of FM.

Regards

Arun

Read only

0 Likes
3,021

Hi Arun,

i need to modify field VINT2.

please suggest.

regards,

reddy.

Read only

0 Likes
3,021

Hi ,

I did not find any FM updating the said feild , why dont you use the UPDATE or SET Command for the same.

Regards

Arun

Read only

Former Member
0 Likes
3,021

Instead of using function module for modifying a single field you can use the statement

modify marc using <internmal table> transporintg <that fieldname>

keep this inside a loop .

and this will modify the db table marc .. only thefield you want to modify accoring to you internal table...

Regards,

Jayant.

please award if helpful

Read only

0 Likes
3,021

Hello Chandra

The suggestion proposed by Jayant is - by far - the worst way of dealing with any master data.

Regards

Uwe

Read only

Former Member
0 Likes
3,021

HI,

I dont know exactly but try using FM "MARC_MODIFY_BY_RQGRP_DB"..

or use Modify statement

Modify MARC using the filed name you want to

rewards if useful

regards,

nazeer

Message was edited by:

nazeer shaik

Read only

uwe_schieferstein
Active Contributor
0 Likes
3,021

Hello Chandra

Since you want to update material master data you should use the appropriate <b>BAPI</b>. If you are dealing with "normal" materials then you can use <b>BAPI_MATERIAL_SAVEDATA </b>(IMPORTING parameter PLANTDATA). For retail related material you probably need to use the retail-related BAPI.

In general you should use BAPIs for modifying master data because the BAPIs check very scrupulous whether all incoming data are consistent. Furthermore, if updating of additional tables is required the BAPI will take care of this.

Regards

Uwe

Read only

0 Likes
3,021

hello Uwe,

Thank you for your suggestion.

i tried with BAPI_MATERIAL_SAVEDATA but i am getting run time errors.

under headdata what i have to specify???

could u please suggest.

thanks,

chandra.

Read only

0 Likes
3,021

Hello Reddy,

Check this sample code:


*&---------------------------------------------------------------------*
*& Report  ZYTEST02                                                    *
*&                                                                     *
*&---------------------------------------------------------------------*
*&                                                                     *
*&                                                                     *
*&---------------------------------------------------------------------*

report  zytest02                      .


parameters:matnr like bapimathead-material,
           maktx like bapi_makt-matl_desc     default 'Mat. autm. AE',
           werks like bapi_marc-plant,
           vkorg like bapi_mvke-sales_org,
           vtweg like bapi_mvke-distr_chan.

start-of-selection.

  perform material_create using matnr
                                maktx
                                werks
                                vkorg
                                vtweg.

*&---------------------------------------------------------------------*
*&      Form  material_create
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      -->P_MATERIAL  text
*----------------------------------------------------------------------*
form material_create using    value(p_matnr)
                              value(p_maktx)
                              value(p_werks)
                              value(p_vkorg)
                              value(p_vtweg).

  tables: mara.

* shift p_matnr right deleting trailing space.
* translate p_matnr using ' 0'.

  data: headdata    like bapimathead occurs 0 with header line.
  data: clientdata  like bapi_mara.
  data: clientdatax like bapi_marax.
  data: salesdata   like bapi_mvke.
  data: salesdatax  like bapi_mvkex.
  data: plantdata   like bapi_marc.
  data: plantdatax  like bapi_marcx.
  data: return         like bapiret2.
  data: taxclassifications like bapi_mlan   occurs 0 with header line.
  data: commitmessages like bapi_matreturn2 occurs 0 with header line.
  data: returnmessages like bapiret2        occurs 0 with header line.
  data: materialdescription like bapi_makt  occurs 0 with header line.

  data: charx value 'X'.

* Kopfdaten
  headdata-material   = p_matnr.
  headdata-matl_type  = 'FERT'.
  headdata-ind_sector = 'M'.
* Sichten die gepflegt werden sollen
  headdata-basic_view = charx.  "Sicht auf Grunddaten
  headdata-sales_view = charx.  "Sicht auf Vertriebsdaten
* Daten für die Sicht GRUNDDATEN 1
  materialdescription-langu = sy-langu.
  materialdescription-matl_desc = p_maktx.
  append materialdescription.
*---------------------------------------------------------------------*
* Mandantenspezifische Materialdaten
*---------------------------------------------------------------------*
  clientdata-base_uom  = 'ST'.
  clientdatax-base_uom = charx.
*
  clientdata-trans_grp  = '0001'.
  clientdatax-trans_grp  = charx.
*---------------------------------------------------------------------*
* Materialdaten auf Werksebene
*---------------------------------------------------------------------*
  plantdata-plant = p_werks.
  plantdatax-plant = p_werks.

  plantdata-loadinggrp = '0001'.
  plantdatax-loadinggrp = charx.
*---------------------------------------------------------------------*
* Verkaufsdaten
*---------------------------------------------------------------------*
  salesdata-sales_org = p_vkorg.
  salesdatax-sales_org = p_vkorg.
  salesdata-distr_chan = p_vtweg.
  salesdatax-distr_chan = p_vtweg.
*---------------------------------------------------------------------*
* Steuerklassifikation
*---------------------------------------------------------------------*
  taxclassifications-depcountry = 'DE'.
  taxclassifications-tax_type_1 = 'MWST'.
  taxclassifications-taxclass_1 = '1'.
  append taxclassifications.



  call function 'BAPI_MATERIAL_SAVEDATA'
    exporting
      headdata                   = headdata
      clientdata                 = clientdata
      clientdatax                = clientdatax
      plantdata                  = plantdata
      plantdatax                 = plantdatax
*   FORECASTPARAMETERS         =
*   FORECASTPARAMETERSX        =
*   PLANNINGDATA               =
*   PLANNINGDATAX              =
*   STORAGELOCATIONDATA        =
*   STORAGELOCATIONDATAX       =
*   VALUATIONDATA              =
*   VALUATIONDATAX             =
*   WAREHOUSENUMBERDATA        =
*   WAREHOUSENUMBERDATAX       =
       salesdata                  = salesdata
       salesdatax                 = salesdatax
*   STORAGETYPEDATA            =
*   STORAGETYPEDATAX           =
    importing
      return                     = return
    tables
      materialdescription        = materialdescription
*   UNITSOFMEASURE             =
*   UNITSOFMEASUREX            =
*   INTERNATIONALARTNOS        =
*   MATERIALLONGTEXT           =
      taxclassifications         = taxclassifications
      returnmessages             = returnmessages
*   PRTDATA                    =
*   PRTDATAX                   =
*   EXTENSIONIN                =
*   EXTENSIONINX               =
            .
  call function 'BAPI_TRANSACTION_COMMIT'
       exporting
            wait   = charx
       importing
            return = commitmessages.

*  commit work and wait.

* Für den Fall das es notwendig wird die Exclusive Sperre wegräumen
       CALL FUNCTION 'DEQUEUE_EMMARAE'
            EXPORTING
                matnr = p_matnr.



* if return-type ne 'S'.
    format color col_negative.
    loop at returnmessages.
      write: / returnmessages-message.
    endloop.
* endif.

  loop at commitmessages.
    write: / commitmessages-message.
  endloop.

endform.                    " material_create

If useful reward.

Vasanth

Read only

Former Member
0 Likes
3,022

Hello,

Use <b>BAPI_MATERIAL_SAVEDATA</b>

Regards,

Vasanth

Read only

Former Member
0 Likes
3,021

Thank you