‎2009 Jun 18 9:10 PM
Experts,
I'm using a transformation to generate a xml file:
CALL TRANSFORMATION zdatafechomes
SOURCE ficheiroexecucao = gt_source[]
RESULT XML xml_result.
It's working fine. But i'm having problems in putting the "xml_result" (it's a type xtring) into the application server.
Anyone knows how to do it ? Transaction cg3z it's different because the file comes from C:
Best Regards,
Mário.
‎2009 Jun 18 9:33 PM
Hello Mario
I do not see why the following logic should not work:
*&---------------------------------------------------------------------*
*& Report ZUS_SDN_XML_XSTRING_APPLSERVER
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT ZUS_SDN_XML_XSTRING_APPLSERVER.
DATA:
gd_dsn type string,
gd_xstring type xstring,
gt_kna1 type STANDARD TABLE OF kna1.
start-of-selection.
select * from kna1 into table gt_kna1 up to 10 rows.
BREAK-POINT.
call TRANSFORMATION id
source itab = gt_kna1
result xml = gd_xstring.
gd_dsn = '/tmp/xml_as_xstring.file'.
open DATASET gd_dsn for OUTPUT in BINARY MODE.
check ( syst-subrc = 0 ).
TRANSFER gd_xstring to gd_dsn.
CLOSE DATASET gd_dsn.
end-of-SELECTION.
Regards
Uwe
‎2009 Jun 18 9:32 PM
Mário,
Since your result data object "xml_result" is of xstring type you may take this approach
1. Convert this into unicode string using function HR_KR_XSTRING_TO_STRING
2. Convert string into standard table using function HR_EFI_CONVERT_STRING_TO_TABLE.
3. Write contents of this table to application server using OPEN DATASET and TRANSFER statement.
Hope this works.
Regards,
Gajendra
‎2009 Jun 18 9:33 PM
Hello Mario
I do not see why the following logic should not work:
*&---------------------------------------------------------------------*
*& Report ZUS_SDN_XML_XSTRING_APPLSERVER
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT ZUS_SDN_XML_XSTRING_APPLSERVER.
DATA:
gd_dsn type string,
gd_xstring type xstring,
gt_kna1 type STANDARD TABLE OF kna1.
start-of-selection.
select * from kna1 into table gt_kna1 up to 10 rows.
BREAK-POINT.
call TRANSFORMATION id
source itab = gt_kna1
result xml = gd_xstring.
gd_dsn = '/tmp/xml_as_xstring.file'.
open DATASET gd_dsn for OUTPUT in BINARY MODE.
check ( syst-subrc = 0 ).
TRANSFER gd_xstring to gd_dsn.
CLOSE DATASET gd_dsn.
end-of-SELECTION.
Regards
Uwe
‎2009 Jun 18 10:21 PM
Uwe,
There is no reason why your approach would not work. I agree that yours is a better approach provided opening the file in Binary Mode suffices Mario's requirements.
The solution that I proposed would work for unicode program when file needs to be opened in text mode.
Regards,
Gajendra
‎2009 Jun 19 10:00 AM
Hello Uwe and Gajendra,
The problem is solved, the sample code povided by Uwe it's working fine. I gave points to both of u.
Now if i want to read a xml file from application server, and populate a internal table using the transformation , how can it be done ? Do you have a sample code?
Ex.
CALL TRANSFORMATION zdatafechomes
SOURCE XML xml_result (this info comes from application server)
RESULT ficheiroexecucao = gt_source.
Best regards and thanks for your help.
MR.