Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 9069

Cannot open PDF, Word 2010, or XLS files stored in DMS.

$
0
0

Hi Experts,

I have been working on a program to open a DMS file using a .net access. When I create a new attachment for lets say a purchases order and save the attachment as a pdf, the file save ok. But when I try and execute my program I get a dump.  Below is the short dump info and the program code. Any help would be appreciated. I understand that the dump is because of a assignment problem but i don't understand why it is not assigned. I am using window 8.1 and Microsoft Office 2010, Adobe Xl.


METHOD if_http_extension~handle_request.

 

   DATA:

     lr_request      TYPE REF TO if_http_request,

     lr_response     TYPE REF TO if_http_response,

     lv_value        TYPE string,

     lv_data         TYPE xstring,

     ls_draw         TYPE draw,

     ls_checkout_def TYPE dms_checkout_def,

     ls_doc_file     TYPE dms_doc_file,

     ls_phio         TYPE dms_phio,

     ls_file         TYPE cvapi_doc_file,

     lt_files        TYPE TABLE OF cvapi_doc_file,

     lt_content      TYPE TABLE OF drao,

     lv_frontend     TYPE dms_frontend_data" Frontend information

     v_frontend      TYPE dms_frontend_data.

 

 

   CONSTANTS : c_hostname TYPE ntadr VALUE 'DEFAULT', "Hostname

               c_type TYPE typdt VALUE 'PC', "Type

               c_system TYPE char4 VALUE 'WN64'. "System

 

   v_frontend-frontend_type = c_type.     "'PC'.

   v_frontend-hostname      = c_hostname. "'DEFAULT'.

   v_frontend-winsys        = c_system.   "'WN32'.

   v_frontend-platform      = 0.

   v_frontend-frontend_type = 'KP'.

 

 

   FIELD-SYMBOLS <fs_content> TYPE drao.

 

* 1.

   lr_request  = server->request.

   lr_response = server->response.

 

 

   IF lr_request->get_method( ) EQ 'GET'.

*   2.

*   Retrieve document key

     lv_value = lr_request->get_form_field( 'type' ).

     ls_draw-dokar = lv_value.

     lv_value = lr_request->get_form_field( 'number' ).

     ls_draw-doknr = lv_value.

     lv_value = lr_request->get_form_field( 'version' ).

     ls_draw-dokvr = lv_value.

     lv_value = lr_request->get_form_field( 'part' ).

     ls_draw-doktl = lv_value.

 

 

 

*   Retrieve document key

*    lv_value = lr_request->get_header_field( name = '~PATH_INFO' ).

*    SPLIT lv_value AT '/' INTO lv_value

*      ls_draw-dokar ls_draw-doknr ls_draw-dokvr ls_draw-doktl.

 

*   3.

*   Check document existence and read details

     CALL FUNCTION 'CVAPI_DOC_GETDETAIL'

       EXPORTING

*         PF_BATCHMODE          = ' '

*         PF_HOSTNAME           = ' '

 

          pf_dokar              = ls_draw-dokar

          pf_doknr              = ls_draw-doknr

          pf_dokvr              = ls_draw-dokvr

          pf_doktl              = ls_draw-doktl

*         pf_read_drad          = 'X'

*         pf_read_drap          = 'X'

*         pf_active_files       = 'X'

          pf_read_comp          = 'X'

          pf_read_kpro          = 'X'

          pf_read_drat          = 'X'

       IMPORTING

         psx_draw  = ls_draw

       TABLES

         pt_files  = lt_files

       EXCEPTIONS

         not_found = 1

         OTHERS    = 2.

     IF sy-subrc NE 0.

*     Put the error in the response

       MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

         WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4 INTO lv_value.

       lr_response->set_cdata( lv_value ).

       lr_response->set_status( code = 400 reason = 'Document not found!' ).

       EXIT.

     ENDIF.

 

*   4.

*   Convert file information

     READ TABLE lt_files INTO ls_file INDEX 1.

     MOVE-CORRESPONDING ls_file TO: ls_doc_file, ls_phio.

 

*   Checkout document

     SELECT SINGLE kpro_use FROM tdwa INTO ls_checkout_def-kpro_use

       WHERE dokar EQ ls_draw-dokar.

 

     ls_checkout_def-comp_get = 'X'.

     ls_checkout_def-content_provide = 'TBL'.

 

     CALL FUNCTION 'CV120_DOC_CHECKOUT_VIEW'

       EXPORTING

         ps_cout_def = ls_checkout_def

         ps_doc_file = ls_doc_file

         ps_draw     = ls_draw

         ps_phio     = ls_phio

         ps_frontend = v_frontend

         pf_std_url  = 'X'

       TABLES

         ptx_content = lt_content

       EXCEPTIONS

         error       = 1

         OTHERS      = 2.

     IF sy-subrc NE 0.

*     Put the error in the response

       MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

         WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4 INTO lv_value.

       lr_response->set_cdata( lv_value ).

       lr_response->set_status( code = 400 reason = 'Failed to read document!' ).

       EXIT.

     ENDIF.

 

*   5.

*   Put document content in response

     LOOP AT lt_content ASSIGNING <fs_content>.

       CONCATENATE lv_data <fs_content>-orblk INTO lv_data IN BYTE MODE.

     ENDLOOP.

     lv_data = lv_data(<fs_content>-orln).

     lr_response->set_data( lv_data ).

     lr_response->set_status( code = 200 reason = '' ).

*   6.

*   Set MIME type

     SELECT SINGLE mimetype FROM tdwp INTO lv_value

       WHERE dappl EQ ls_file-dappl.

     IF sy-subrc EQ 0.

       lr_response->set_header_field( name = 'Content-Type' value = lv_value ).

     ENDIF.

   ENDIF.

 

 

 

ENDMETHOD.

 

 

The Dump...

 

Runtime Errors         GETWA_NOT_ASSIGNED

Date and Time          18.08.2014 11:03:34

 

Error analysis

     You attempted to access an unassigned field symbol

     (data segment "-1").

 

 

     This error may occur if

     - You address a typed field symbol before it has been set with

       ASSIGN

     - You address a field symbol that pointed to the line of an

       internal table that was deleted

     - You address a field symbol that was previously reset using

       UNASSIGN or that pointed to a local field that no

       longer exists

     - You address a global function interface, although the

       respective function module is not active - that is, is

       not in the list of active calls. The list of active calls

       can be taken from this short dump.


Viewing all articles
Browse latest Browse all 9069

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>