2012 Jan 07 11:20 AM
Dear All
I my program I am pikcking up a xml file from a shared folder and processing it. I use EPS_GET_DIRECTORY_LISTING the function to get the file listing..
However it works fine when I execute it through F8.
When I schedule this program at background proess, it does not work..
My application server is having the shared directory where these files are placed.
Can someone helpme ...
Regards,
Venkat
2012 Jan 09 12:03 AM
This is closed. Solved myself.
The solution is that, the fuction GUI_UPLOAD used further in my program will not work on background. So I need to change the logic to parse the XML file. I used OPEN DATASET menthod and resolve my issue.
l_filename = p_filnam. "'
FS\FILESERVER\SAP\MR\MR-842.xml'.
OPEN DATASET l_filename FOR INPUT in BINARY MODE .
DO.
READ DATASET l_filename INTO l_xml_line.
IF sy-subrc EQ 0.
APPEND l_xml_line TO l_xml_table.
ELSE.
EXIT.
ENDIF.
ENDDO.
CLOSE DATASET l_filename.
l_str1 = ''.
LOOP AT l_xml_table INTO l_xml_line.
c_conv = cl_abap_conv_in_ce=>create( input = l_xml_line-data replacement = space ).
c_conv->read( IMPORTING data = l_content len = l_len ).
CONCATENATE l_str1 l_content INTO l_str1.
ENDLOOP.
v_subrc = lcl_xml_doc->parse_string( l_str1 ).
Regards,
Venkat
2012 Jan 09 12:03 AM
This is closed. Solved myself.
The solution is that, the fuction GUI_UPLOAD used further in my program will not work on background. So I need to change the logic to parse the XML file. I used OPEN DATASET menthod and resolve my issue.
l_filename = p_filnam. "'
FS\FILESERVER\SAP\MR\MR-842.xml'.
OPEN DATASET l_filename FOR INPUT in BINARY MODE .
DO.
READ DATASET l_filename INTO l_xml_line.
IF sy-subrc EQ 0.
APPEND l_xml_line TO l_xml_table.
ELSE.
EXIT.
ENDIF.
ENDDO.
CLOSE DATASET l_filename.
l_str1 = ''.
LOOP AT l_xml_table INTO l_xml_line.
c_conv = cl_abap_conv_in_ce=>create( input = l_xml_line-data replacement = space ).
c_conv->read( IMPORTING data = l_content len = l_len ).
CONCATENATE l_str1 l_content INTO l_str1.
ENDLOOP.
v_subrc = lcl_xml_doc->parse_string( l_str1 ).
Regards,
Venkat