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: 

Archive link doc from TCODE OAOH

Former Member
0 Kudos
675

Dear all,

I'm performing mass upload of files to FI doc by using FM ARCHIV_CREATE_FILE (FYI manual upload can be done via TCode OAOH).

But the FM is only able to attach those files from Frontend (presentation server), but can't upload those file that located at application server. FM returned error msg : No such file or directory.

Below is my code:


CALL FUNCTION 'ARCHIV_CREATE_FILE'
  EXPORTING
    AR_OBJECT  = 'ZMM000007'
    OBJECT_ID  = 'CN0116000014002008'
    SAP_OBJECT = 'Y999BKPF'
    DOC_TYPE   = 'TXT'
    PATH       = '/tmp/test.txt'

Bear in mind, file test.txt is currently exist in directory /tmp at application server.

Please comment if the above FM is not able to upload file from apps server and what are the alternative that i have to achieve my objective.

Thanks in advance.

9 REPLIES 9

Former Member
0 Kudos
117

Hi FSCHU

Try creating a logical file name using transaction FILE, pass the same for the FM and check how does the FM react.

Kind Regards

Eswar

0 Kudos
117

Hi Eswar,

Thanks for your prompt reply. May i know how to setup Logical File Name via Tcode FILE ?

Since i do not have experience on it, could you please guide me?

Thanks in advance.

0 Kudos
117

Steps to create logical path using transaction FILE:

1. Transaction FILE.

2. Click on New Entries.

3. Give Logical File Path Name and Description.

4. Select the entry and double click on node "Assign Physical Path..."

5. Click on New Entries.

6. Populate Details as "UNIX" for Syntax Group and Physical Path name with the desired path.

Note the filename should be as place holder <FILENAME>.

>Eg: /tmp/<FILENAME>

Regards

Eswar

0 Kudos
117

Hi Eswar,

Thanks again for your reply.

I did checked on my system, there is Logical file path TMP existing in the system. And under the syntax group Unix , there is /tmp/<FILENAME> assigned as physical path.

I assume that i still passing same file /tmp/avslBA3.txt to FM, but it is still not working. Please comment which part has went wrong.

Thanks in advance.

0 Kudos
117

Hey guys, do you have any ideas for the above issue?

Thanks in advance.

Former Member
0 Kudos
117

hi

good

check this code which can help you to upload data from the application server.

Retrieve Data file from Application server(Upload from Unix)

DATA: i_file like rlgrap-filename value '/usr/sap/tmp/file.txt'.

OPEN DATASET i_file FOR INPUT IN TEXT MODE.

IF sy-subrc NE 0.

MESSAGE e999(za) WITH 'Error opening file' i_file.

ENDIF.

DO.

  • Reads each line of file individually

READ DATASET i_file INTO wa_datatab.

  • Perform processing here

  • .....

ENDDO.

thanks

mrutyun^

Former Member
0 Kudos
117

Hi,

you must use the absolute path: /usr/sap/.../tmp/test.txt (see transaction al11)

it works.

regards

Former Member
0 Kudos
117

I got a similar error CMS 049 (No such file or directory) when running the FM ARCHIV_CREATE_FILE in ECC6.0. However, this same FM worked fine in 4.6C.

0 Kudos
117

Hi Bac,

Thanks for your reply, however I'm still not able to generate the archive link if program execute in background. Could you please post me some sample code?

Thanks in advance.