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: 

How can I download from R/3 to flat file?

Former Member
0 Kudos

Hi

My requirement is to download Material and Supplier data from R/3 to flat file...

These are the fields I have to bring it from SAP R/3 but I don not want to DOWNLOAD FM. I want to Concatenate from Internal Table and put it on application server.

There are my following fields...

Material and Supplier

1. Selection criteria

- Based on plant

- Hubs and FSL/Hubs

- Hubs can pull both Repair and NewBuy vendor

- FSL/Hubs pull only Repair vendor

2. Material – EORD-MATNR

3. Region – Determined by 9* plants

4. Site

1. plant-(W) and plant-(C) for FSL/Hubs

2. plant-(S) for DCs

5. Supplier

1. Menlo/Repair for DC

2. Repair only for hub/fsl

6. Supplier-type – PURCHASE or REPAIR

7. Leadtime - (The number of days between placing an order and receiving an order)

8. Order Horizon – “2”

9. Minimum OQ – “3”

10. Order cost – “50”

11. Supplier part number – EORD-MATNR

Waiting for some help and (or) sample code for this...

Thanks in advance.

2 REPLIES 2

Former Member
0 Kudos

Hi Vijay,

To download on application server you need to use OPEN DATASET ..

Just refer to the below link.

http://www.sapdevelopment.co.uk/file/file_downloadsap.htm

Reward points if useful.

Regards,

Atish

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

Here is an example program showing how to write a tab-delimited file to the application server. All you need to do is get all your data into an internal table, then loop at it, concatenate all fields into a string and then transfer that string.



report zrich_0001.

parameters: d1 type localfile default '/usr/sap/TST/SYS/Test.txt'.

data: begin of itab occurs 0,
      field1(20) type c,
      field2(20) type c,
      field3(20) type c,
      end of itab.
data: str type string.

constants: con_tab type x value '09'.

* if you have a newer version, then you can use this instead.
*constants:
*    con_tab  type c value cl_abap_char_utilities=>HORIZONTAL_TAB.

start-of-selection.

itab-field1 = 'ABC'.
itab-field2 = 'DEF'.
itab-field3 = 'GHI'.
append itab.

itab-field1 = '123'.
itab-field2 = '456'.
itab-field3 = '789'.
append itab.

  open dataset d1 for output in text mode.
  loop at itab.
    concatenate itab-field1 itab-field2 itab-field2 into str
                  separated by con_tab.
    transfer str to d1.
  endloop.
  close dataset d1.

Regards,

Rich Heilman