Quantcast
Channel: ABAP Development
Viewing all articles
Browse latest Browse all 948

Displaying a DMS PDF Document in Web Dynpro

$
0
0

Purpose

 

The plain technical requirement is that a PDF document is stored in SAP needs to be displayed as a Pop-up to the portal user.

 

Details

 

Earlier, I used to use SAP GUI for HTML and call the 'DOCUMENT_SHOW_DIRECT' in a wrapper program with submit.

 

But here is a better way.

 

Create a New method DISPLAY_DOCUMENT in your assitance class, generally the TYPE of document is static but you can keep all as parameterised.

 

Inside the method call the following code

 


 

  DATA : W_URL  type string,
 
          v_url type MCDOK-URL.


CALL FUNCTION 'CVAPI_DOC_VIEW'
 
EXPORTING
    PF_DOKAR              
= I_DOKAR
    PF_DOKNR              
= I_DOKNR
    PF_DOKVR              
= I_DOKVR
    PF_DOKTL              
= I_DOKTL
   PF_HOSTNAME           
= 'DEFAULT'
   PF_APPL_START         
= ' '
   PF_GET_URL            
= 'X'

IMPORTING

   PFX_URL                = v_URL

EXCEPTIONS
   ERROR                 
= 1
   NOT_FOUND             
= 2
   NO_AUTH               
= 3
   NO_ORIGINAL           
= 4
  
OTHERS                 = 5.

 

IF SY-SUBRC <> 0.

* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

 

W_URL = v_url.

 


  data lo_window_manager type ref to if_wd_window_manager.
 
data lo_api_component  type ref to if_wd_component.
 
data lo_window         type ref to if_wd_window.
 

  lo_api_component  = wd_comp_controller->wd_get_api( ).
  lo_window_manager
= lo_api_component->get_window_manager( ).
 

  CALL METHOD lo_window_manager->CREATE_EXTERNAL_WINDOW
   
EXPORTING
      URL           
= W_URL

      MODAL          = ABAP_FALSE
      HAS_MENUBAR   
= ABAP_TRUE
      IS_RESIZABLE  
= ABAP_TRUE
      HAS_SCROLLBARS
= ABAP_TRUE
      HAS_STATUSBAR 
= ABAP_TRUE
      HAS_TOOLBAR   
= ABAP_TRUE
      HAS_LOCATION  
= ABAP_TRUE
    RECEIVING
     
WINDOW         = lo_window.

 

  lo_window->open( ).

 

Output

 

Well, I have called this code on click of ALV on the DMS document number... and here is the result

 

Capture.PNG


Viewing all articles
Browse latest Browse all 948

Latest Images

Trending Articles



Latest Images

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