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: 

Program works but background job for that program fails....

Former Member
0 Kudos

I have a requirement where I have to collect the details of the purchase order and put the details in XML file format and FTP the XML file to an external third party FTP Server.

To realize this I developed a report program which follows following logic.

1) First I collected the PO details by calling the BAPI BAPI_PO_GETDETAIL1.

2) Then using the following link "/people/r.eijpe/blog/2005/11/10/xml-dom-processing-in-abap-part-i--convert-an-abap-table-into-xml-file-using-sap-dom-approach

I converted these PO details to the XML file format that the third party people accept.

In the code I used u201CCALL METHOD cl_gui_frontend_services=>gui_downloadu201D and in this process first the XML file is generated and is getting stored on my deskytop.

3) Then I called HTTP_SCRAMBLE, FTP_CONNECT, FTP_COMMAND , FTP_DISCONNECT and RFC_CONNECTION_CLOSE.

This works perfectly well and each time I execute the report the file is getting FTPu2019ed to the third party FTP server.

Now I tried to schedule a batch job for this and the batch job fails with follwing errors


02/25/2009 15:08:47 Error in Control Framework
Message Class  = FES          
Message Number = 022   
Message Type   = E
02/25/2009 15:08:47 Job cancelled after system exception ERROR_MESSAGE  
Message Class  = 00         
Message Number = 564   
Message Type   = A                 

Can some one tell me what is going wrong. My report works perfect in front end but fails if I try to schedule a background job for it in SM36.

Can you please tell me whatz going wrong with batch job? Any Help is highly appreciated.

Regards,

JEssica SAm

6 REPLIES 6

Former Member
0 Kudos

in background, you don't have access to your front end so you can't use GUI DOWNLOAD.

0 Kudos

Robert...Thanks for the reply...

I am using follwing code


l_xml_size = l_ostream->get_num_written_raw( ).

    CALL METHOD cl_gui_frontend_services=>gui_download
      EXPORTING
        bin_filesize = l_xml_size
        filename     = FILEPATH
        filetype     = 'BIN'
      CHANGING
        data_tab     = l_xml_table
      EXCEPTIONS
        OTHERS       = 24.
    IF sy-subrc <> 0.
      MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                 WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

Now what changes should i make..where should i store my XML file then instead of my desktop?

and whih Function Module should i Use..

0 Kudos

in your code, you should check to see if you're running in foreground or background then proceed with the appropriate download method.

in background, you can use the OPEN DATASET.. CLOSE DATASET commands. I'm sure there's a class to handle downloads in the background, but I don't remember it right off the top of my head.

0 Kudos

Ok..then instead of downloading it to desktop where shouldl i download.unable to understandn this open dataset concept..cn u explain a bit ..and help me...

0 Kudos

when you use OPEN/CLOSE DATASET, you are writing your file to your UNIX operating system (assuming your SAP installation is on UNIX).

you will need to supply a path where your file will be downloaded & you can then FTP the file from there.

0 Kudos

Robert,

Our SAP Server is installed on UNIX Operating System. So i need to find the path of this server and use OPEN DATA SET and store the files there and FTP them right?

But i was using DOM for converting my PO detailsl to XML files. Will DOM work with OPEN DATA SET ?

i was using robert ejpies blog

"/people/r.eijpe/blog/2005/11/10/xml-dom-processing-in-abap-part-i--convert-an-abap-table-into-xml-file-using-sap-dom-approach for converting the details of PO to XML file format that the external third party accepts.

Can u please let me know if the Roberts aaproch works with open..dataset..

Kindly help.

Regards,

Jessica Sam