Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Extracting data from SAP to flat file

Hi Gurus,

I want to extract data from SAP and downloaded to flat file . Scenario is given here

1) Production Schedule (material, quantity, date etc.)

2) Current Material Master (limited fields) for the materials in the production schedule

3) Current BOM for items in the Production Schedule

4) Current inventory for all items in the schedule and BOM

With following condiions:

1) Production Schedule: Collect the following Schedule data

a) Material Number

b) Revision Level

c) Date ( Production Date )

d) Quantity to produce

e) Production Line

By Executing transaction MF51 - Production List with the preferred production schedule date range, work center hierarchy and using the default selection criteria for all other attributes. The output can then be saved as a local Excel file

2) Collecting the BOM information for the interface: The Production Schedule defines the list of materials which should be used for subsequent processing. After determining the list of materials, loop the list over the BOM structure RC29K and gather the following data: (note - data can be viewed via transaction CS12 - program SAPMC29L)

MATNR - Header level material

WERKS - Plant

BMENG - Base Quantity


DATUV - Valid From Date

STLNR - BOM Number

POSNR - Item Number

IDNRK - Component Number

KTEXT - Component Description

MENGE - Component Quantity

MEINS - Component UOM

3) Collecting the Material Master information for the interface: Using the list of materials collected from the BOM run, loop over the Material Master tables to collect the following data: (note - This data can be viewed by via MM03 - Material Master Display program SAPLMGMM)


MARA/MATNR - Material Number


MAKT/MAKTX - Material Description

MARA/MATKL - Material Group

MARA/MSTAE - Cross Plant Material Status


MARA/NTGEW - Net Weight

MARC/BSTRF - Rounding Value

MBEW/STPRS - Standard Price

4) Collecting the Current Inventory information for the interface:

Using the list of material collected from the BOM run, loop over the Inventory Tables (or execute MMBE - program RMMMBESTN) to capture the current inventory count. The count should include 'Unrestricted Stock' and 'QI Stock' in all storage locations within the plant.

MARD/MATNR - Material number


MARD/LGORT - Storage Location

MARD/LABST - Unrestricted Stock

MARD/INSME - Quality Inspection Stock

All this 4 type of information should be downloaded to a single file . So that using this single file data will be uploaded to target system .

Please provide me the suitable code or solution


Not what you were looking for? View more on this topic or Ask a question