Application Development 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: 

Create a material in another society BAPI

Former Member
0 Kudos

Hello,

Someone could help me please, I have a material in a Society, I need to use all the data of this material already created to extend this material in another society.

The idea is to have the same material in many societys, only in the society that exists can be used. So I will have:

Material         Society (This would be tha table MARC)

1000001        3780

1000001        C128

1000001        C208

Can I use a BAPI to do it?, Which BAPI can I use?

Thanks o much.

3 REPLIES 3

Former Member
0 Kudos

Hi,

You need to get the details of existing material with the society!

BAPI_MATERIAL_GET_ALL


by using the details of material need to extend the views with the below BAPI


* Need to extend the material by using the below FM BAPI_MATERIAL_SAVEDATA

0 Kudos

thank you so much, I will try, I will comment you how I made it. Jus a few minutes

0 Kudos

Hi,

I need your help, I get a message that the material doesn' t exist, but it exists for another societyr

    CALL FUNCTION 'BAPI_MATERIAL_GET_ALL'
        EXPORTING
          MATERIAL                  it_data-matnr
       IMPORTING
         CLIENTDATA                 bapi_clientedata
         "PLANTDATA                  =  bapi_plantadata
         "STORAGELOCATIONDATA        =  bapi_storagelocationdata
         "VALUATIONDATA              =  bapi_valuationdata
       TABLES
         RETURN = returnmessages.

      "Header
      bapi_head-material = bapi_clientedata-material.
      bapi_head-ind_sector = bapi_clientedata-IND_SECTOR.
      bapi_head-matl_type = bapi_clientedata-MATL_TYPE.

      "Almacenamiento
      bapi_mard-plant it_data-werks.
      bapi_mardx-plant it_data-werks.
      bapi_mard-stge_loc = it_data-lgort.
      bapi_mardx-stge_loc = it_data-lgort.

     "Compra
      bapi_marc1-plant = it_data-werks.
      "bapi_marc1-pur_group = bapi_plantadata-PUR_GROUP.
      bapi_marcx-plant = it_data-werks.
      "bapi_marcx-pur_group = 'X'.

      bapi_mbew1-val_type = it_data-BWTAR. "Categoria de valoración.
      bapi_mbewx-val_type = it_data-BWTAR.


      CALL FUNCTION 'BAPI_MATERIAL_SAVEDATA'
        EXPORTING
          headdata             = bapi_head
          plantdata            = bapi_marc1
          plantdatax           = bapi_marcx
          StorageLocationData  = bapi_mard
          StorageLocationDatax = bapi_mardx
          valuationdata        = bapi_mbew1
          valuationdatax       = bapi_mbewx
        IMPORTING
           return              = bapi_return
        TABLES
           returnmessages = returnmessages.

          IF bapi_return-type = 'E'.
            WRITE:/ 'Error:' ,bapi_return-message ,'for material:' ,bapi_head-material.
          ELSEIF bapi_return-type = 'S'.
            CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.