‎2006 Jul 28 10:02 AM
How to create a report to Extract a data from SAP in to a flat file and send it to a third party system.This report will be run on a weekly basis and the data needs to be FTP'd through the business
connector.
Also advice me on what type of file will the
business connector accept.
This report will be related to the transaction
MD04 where the total requirements by month
for each part number in the part master needs
to be obtained.
Plz provide your valuable advice.
‎2006 Jul 28 10:11 AM
I think the reccomnnded way is doing it by sending IDOC's to BC.
In BC use service pub.sap.idoc:encode to create XML file which can be transpoted then to FTP.
BR, Jacek
Message was edited by: Jacek Slowikowski
‎2006 Jul 28 10:28 AM
hello,
you can use the function module
I couldnt able to remember the name of function Module
so call_system and try F4 on SE37 . I think it is SPXG_CALL_SYSTEM..
This function module is used for transfering files to FTP.
Reward if helps.
Thanks,
krishnakumar
‎2006 Jul 28 10:45 AM
Hi Kevin
Below is a sample code for extracting and writing data to flat file.
parameters: p_werks like marc-werks obligatory.
select-options: s_lgort for mard-lgort,
s_matnr for mara-matnr.
parameters: p_file like rlgrap-filename obligatory.
data: begin of it_out occurs 0 with header line,
matnr like mara-matnr,
werks like marc-werks,
lgort like mard-lgort,
labst like mard-labst,
insme like mard-insme,
speme like mard-speme,
end of it_out.
start-of-selection.
select amatnr bwerks clgort clabst cinsme cspeme
into table it_out
from mara a
inner join
marc as b
on bmatnr = amatnr
inner join
mard as c
on cmatnr = bmatnr
and cwerks = bwerks
where b~werks = p_werks
and a~matnr in s_matnr
and c~lgort in s_lgort.
open dataset p_file for output in text mode.
if sy-subrc ne 0.
message e000(00) with 'Unable to Open file.'.
else.
loop at it_out.
transfer it_out to p_file.
endloop.
close dataset p_file.
endif.
Once if you the flat file ready use FM's FTP_CONNECT, FTP_COMMAND & FTP CLOSE to first connect the destination server, move the file and close the connection.
Hope the info is useful for you.
Regards
Eswar
Note: Reward for useful info.
‎2006 Jul 28 12:39 PM
Hai Nick
Check the following Document
In ABAP context , interfaces are only of two types.
1) INBOUND interfaces
2)OUTBOUND Interfaces.
INBOUND:(from external system data is fetched as flat files which is moved to SAP database tables).
in this process we get data in the form of flat files(.txt or .xlx). we will read this data from the files using FM like UPLOAD/WS_UPLOAD/GUI_UPLOAD into internal
tables. And using BDC methods or LSMW tool, we will update the database tables with this data.
OUTBOUND:(Data from SAP dtabase is retrieved adn stored as flatfiles on presentaion server or application server)
In this process we retrieve data using select statements from the database tables and will populate the internal tables. based on the requirement, we will use FM like DOWNLOAD/WS_DOWNLAOD/GUI_DOWNLOAD to write data from internal tables to flat files on th presentation server.
*the above mentioned Fm will work for files on presentaion server(local file system) . IF u want to handle files on the application server, use DATASET.
Other technologies that u mentioned like RFC, BAPI, EDI,ALE, IDOCS etc might be used as apart of interface code.
Regards
Sreeni