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

File ID to XString

Former Member
0 Likes
2,174

Experts,

I have requirement as below,

- File(XLS or TXT) is uploaded in DMS via CV01N Tcode. This generates a File ID which looks like GUID value( For e.g. 4CABF0266C031140E10000000AA80C83)

- In a different application after file upload, i need to display the files checked in CV01N. For this, i need file data in XSTRING format.

I have file id & file path in hand. Say i want to use GUI_UPLOAD FM by passing file path to get binary data of file & later convert it to XSTRING using SCMS_BINARY_TO_XSTRING FM - In this case, challenge comes if the file no more exists in file path.

Even if user uploaded the file to CV01N & deleted it, i still want to access the XSTRING of this file at a later point.

Please share your valuable inputs.

BR,

Aspire

Experts,

I have requirement as below,

- File(XLS or TXT) is uploaded in DMS via CV01N Tcode. This generates a File ID which looks like GUID value( For e.g. 4CABF0266C031140E10000000AA80C83)

- In a different application after file upload, i need to display the files checked in CV01N. For this, i need file data in XSTRING format.

I have file id & file path in hand. Say i want to use GUI_UPLOAD FM by passing file path to get binary data of file & later convert it to XSTRING using SCMS_BINARY_TO_XSTRING FM - In this case, challenge comes if the file no more exists in file path.

Even if user uploaded the file to CV01N & deleted it, i still want to access the XSTRING of this file at a later point.

Please share your valuable inputs.

BR,

Aspire

1 REPLY 1
Read only

Former Member
0 Likes
1,027

Hi Aspire,

I'm not quite following your requirement, so your user uploads a file (xls or txt) into DMS. You then want to view that file yourself or are you wanting a program to use this file?

If so then there are a couple of FM's you can use in the following order to access dms and retrieve the xstring.

  1. BAPI_DOCUMENT_GETDETAIL2
    • This FM gets the details of the file information and uses the following dms values, Document type, document number, document part and document version to look up the file(s) information
  2. BAPI_DOCUMENT_CHECKOUTVIEW2 &  BAPI_TRANSACTION_COMMIT
    • Good practice to ensure nobody changes the dms document while your reading/viewing it
  3. SCMS_DOC_READ
    • This FM retrieve file information and content and stores it in a ITAB
  4. SCMS_BINARY_TO_XSTRING
    • Using the output of the previous FM this is what will generate the xstring that can be used.

Now the only issue or challenge i see with what your trying to do is in the case where users delete the file, the content will no longer be available in DMS and thus not available to be turned into xstring so if your wanting to save thsi information permanently you will need to have code in place to save the xstring info in a custom table before dms clears it when it is uploaded.

Hope this is along the lines of what your looking for,

Geoffery