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

BAPI Issue

Former Member
0 Likes
1,050

We have a setup wherin an external system( C++ Program running on UNIX) makes a remote call to BAPI_DOCUMENT_CHECKOUTVIEW2 on a dev server(Windows) to get the file originals from DMS vault to a target path. We are able to copy the file to a windows target filepath like //servername/ex/out/ , but it does not work if the target path is unix. Any input is highly appreciated.

Thanks,

Rohit

1 ACCEPTED SOLUTION
Read only

MarcelloUrbani
Active Contributor
0 Likes
1,014

This looks more a file access issue than a BAPI issue.

You should consider two factors:

1) unix paths usually looks something like //servername/ex/out/ , while windows paths looks like
servername\ex\out\

2) unless you have a very strange setup, windows uses the SMB protocol to access remote files, while unix usually use NFS ( or perhaps CODA 😞 to access the same file from both you usually have to either install ad SMB client on the unix machine, or an NFS client on the windows machine, or two different file servicing protocols on the remote host.Anyway it's not trivial, also because of the user authentication issues.

You definitely need a skilled unix/windows system administrator to get this sorted out. It has very little to do with SAP.

[edit]ftp could be an easier workaround, I didn't think about it before[/edit]

Message was edited by:

Marcello Urbani

8 REPLIES 8
Read only

Former Member
0 Likes
1,014

For unix system file path should be like
servername\ex\out\

rather than //servername/ex/out/

I hope this will help you.

Regards,

Amey

Read only

Former Member
0 Likes
1,014

Hello,

have yoy checked permissions?

Ask your basis if the folder has permissions for reading and writing.

hope this helps

Gabriel

Read only

0 Likes
1,014

Hey gabriel and ameya,

I have checked the permissions. they are 777 for that folder(read write and execute for everyone). I am not sure how can we ftp to a unix server without username and password. the standard bapi has no input parameter for username password.

Thanks for your help.

i have also tried
servername\ex\out\ it does not work

Rohit

Read only

0 Likes
1,014

Hello again,

there is a FM for uploading data using the ftp server.

Check this fm: FTP_SERVER_TO_R3 or To FTP using ABAP, you can have a look at the standard program 'RSEPSFTP'.

Check this code I found on the sdn.

-


*

  • SAP FTP functions

*

  • This sample program will logged into your Unix Server.

*

  • Issue a Unix dir command

*

  • Store the dir information in the Internal table and display it.

  • Make sure you can telnet in to your SAP-UNIX FTP server first.

*

*

REPORT ZFTPSAP LINE-SIZE 132.

DATA: BEGIN OF MTAB_DATA OCCURS 0,

LINE(132) TYPE C,

END OF MTAB_DATA.

DATA: MC_PASSWORD(20) TYPE C,

MI_KEY TYPE I VALUE 26101957,

MI_PWD_LEN TYPE I,

MI_HANDLE TYPE I.

START-OF-SELECTION.

*-- Your SAP-UNIX FTP password (case sensitive)

MC_PASSWORD = 'password'.

DESCRIBE FIELD MC_PASSWORD LENGTH MI_PWD_LEN.

*-- FTP_CONNECT requires an encrypted password to work

CALL 'AB_RFC_X_SCRAMBLE_STRING'

ID 'SOURCE' FIELD MC_PASSWORD ID 'KEY' FIELD MI_KEY

ID 'SCR' FIELD 'X' ID 'DESTINATION' FIELD MC_PASSWORD

ID 'DSTLEN' FIELD MI_PWD_LEN.

CALL FUNCTION 'FTP_CONNECT'

EXPORTING

*-- Your SAP-UNIX FTP user name (case sensitive)

USER = 'userid'

PASSWORD = MC_PASSWORD

*-- Your SAP-UNIX server host name (case sensitive)

HOST = 'unix-host'

RFC_DESTINATION = 'SAPFTP'

IMPORTING

HANDLE = MI_HANDLE

EXCEPTIONS

NOT_CONNECTED = 1

OTHERS = 2.

CHECK SY-SUBRC = 0.

CALL FUNCTION 'FTP_COMMAND'

EXPORTING

HANDLE = MI_HANDLE

COMMAND = 'dir'

TABLES

DATA = MTAB_DATA

EXCEPTIONS

TCPIP_ERROR = 1

COMMAND_ERROR = 2

DATA_ERROR = 3

OTHERS = 4.

IF SY-SUBRC = 0.

LOOP AT MTAB_DATA.

WRITE: / MTAB_DATA.

ENDLOOP.

ELSE.

  • do some error checking.

WRITE: / 'Error in FTP Command'.

ENDIF.

CALL FUNCTION 'FTP_DISCONNECT'

EXPORTING

HANDLE = MI_HANDLE

EXCEPTIONS

OTHERS = 1.

Hope this helps

gabriel

Read only

0 Likes
1,014

Thank you for your help again.

I am aware of the function modules to FTP to the unix server, but my first priority is to use the standard bapi and not make a custom one. the standard bapi ftp's the files to the windows fileshare, so i thought SAP might have made included the code in the standard bapi to ftp to an unix server as well. I feel that the bapi(BAPI_DOCUMENT_CHECKOUTVIEW2) might be able to do that, and only that i am not able to achieve it.

Thanks ,

Rohit

Read only

MarcelloUrbani
Active Contributor
0 Likes
1,015

This looks more a file access issue than a BAPI issue.

You should consider two factors:

1) unix paths usually looks something like //servername/ex/out/ , while windows paths looks like
servername\ex\out\

2) unless you have a very strange setup, windows uses the SMB protocol to access remote files, while unix usually use NFS ( or perhaps CODA 😞 to access the same file from both you usually have to either install ad SMB client on the unix machine, or an NFS client on the windows machine, or two different file servicing protocols on the remote host.Anyway it's not trivial, also because of the user authentication issues.

You definitely need a skilled unix/windows system administrator to get this sorted out. It has very little to do with SAP.

[edit]ftp could be an easier workaround, I didn't think about it before[/edit]

Message was edited by:

Marcello Urbani

Read only

0 Likes
1,014

hey marcello,

we are trying to use FTP. And the setup is not that complicated: A C++ application running on UNIX server remotely calls the BAPI on an windows SAP system. We are just missing something somewhere.

Thanks for your help

Rohit

Read only

0 Likes
1,014

I think I'm missing something: are you trying to have a windows FTP server writing on a remote unix machine?

If so, I think the paths should be in windows form, but you need the networking services sorted right.

Message was edited by:

Marcello Urbani