cancel
Showing results for 
Search instead for 
Did you mean: 

FM to read a Document from DMS - Urgent

Former Member
0 Kudos

Hi experts,

I want to read the document stored in a DMS server and have to convert it to PDF and download to the user desktop. Do u ppl have any idea about the Function module used to read the document and populate the Document content as a XSTRING value?

Please help me, i have to develop a application based on this....

Thanks,

James...

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi

Chec these FM's may be help full...

BAPI_DOCUMENT_CHECKOUTVIEWX

BAPI_DOCUMENT_CHECKIN2

BAPI_DOCUMENT_CHECKIN

BAPI_DOCUMENT_CHECKOUTVIEW2

Fyi,

Functionality

This function module makes it possible to display several documents at once.

You have two possbilities:

You can list documents in the table Documents and in enter in the workstation applications in the table WSApplication that more clearly identify the originals.

The data of the documents is read. The first original found is checked out that has the same workstation application as a workstation application in the table WSApplication .

You can olso enter originals directly in the table DocumentFiles .

Restrictions:

Additional files are not supported.

Example

DATA: lt_documentdata LIKE bapi_doc_draw2 OCCURS 0 WITH HEADER LINE,

lt_documentfiles_in LIKE bapi_doc_files2 OCCURS 0 WITH HEADER LINE,

lt_documentfiles_out LIKE bapi_doc_files2 OCCURS 0 WITH HEADER LINE,

lt_wsapplication LIKE bapi_doc_files2 OCCURS 0 WITH HEADER LINE,

DATA: return LIKE bapiret2.

CLEAR lt_documentdata.

REFRESH lt_documentdata.

(a)

lt_documentdata-documentnumber = 'dd01'.

lt_documentdata-documenttype = 'drw'.

lt_documentdata-documentversion = '00'.

lt_documentdata-documentpart = '000'.

APPEND lt_documentdata.

lt_documentdata-documentnumber = 'dd01'.

lt_documentdata-documenttype = 'drw'.

lt_documentdata-documentversion = '01'.

lt_documentdata-documentpart = '000'.

APPEND lt_documentdata.

lt_documentdata-documentnumber = 'dd01'.

lt_documentdata-documenttype = 'drw'.

lt_documentdata-documentversion = '02'.

lt_documentdata-documentpart = '000'.

APPEND lt_documentdata.

CLEAR lt_wsapplication.

REFRESH lt_wsapplication.

lt_wsapplication-wsappl = 'ASM'.

APPEND lt_wsapplication.

lt_wsapplication-wsappl = 'PRT'.

APPEND lt_wsapplication.

CLEAR: lt_documentfiles_out.

REFRESH: lt_documentfiles_out.

CALL FUNCTION 'BAPI_DOCUMENT_CHECKOUTVIEWX'

EXPORTING

getcomponents = '1'

originalpath = 'C:\TEMP\trash\'

hostname = ' '

IMPORTING

return = return

TABLES

documents = lt_documentdata

documentfiles_out = lt_documentfiles_out

wsapplication = lt_wsapplication.

prakash

Former Member
0 Kudos

Thanks Prakash for ur reply. But actually i want to read the content of the document into XSTRING, can u help on this...

Thanks,

James

Former Member
0 Kudos

Hi

Try linking the below FM for Create XSTRING xml doc

SMUM_XML_CREATE_X

prakash

Former Member
0 Kudos

Hi

Try this FM

Convert unicode to non-unicode codepage

Functionality

Function module HR_JP_CONV_UNI_STR_TO_CP_XSTR converts Unicode string to xstring in specified codepage.

Example

data: string_stream type string,

xstring_stream type xstring.

string_stream = 'Hello world!'.

call function 'HR_JP_CONV_UNI_STR_TO_CP_XSTR'

exporting

iv_codepage_to = 8000

iv_unicode_string = string_stream

importing

ev_xstring_stream = xstring_stream

exceptions

invalid_codepage = 1

no_data_to_covert = 2

others = 3.

Notes

Further Information

Parameters

EV_XSTRING_STREAM

IV_CODEPAGE_TO

IV_UNICODE_STRING

Exceptions

NO_DATA_TO_COVERT

INVALID_CODEPAGE

Prakash

Former Member
0 Kudos

Hi

or use the following FM for Converting internal table to xstring in codepage

HR_JP_CONV_TAB_TO_CP_XSTR

Prakash