cancel
Showing results for 
Search instead for 
Did you mean: 

.Net Connector and file transfer

Former Member
0 Kudos

Hi,

I have a question regarding the .net connector and the file handling.

I would like to use a rfc which saves a file from the pc into SPA Records Management.

The rfc has one parameter which takes the path to the file.

When I test this rfc in SAP GUI the document will be saved in SAP Records Management.

When I call this rfc using the .net connector the file won't be uploaded.

What do I have to pay attention to when I would like to use the .net connector to transfer a file to SAP?

Ortwin

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

What is the name of that RFC?

Thanks & Regards,

Govind.

Former Member
0 Kudos

We use a custom rfc (ZRM...) to call the SRM_DOCUMENT_CHECKIN_VIA_FILE to add documents to an archive in SAP Records management.

Excerpt:

+* Mimetype des Dokumentes ermitteln

  • Dateipfad und Namen splitten

CALL FUNCTION 'SO_SPLIT_FILE_AND_PATH'

EXPORTING

FULL_NAME = FILE_PATH

IMPORTING

STRIPPED_NAME = lv_doc

FILE_PATH = lv_path

EXCEPTIONS

X_ERROR = 1

OTHERS = 2.

  • Beschreibung des Dokumentes

lv_DESCRIPTION = lv_doc.

  • GUID für DOCID erzeugen

CALL FUNCTION 'GUID_CREATE'

IMPORTING

EV_GUID_16 = lv_guid.

lv_DOCUMENTID = lv_guid.

CALL FUNCTION 'SRM_DOCUMENT_CREATE'

EXPORTING

RMS_ID = con_rms_id

SPS_ID = lv_sps_id

DOCUMENTID = lv_DOCUMENTID

DESCRIPTION = lv_DESCRIPTION

  • DO_COMMIT =

IMPORTING

RETURN = ls_RETURN

OBJECTID = lv_OBJECTID

DOCUMENTCLASS = lv_DOCUMENTCLASS

EXCEPTIONS

INTERNAL_ERROR = 1

PARAMETER_ERROR = 2

DOC_ID_NOT_UNIQUE = 3

NOT_AUTHORIZED = 4

OTHERS = 5

.

IF SY-SUBRC <> 0.

  • Rückgabe Fehlermeldung

message = 'Es konnte kein Dokument angelegt werden!'.

message_type = 'E'.

ENDIF.

  • Dokument mit Inhalt füllen

SPLIT lv_doc AT '.' INTO lv_name lv_extension.

CALL FUNCTION 'SDOK_MIMETYPE_GET'

EXPORTING

EXTENSION = lv_extension

IMPORTING

MIMETYPE = lv_mimetype.

  • File_Tab füllen

ls_filetab-COMP_COUNT = '0'.

ls_filetab-COMP_ID = lv_doc.

ls_filetab-DIRECTORY = lv_path.

ls_filetab-FILENAME = lv_doc.

ls_filetab-MIMETYPE = lv_mimetype.

append ls_filetab to lt_filetab.

clear ls_filetab.

CALL FUNCTION 'SRM_DOCUMENT_CHECKIN_VIA_FILE'

EXPORTING

OBJECTID = lv_OBJECTID

DOCUMENTCLASS = lv_DOCUMENTCLASS

DO_COMMIT = 'X'

IMPORTING

RETURN = ls_return

TABLES

FILE_TAB = lt_filetab

EXCEPTIONS

INTERNAL_ERROR = 1

PARAMETER_ERROR = 2

NOT_AUTHORIZED = 3

DOC_NOT_FOUND = 4

YET_LOCKED = 5

VERSION_NOT_FOUND = 6

VARIANT_NOT_FOUND = 7

YET_CHECKED_OUT = 8

YET_CLOSED = 9

OTHERS = 10.+

I am not an ABAP specialist, the rfc was written by a college of mine.

Regards

Ortwin

reiner_hille-doering
Active Contributor
0 Kudos

I assume that one of the used functions internally uses SAPGUI to do the file transfer. This would require SAPGUI to be installed on the client PC and having "USE_SAPGUI" on the connection string (SAPGui property at Destination).

Former Member
0 Kudos

Thanks, now it works as expected.

Ortwin

reiner_hille-doering
Active Contributor
0 Kudos

Please reward some points of my answer solved the problem.

Thanks,

Reiner.

Answers (0)