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: 

Data upload from Notepad every 2 secs (other than GUI_UPLOAD or UPLOAD FM)

Former Member
0 Kudos

Hi friends,

I have to upload small amount of data(like 4 digit number) from a notepad file from presentation server(desktop) to SAP standard program.

I cannot use GUI_UPLOAD or UPLOAD as this uploading will be done once in a second so the performance would hampered.

I wanted to know is there any other way to upload from desktop other than these FM.The data in the notepad would continuously be updated with some new data and I wanted to upload the modified data at every 2 seconds.The data is very small and it can reside even in a variable.

Since this would be a continuous upload,FM would not be a good idea.

Kindly suggest something.

Thanks,

Anil.

15 REPLIES 15

Former Member
0 Kudos

Hi,

Just an idea... perhaps you could use some external OS command to do that... and use it through SM69.

Not sure this would be more efficient however.

Kr,

Manu.

0 Kudos

Hi Manu,

But still the time taken to read the data from file will be same and more server level code for creating the command will be required

My iidea is to overwrite the existing file with new data or create different files with the filename ( concatenating the time stamp or whichever differentiates the files ) and dynamically create the file name in the program based on the time stamp or any other values and use the same fm's to read the new file.

Kesav

0 Kudos

Hi Kesav,

But still the time taken to read the data from file will be same and more server level code for creating the command will be required

You're probably right... but I never tested this tough...

My iidea is to overwrite the existing file with new data ...

and use the same fm's to read the new file

I guess this is already the case, no? Or am I miss something?

Kr,

Manu.

0 Kudos

Hi Keshav,

Are you giving a solution or explaining Manu because I was into able to understand any solution from your explanation.

Already the existing file is getting overwritten with new values.

Kindly suggest some solution.

Anil.

Edited by: anilsagrawal on Nov 22, 2011 1:10 PM

0 Kudos

Hi,

The time limit 1 to 2 second is very less ...You can extend it to atleast 10 minutes , don't overwrite it because your previous data will not be recovered, instead create separate files for new data and use it.

@Manu - Did not notice it

Kesav

0 Kudos

Hi Manu,

I can't.Thats the requirment. The file has to be refreshed with new data every 2 seconds and I dont want to create new file only one file should be used at a specific location on Computer.

Anil.

0 Kudos

Hi,

Have a look at [Opening a File at a Given Position|http://help.sap.com/saphelp_470/helpdata/en/fc/eb3cf4358411d1829f0000e829fbfe/content.htm].

Its in application not in presentation server. Only thing is you have to maintain the latest position.

0 Kudos

Hi All,

Has anybody got any solution for the problem.

Nothing seems to be working with above solutions.

Anil.

0 Kudos

Hi

Check this program. Only thing is both the programs must keep track of the latest position in memory. If the program which writes the data to file is a third party program the this is not possible.

I dont know why you execute your programs in presentation server because i think your programs will be a scheduled job.


DATA fname(60) VALUE '\DIR_SAPUSERS\MYFILE.TXT'.

DATA num TYPE i.
DATA: read TYPE i.
DATA:out TYPE c.
num = 1.

DO 500 TIMES.
  read = num.
"Assume this as your prg which writes data
  OPEN DATASET fname FOR OUTPUT IN TEXT MODE
   AT POSITION num.
  IF sy-subrc = 0.
    num = num + 1.
    WRITE:'Latest data written is',num.
    TRANSFER num TO fname.
    CLOSE DATASET fname.
  ENDIF.
"Assume this as your prg which reads data
  OPEN DATASET fname FOR INPUT IN TEXT MODE AT POSITION read.
  IF sy-subrc = 0.
    READ DATASET fname INTO out.
    WRITE:/ 'Latest data read is',num.
    CLOSE DATASET fname.
  ENDIF.
  skip 1.
ENDDO.

DELETE DATASET fname.

0 Kudos

Hi,

I tried the above method but that doesn't work.

sy-subrc is set to 8 when I try to open path on presentation server by OPEN DATASET.

Any other suggestions.

Anil.

0 Kudos

sy-subrc is set to 8 when I try to open path on presentation server by OPEN DATASET.

I have clearly mentioned its application server.

Kesav

0 Kudos

Hi,

But my need is upload from presentation server not application server.

Anil.

0 Kudos

But my need is upload from presentation server not application server.

Presentation server doesnt make any sense here. You say that your program must read the data every 2 seconds from the file.So how are they going to execute the reading program. In foreground how are you going to schedule it to work for every 2 seconds. Please think.

Kesav

0 Kudos

Who/what is chaning the data in the notepad?

0 Kudos

Hi,

There is an interface with weighing machine in which each time a new stock is loaded the qty which appears on weighing scale get updated in the notepad and the stock is put on weighing scale through automated loader.Therefore the speed is so high.I need to capture that value in one variable in one of the standard transactions.So I have identified the exit where I can do this. But the issue is the speed.

I hope I have explained you the details.

Anil.