cancel
Showing results for 
Search instead for 
Did you mean: 

Very Urgent Convert DMS document to XSTRING/ download

Former Member
0 Kudos

Hi all,

I want to convert documnets in DMS like PDF into XSTRING. Is their any FM to do this.

Or any FM for displaying PDF document in dms with in web dynpro application

kindly Help...

- R K

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi prakash Uddagatti ,

I checked that function modules but i cant understand how to proceed with it.can u elaborate ur process.

My need is to open the DMS Document in web dynpro. I tried CV120_Start_application in se 36 it worked fine but in web dynpro it showed error "saying GUI is not supportedt o load the document"

Kindly help.

RK

Former Member
0 Kudos

Hi RK,

I just gave u the FM's which might have been usefull to u.

i dont know how ur system is...but the error seems to be something related to SAP.

I think best way is to find if any OSS notes exist for the error.

prakash

christoph_hopf
Advisor
Advisor
0 Kudos

Hi all,

please check if the FM CV120_START_APPLICATION is remote-enabled. Otherwise the call of it will require a running SAPGUI.

For background processing API function module would be more flexible. Please see SAP note 504692 for some sample programms to handle documents with

API function modules.

Best regards,

Christoph

Former Member
0 Kudos

Hi,

Here is a sample code for extracting the content of a DIR into a bniary table type SOLIX_TAB. I used it to send the file thru a mail .


*** Data Definition
  DATA : v_cout         TYPE dms_checkout_def,
         v_dttrg        TYPE dttrg, "Name of data carrier
         v_docfile      TYPE dms_doc_file,
         v_dappl        TYPE dappl, "Application
         v_tabix        TYPE i ,
         v_tdwa         TYPE tdwa ,
         v_phio         TYPE dms_phio,
         v_frontend     TYPE dms_frontend_data,
         v_exception    TYPE REF TO cx_root.
*
**
*** Internal Table Definition
  DATA : t_drao  TYPE STANDARD TABLE OF drao,
         t_kpro  TYPE dms_tbl_file ,
         t_hexa TYPE solix_tab.
**
*** Constants
  CONSTANTS : c_hostname TYPE ntadr VALUE 'DEFAULT', "Hostname
              c_type TYPE typdt VALUE 'PC', "Type
              c_system TYPE char4 VALUE 'WN32'. "System
**
*** field-symblos
  FIELD-SYMBOLS : <kpro>   TYPE LINE OF dms_tbl_file,
                  <phio>   TYPE LINE OF dms_tbl_phio .


  TRY.
      CHECK NOT fid IS INITIAL.
      CLEAR : v_tdwa .
      v_frontend-frontend_type = c_type. "'PC'.
      v_frontend-hostname      = c_hostname. "'DEFAULT'.
      v_frontend-winsys        = c_system.                  "'WN32'.
      v_frontend-platform      = 0.
      v_cout-comp_get          = abap_true.
      v_cout-batchmode         = abap_true.
      v_cout-content_provide   = 'TBL'.

* Checkif for FID Type KPRO is used
      CALL FUNCTION 'CV200_DB_TDWA_SELECT'
        EXPORTING
          pf_dokar  = fid-dokar
        IMPORTING
          psx_tdwa  = v_tdwa
        EXCEPTIONS
          not_found = 1.

      check sy-subrc eq 0.
          v_cout-kpro_use          = v_tdwa-kpro_use.

          CASE v_tdwa-kpro_use.
            WHEN abap_true.
* Kpro is used
* retrieve FID Master Data
              FREE t_kpro.
              CALL FUNCTION 'CV120_KPRO_MASTER_DATA_GET'
                EXPORTING
                  pf_dokar  = fid-dokar
                  pf_doknr  = fid-doknr
                  pf_dokvr  = fid-dokvr
                  pf_doktl  = fid-doktl
                TABLES
                  ptx_data  = t_kpro
                EXCEPTIONS
                  not_found = 1
                  error     = 2.
              check sy-subrc eq 0.
                WHEN 0.

                  v_frontend-frontend_type = 'KP'.

                  LOOP AT t_kpro ASSIGNING <kpro>.
                    FREE t_drao.
                    LOOP AT <kpro>-tbl_phios ASSIGNING <phio>.
                      MOVE-CORRESPONDING <phio> TO v_phio.

                      CALL FUNCTION 'CV120_DOC_CHECKOUT_VIEW'
                        EXPORTING
                          ps_cout_def = v_cout
                          ps_doc_file = v_docfile
                          ps_draw     = fid
                          ps_phio     = v_phio
                          ps_frontend = v_frontend
                        TABLES
                          ptx_content = t_drao
                        EXCEPTIONS
                          error       = 1.
                      check sy-subrc eq 0.
                          t_hexa =
                   zwpucl002=>transform_fid_to_binary( drao = t_drao ).
                    ENDLOOP.
                  ENDLOOP.

            WHEN abap_false.
              DO 2 TIMES.
                CLEAR : v_docfile .

                FREE : t_drao.

                v_tabix = sy-index.

                v_docfile-fileno = v_tabix.

                CASE v_tabix.
                  WHEN 1.
                    v_dappl = fid-dappl.
                    v_dttrg = fid-dttrg.
                  WHEN 2.
                    v_dappl = fid-dappl1.
                    v_dttrg = fid-dttrg1.
                ENDCASE.

                v_docfile-dappl = v_dappl.
                v_docfile-dttrg = v_dttrg.

                CALL FUNCTION 'CV120_DOC_CHECKOUT'
                  EXPORTING
                    ps_cout_def = v_cout
                    ps_draw     = fid
                    ps_doc_file = v_docfile
                  TABLES
                    ptx_drao    = t_drao
                  EXCEPTIONS
                    error       = 1
                    OTHERS      = 2.
               check sy-subrc eq 0.
                    t_hexa =
                    zwpucl002=>transform_fid_to_binary( drao = t_drao ).
              ENDDO.
          ENDCASE.
  ENDTRY.

Here is the code for transforming the content into SOLIX_TAB.

*** Field-Symbols definition

  FIELD-SYMBOLS : <drao>   TYPE drao ,
                  <source> TYPE x ,
                  <dest>   TYPE x,
                  <hexa>   TYPE solix .

** Data Definition
  DATA :   v_filelong     TYPE i ,
           v_long         TYPE i,
           v_longdes      TYPE i  .

  FREE binary_table.

  CHECK drao[] IS NOT INITIAL.
* Conversion du document en binaire
  LOOP AT drao ASSIGNING <drao>.
    IF v_filelong IS INITIAL.
      v_filelong = <drao>-orln.
    ENDIF.
    ASSIGN <drao>-orblk TO <source>.
    DESCRIBE FIELD <source> LENGTH v_long IN BYTE MODE.
    CLEAR v_longdes.

    WHILE v_long GT 0.
      ASSIGN <source>+v_longdes(v_long) TO <source>.
      APPEND INITIAL LINE TO binary_table ASSIGNING <hexa>.
      ASSIGN <hexa>-line TO <dest>.
      DESCRIBE FIELD <dest> LENGTH v_longdes IN BYTE MODE.

      MOVE <source> TO <dest>.
      v_filelong = v_filelong - v_longdes.
      v_long = v_long - v_longdes.
      CHECK v_filelong LE v_longdes.
      IF v_long NE 0.
        v_long = v_filelong.
      ENDIF.
      CHECK v_long LE 0.
      v_long = 0.
    ENDWHILE.
  ENDLOOP.

Then you have to code the trnasformation of the SOLIX table into an XSTRING ( i don't know if there's something in standard for this ).

Hope this help you.

regards

Former Member
0 Kudos

Thanks prakash Uddagatti,

I am able to download the document using BAPI_DOCUMENT_CHECKOUTVIEWX. where i can see the downloaded document on the location specified in original path.

But i want to open or convert this document into Xstring format. <b>My need is to open this DMS document in Webdynpro abap. </b>

Kindly help me...

-RK

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

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