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

Data upload from Presentation server in background job ???

Former Member
0 Likes
5,282

Hi,

I have gone through the followiing query in SDN forums.

<u>

Can anyone help me to find relevant document which supports the statement that file on presentation server cannot be uploaded into internal table when the program is run in bakground mode .

Also I find many replies from the experts are from help.sap.com. Can anyone tell me the best way to search through help.sap.to find the correct documentation. I am always lost in searching through this.

Regards,

Ben.

Hi,

I have gone through the followiing query in SDN forums.

<u>

Can anyone help me to find relevant document which supports the statement that file on presentation server cannot be uploaded into internal table when the program is run in bakground mode .

Also I find many replies from the experts are from help.sap.com. Can anyone tell me the best way to search through help.sap.to find the correct documentation. I am always lost in searching through this.

Regards,

Ben.

27 REPLIES 27
Read only

Former Member
3,572

Hi Daniel,

It can still be done.

If you want i can send you a document.

Give me your mail ID.

Regards,

Ravi

Read only

0 Likes
3,572

Please note that sharing email addresses publicly violates our rules of engagement (https://community.sap.com/resources/rules-of-engagement).

I have removed all comments with email addresses from this thread. If you'd like to exchange email addresses, please follow each other (which you can do via the "follow" button on a profile page). When members follow each other, they can exchange direct messages, through which they can share email addresses privately if they wish.

Kind regards,

--Jerry

Make sure to subscribe to What's New!
Read only

Former Member
0 Likes
3,572

Hi,

you cannot upload file from PC to ITAB in Background.

Regards

vijay

Read only

0 Likes
3,572

Daniel,

File located on the desktop can not be used for a background job. A background job cannot access your desktop.

Thanks,

Read only

0 Likes
3,572

Hi vijay,

Can you plz provide me the documentation regarding, Data upload from Presentation server in background job.

Thanks and regards.

vijay.

Read only

Former Member
0 Likes
3,572

If you look at the help of OPEN DATASET, you will find the following paragraph.

<i>Notes

The system must be able to reach the file from the current application server. You cannot edit files from the current presentation server. If you need to do this, use the function modules GUI_DOWNLOAD and GUI_UPLOAD.</i>

Read only

0 Likes
3,572

Hi Srinivas,

Yes, He did say that the file has to be accessed from the application server. But nowhere he did mention wether it has to be an foreground or background process .

Regards,

Ben.

Read only

0 Likes
3,572

In order to access a file in backgroud task, the file must reside on the appliation server, and you must use the DATASET statements to access it.

Regards,

Rich Heilman

Read only

0 Likes
3,572

Hi Rich,

Can I use GUI_UPLOAD to transfer data from the presentation server to internal table and schedule the program in background ? Will that work or even this is also not posible ?

Regards,

Ben.

Read only

0 Likes
3,572

No, that will not work. It must run in the foreground. The background task knows nothing of the frontend, so how can it possibly know where to get the file?

Regards,

Rich Heilman

Read only

0 Likes
3,572

Hi,

Use GUI_UPLOAD to transfer data from the presentation server to internal table and then use OPEN DATASET to transfer the data from internal table to application server

Laxman

Read only

0 Likes
3,572

What is your exact requirement?

Regards,

Rich Heilman

Read only

0 Likes
3,572

Hi Rich,

My requirement is like this : I have very huge text file which contains some 50,000 records . I WANT TO UPLOAD THIS INTO AN INTERNAL TABLE. Since the file is of huge size I want the program to scheduled to background.

Also I just want to look at the documentation which exactly explains this concept . I tried a lot surfing through help.sap.com but couldn't figure out .

Thanks,

Ben.

Read only

0 Likes
3,572

> Hi Srinivas,

>

> Yes, He did say that the file has to be accessed

> from the application server. But nowhere he did

> mention wether it has to be an foreground or

> background process .

>

> Regards,

> Ben.

For that you have to refer to how background processing is done in SAP. Here is the

<a href="http://help.sap.com/saphelp_46c/helpdata/en/a4/709855505711d189550000e829fbbd/frameset.htm">link</a> to help on that. Look at 'Background Processing' in this link.

Read only

0 Likes
3,572

With the RFC way, things to remember are one, you can only do this from THE desktop, not any desktop. Second, the PC has to be available. That is why this route may not be suitable. A better way would be what Rich specified, upload the file, and then switch to background mode for the rest of the processing.

Read only

0 Likes
3,572

Srinivas, I was thinking of the same issues with the RFC solution, especially the first. I was thinking, if a lot of people have to run this application, then each machine would have to be worked on.

Regards,

Rich Heilman

Read only

Former Member
0 Likes
3,572

Hi Ben,

Mail sent to your ID.

Regards,

Ravi

Read only

0 Likes
3,572

All you need to do is put the "huge" file on the application server, then use the DATASET statements to read and process it. Do it like this, will work in both foreground, and background, but the file MUST be on the application server.

Regards

Rich Heilman

Read only

0 Likes
3,572

Daniel, Ravi, can one of you please send this documentation to my email address on my business card. Thanks.

Regards,

Rich Heilman

Read only

0 Likes
3,572

Hi Rich,

Sent.

Regards,

ravi

Read only

Read only

0 Likes
3,572

ahhh jeezzz. Of course, there is always a way to do anything, but come on. We are talking about straight ABAP here. Nothing more. That said, there is no way to do it with just ABAP.

Regards,

Rich Heilman

Read only

0 Likes
3,572

Hi,

Still Document is available. can you share it.

Read only

0 Likes
3,572

Hello,

While we're happy that you've come to SAP Community to get an answer to your question, you posted your question as an answer in an old thread. Posting in older threads is not the best way to get guidance.

If you're looking for help, you should ask a new question: https://answers.sap.com/questions/ask.html.

Best regards,
Anne

Read only

Former Member
0 Likes
3,572

Hi,

you can pass data from presentation server to internal table. you can use submit report via job statement to run program in background

Regards,

Sudhakar

Read only

0 Likes
3,572

That's right, but the program execution must be initiated by the frontend(gui). I have done a program where the user uploads the data into memory, then fires the program to the background, once in the background the data is retrieved from memory and process continues. Works quite well, but still the user needs to execute the transaction to point to the file on the frontend.

Regards,

Rich Heilman

Read only

0 Likes
3,572

To illistrate this solution a little.... here are two programs, the first will get the data from the PC and submit a background job which will process it.

The first program.



report zrich_0001.

data: iflatf type table of string.
data: xflatf type string.

* Used to limit user commands on selection-screen
include rsdbc1xx.

* Selection Screen
selection-screen begin of block b1 with frame title text-002 .
parameters: p_file type localfile default
            'C:Test.txt'.
selection-screen end of block b1.

* Events
at selection-screen output.
  append 'PRIN' to current_scr-excl.
  append 'SJOB' to current_scr-excl.

at selection-screen on value-request for p_file.
  call function 'KD_GET_FILENAME_ON_F4'
       exporting
            static    = 'X'
       changing
            file_name = p_file.

at selection-screen.

  data: filename type string.

  filename = p_file.
  clear iflatf. refresh iflatf..
  call method cl_gui_frontend_services=>gui_upload
         exporting
              filename                = filename
              filetype                = 'ASC'
         changing
              data_tab                = iflatf.

start-of-selection.


  export iflatf to shared buffer indx(st) id 'ZRICHTEST'.
  perform submit_job.
  message s001(00)
    with 'Job ZRICH_0002 has been scheduled and released'.


************************************************************************
*       FORM submit_job                                                *
************************************************************************
form submit_job.

  data:   l_valid,
          ls_params like pri_params,
          l_jobcount like tbtcjob-jobcount,
          l_jobname  like tbtcjob-jobname.

* Get Print Parameters
  call function 'GET_PRINT_PARAMETERS'
       exporting
            no_dialog      = 'X'
       importing
            valid          = l_valid
            out_parameters = ls_params.

  ls_params-primm = space.
  ls_params-prrel = space.
  ls_params-prnew = 'X'.

* Open Job
  concatenate sy-uname 'ZRICH_0002'
            into l_jobname separated by '-'.

  call function 'JOB_OPEN'
       exporting
            jobname  = l_jobname
       importing
            jobcount = l_jobcount.

* Submit report to job
  submit zrich_0002
            via job     l_jobname
                number  l_jobcount
            to sap-spool without spool dynpro
                      spool parameters ls_params
                      and return.

* Schedule and close job.
  call function 'JOB_CLOSE'
       exporting
            jobcount  = l_jobcount
            jobname   = l_jobname
            strtimmed = 'X'.

endform.

The second(submitted) program.



report zrich_0002 .

data: iflatf type table of string.
data: xflatf type string.

start-of-selection.

  import iflatf = iflatf
         from shared buffer indx(st) id 'ZRICHTEST'.
  delete from shared buffer indx(st) id 'ZRICHTEST'.

  loop at iflatf into xflatf.

    write:/ xflatf.
  endloop.


Regards,

Rich Heilman