Application Development and Automation 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: 
Read only

xml-ftp

Former Member
0 Likes
857

hi

i am trying to create xml file from abap program and ftp the same to ftp server.

is there any RFC for it?

thanks in advance

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
763

Hi,

After creating the XML file, Use the ABAP standard program RSEPSFTP to FTP the XML file, read the Program documentation to understand how it works

You can look at the below 2 Programs also

Uploading/downloading files from front end to R/3 server using two ABAPs.

Code

If you want to upload/download files from your front end to the R/3 server or the other way around you will find these two reports very useful:

For uploding files, do transaction SA38/SE38 and run report: RC1TCG3Z

For downloading use report: RC1TCG3Y

Regards

Sudheer

Message was edited by:

Sudheer Junnuthula

4 REPLIES 4
Read only

Former Member
0 Likes
764

Hi,

After creating the XML file, Use the ABAP standard program RSEPSFTP to FTP the XML file, read the Program documentation to understand how it works

You can look at the below 2 Programs also

Uploading/downloading files from front end to R/3 server using two ABAPs.

Code

If you want to upload/download files from your front end to the R/3 server or the other way around you will find these two reports very useful:

For uploding files, do transaction SA38/SE38 and run report: RC1TCG3Z

For downloading use report: RC1TCG3Y

Regards

Sudheer

Message was edited by:

Sudheer Junnuthula

Read only

0 Likes
763

hi sudhir,

EPS_FTP_MPUT

EPS_FTP_PUT

EPS_FTP_GET all these function modules are used in the standard program. but unfortunately they are not released yet.

is there any other option you could suggest.

Read only

Former Member
0 Likes
763

hi nihi here is a sample prog to create xml files from abap

u can also go thro sap porg named SIXML_TEST

*&----


*

*& Report ZSAN_XML *

*& *

*&----


*

*& *

*& *

*&----


*

REPORT ZSAN_XML .

*----


*

  • Report ZPRUEBA_MML_13 *

  • Export an internal table to XML document *

  • NO BORRAR ESTE CODIGO *

*----


*

*REPORT ZPRUEBA_MML_13.

*----


*

  • PANTALLA SELECCION *

PARAMETERS: GK_RUTA TYPE RLGRAP-FILENAME.

  • PANTALLA SELECCION *

*----


*

*----


*

  • TYPE TURNOS *

TYPES: BEGIN OF TURNOS,

LU LIKE T552A-TPR01,

MA LIKE T552A-TPR01,

MI LIKE T552A-TPR01,

JU LIKE T552A-TPR01,

VI LIKE T552A-TPR01,

SA LIKE T552A-TPR01,

DO LIKE T552A-TPR01,

END OF TURNOS.

  • TYPE TURNOS *

*----


*

*----


*

  • TYPE SOCIO *

TYPES: BEGIN OF SOCIO,

NUMERO LIKE PERNR-PERNR,

REPOSICION LIKE PA0050-ZAUVE,

NOMBRE LIKE PA0002-VORNA,

TURNOS TYPE TURNOS,

END OF SOCIO.

  • TYPE SOCIO *

*----


*

*----


*

  • ESTRUCTURA ACCESOS *

DATA: BEGIN OF ACCESOS OCCURS 0,

SOCIO TYPE SOCIO,

END OF ACCESOS.

  • ESTRUCTURA ACCESOS *

*----


*

*----


*

  • START OF SELECTION *

START-OF-SELECTION.

PERFORM LLENA_ACCESOS.

PERFORM DESCARGA_XML.

END-OF-SELECTION.

  • END OF SELECTION *

*----


*

*----


*

  • FORM LLENA_ACCESOS *

FORM LLENA_ACCESOS.

REFRESH ACCESOS.

CLEAR ACCESOS.

MOVE: '45050' TO ACCESOS-SOCIO-NUMERO,

'MOISES MORENO' TO ACCESOS-SOCIO-NOMBRE,

'0' TO ACCESOS-SOCIO-REPOSICION,

'T1' TO ACCESOS-SOCIO-TURNOS-LU,

'T2' TO ACCESOS-SOCIO-TURNOS-MA,

'T3' TO ACCESOS-SOCIO-TURNOS-MI,

'T4' TO ACCESOS-SOCIO-TURNOS-JU,

'T5' TO ACCESOS-SOCIO-TURNOS-VI,

'T6' TO ACCESOS-SOCIO-TURNOS-SA,

'T7' TO ACCESOS-SOCIO-TURNOS-DO.

APPEND ACCESOS.

CLEAR ACCESOS.

MOVE: '45051' TO ACCESOS-SOCIO-NUMERO,

'RUTH PEÑA' TO ACCESOS-SOCIO-NOMBRE,

'0' TO ACCESOS-SOCIO-REPOSICION,

'T1' TO ACCESOS-SOCIO-TURNOS-LU,

'T2' TO ACCESOS-SOCIO-TURNOS-MA,

'T3' TO ACCESOS-SOCIO-TURNOS-MI,

'T4' TO ACCESOS-SOCIO-TURNOS-JU,

'T5' TO ACCESOS-SOCIO-TURNOS-VI,

'T6' TO ACCESOS-SOCIO-TURNOS-SA,

'T7' TO ACCESOS-SOCIO-TURNOS-DO.

APPEND ACCESOS.

ENDFORM.

  • FORM LLENA_ACCESOS *

*----


*

*----


*

  • FORM DESCARGA_XML *

FORM DESCARGA_XML.

DATA: L_DOM TYPE REF TO IF_IXML_ELEMENT,

M_DOCUMENT TYPE REF TO IF_IXML_DOCUMENT,

G_IXML TYPE REF TO IF_IXML,

W_STRING TYPE XSTRING,

W_SIZE TYPE I,

W_RESULT TYPE I,

W_LINE TYPE STRING,

IT_XML TYPE DCXMLLINES,

S_XML LIKE LINE OF IT_XML,

W_RC LIKE SY-SUBRC.

DATA: XML TYPE DCXMLLINES.

DATA: RC TYPE SY-SUBRC,

BEGIN OF XML_TAB OCCURS 0,

D LIKE LINE OF XML,

END OF XML_TAB.

CLASS CL_IXML DEFINITION LOAD.

G_IXML = CL_IXML=>CREATE( ).

CHECK NOT G_IXML IS INITIAL.

M_DOCUMENT = G_IXML->CREATE_DOCUMENT( ).

CHECK NOT M_DOCUMENT IS INITIAL.

WRITE: / 'Converting DATA TO DOM 1:'.

CALL FUNCTION 'SDIXML_DATA_TO_DOM'

EXPORTING

NAME = 'ACCESOS'

DATAOBJECT = ACCESOS[]

IMPORTING

DATA_AS_DOM = L_DOM

CHANGING

DOCUMENT = M_DOCUMENT

EXCEPTIONS

ILLEGAL_NAME = 1

OTHERS = 2.

IF SY-SUBRC = 0.

WRITE 'Ok'.

ELSE.

WRITE: 'Err =',

SY-SUBRC.

ENDIF.

CHECK NOT L_DOM IS INITIAL.

W_RC = M_DOCUMENT->APPEND_CHILD( NEW_CHILD = L_DOM ).

IF W_RC IS INITIAL.

WRITE 'Ok'.

ELSE.

WRITE: 'Err =',

W_RC.

ENDIF.

CALL FUNCTION 'SDIXML_DOM_TO_XML'

EXPORTING

DOCUMENT = M_DOCUMENT

IMPORTING

XML_AS_STRING = W_STRING

SIZE = W_SIZE

TABLES

XML_AS_TABLE = IT_XML

EXCEPTIONS

NO_DOCUMENT = 1

OTHERS = 2.

IF SY-SUBRC = 0.

WRITE 'Ok'.

ELSE.

WRITE: 'Err =',

SY-SUBRC.

ENDIF.

LOOP AT IT_XML INTO XML_TAB-D.

APPEND XML_TAB.

ENDLOOP.

CALL FUNCTION 'WS_DOWNLOAD'

EXPORTING

BIN_FILESIZE = W_SIZE

FILENAME = GK_RUTA

FILETYPE = 'BIN'

TABLES

DATA_TAB = XML_TAB

EXCEPTIONS

OTHERS = 10.

IF SY-SUBRC <> 0.

MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

ENDFORM.

  • FORM DESCARGA_XML *

*----


*

Uwe Schieferstein

Posts: 1,356

Questions: 1

Registered: 7/30/04

Forum points: 3,076

Re: Sample abap program to create XML files

Posted: Aug 22, 2006 8:51 PM in response to: Kaushik Hegde Reply E-mail this post

Hello Kaushik

Once again SAP is a good source for examples. Have a look at the many programs in package SIXML_TEST (iXML Tests). The package is available since release 6.20.

Regards

navjot

reward accordinly

Read only

Rashid_Javed
Contributor
0 Likes
763

Use Simple Transformations( ST ) to convert abap data to XML. Its help and sample programs can be found at

http://help.sap.com/saphelp_nw2004s/helpdata/en/e3/7d4719ca581441b6841f1054ff1326/frameset.htm

Also to ftp a file, you can use sap function modules that are part of function group SFTP. It contains functions to connect, and manipulate FTP commands. To look for a demo, you can see the reports that belongs to development class SFTP. there are many reports. Make sure you have RFC destinations SAPFTP, SAPFTPA available (check SM59) as these are used by SAP provided FTP functions.

RJv