‎2013 Sep 05 6:14 AM
Hi Folks,
I have a requirement in my project wherein, we want to pull only the latest changed or created materials from SAP by giving a time range.
The details about the requirement is that, initially we want to push all the materials created in ECC to an external legacy MES system.
Since materials are not changed or created very frequently, we want to schedule a background job that runs every day or every week to fetch materials, only created or changed in that duration.
Is there a standard BAPI to do so?
Regards,
Gita
‎2013 Sep 05 8:47 AM
Hi Gita,
there is a standard ALE scenario in SAP for distribution of material masters using change pointers and Idoc's. This might be an alternative for your requirement.
Maintain distribution module for MATMAS Idoc in BD64 and make sure change pointers are active.
Then run program RBDMIDOC for MATMAS regularly in a Job. This program will send all new and changed material masters since the last run.
The recieving application need of cource some logic for the Idoc processing or you use a middleware in between like PI.
Regards
Michael
‎2013 Sep 05 6:34 AM
Hello Gita.
You find the date of last change in MARA-laeda for a material.
Using BAPI_MATERIAL_GET_DETAIL, you can get this data for a material.
Then using this data in an internal table, filter using date range and perform your business logic.
Regards.
‎2013 Sep 05 6:43 AM
Hi,
We are also tracking materials changes.
We use the "Change documentd" created during mm01 mm02 MM06.
using:
Object class: MATERIAL
TABLES: cdhdr,cdpos,cdred .
Note: It is worthwhile building index over CDHDR - fields OBJECTCLAS , UDATE .
CALL FUNCTION 'CHANGEDOCUMENT_READ_HEADERS'
CALL FUNCTION 'CHANGEDOCUMENT_READ_POSITIONS'
Regards.
‎2013 Sep 05 6:46 AM
Hi Gita,
If you want to push data why need a BAPI....
You can query MARA directly
DATA : last_date type sy-datum.
Select * from MARA into table it_mara
where ersda GE last_date or lesda GE last_date.
You can use the BAPI or Normal selects of required data for these materials.
OR
You can use IDoc methodology to update data in batches by activating change pointers no need to do any coding..
But the receiving system should understand IDoc....
I hope it helps.
Regards
‎2013 Sep 05 6:46 AM
Hi Gita ,
I hope in SAP No Material Master BAPI available which fetch the Material Master Record based on Created or Changed in Particular Duration , you can create your own custom function module or program using "MARA" table .
Regard's
Smruti
‎2013 Sep 05 8:47 AM
Hi Gita,
there is a standard ALE scenario in SAP for distribution of material masters using change pointers and Idoc's. This might be an alternative for your requirement.
Maintain distribution module for MATMAS Idoc in BD64 and make sure change pointers are active.
Then run program RBDMIDOC for MATMAS regularly in a Job. This program will send all new and changed material masters since the last run.
The recieving application need of cource some logic for the Idoc processing or you use a middleware in between like PI.
Regards
Michael
‎2013 Sep 05 11:16 AM
Thanks Michael,
I think I will go for this approach.
Do we have something similar for inventory?
I have another requirement where in any inventory change (GR/GI/Stock status change) needs to push the details to an external system whenever the change is carried out.
Regards,
Gita
‎2013 Sep 05 2:02 PM
Hi Gita,
change pointer are used for master data, like material, customer, vendor.
In case of status change you sometimes find an event of the corresponding business object where you can develop an event receiver like it is in production order (BUS2005). In transactional data you often find message control like in purchase or sales orders where also Idoc's can be created based on conditions.
I am not sure if there is something for stock changes.
What do you mean by stock status change and in which SAP transaction you can see it?
/Michael
‎2013 Sep 06 4:17 AM
Thanks Michael.
By Stock Status change, i mean when the status changes from unrestricted/blocked/quality etc.
For inventory my requirement is. Whenever there is a change in the inventory stock, like credit or debit, or the stock changes from unrestricted to blocked or vice versa, in real time I want some idoc to be sent to a MES so that both are in sync.
PLease help me with this requirement.
Regards,
Gita
‎2013 Sep 06 8:20 AM
Hi Gita,
I did some investigation. There are options for message output of material documents.
But I would prefer to implement enhancement MB_CF001 in CMOD. Within FM EXIT_SAPLMBMB_001, which is called before a material document change is commited, you have to write your own logic for the checks and the interface. So you are free to define an own file structure or Idoc.
I would probably use the existing Idoc type WMMBID02 and fill the values within the exit.
You can transfer it to the ALE outbound layer by means of FM MASTER_IDOC_DISTRIBUTE. Rest are Idoc settings as usual in WE20, WE21.
Hope this helps to find your solution. It will not be so easy then it is for "out-of-the-box" material master distribution.
/Michael