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: 

EPS_GET_DIRECTORY_LISTING - does not work in backgroud

venkateswaran_k
Active Contributor
0 Kudos
218

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

1 ACCEPTED SOLUTION

venkateswaran_k
Active Contributor
0 Kudos
67

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

1 REPLY 1

venkateswaran_k
Active Contributor
0 Kudos
68

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