Skip to Content

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 MCDOKURL.


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 SYSUBRC <> 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

To report this post you need to login first.

4 Comments

You must be Logged on to comment or reply to a post.

  1. Satya Srinivas

    Hi Yakub,

    Really it is very useful. Last time i got similar requirement,but my object is related to Adobe forms.

    My requirement:

    I have to print item level DMS document content(based on materials number) in ME23N t-code.

    Thanks,

    Satya Srinivas.

    (0) 
    1. Mohammed Yakub Shah Post author

      Well Satya,

      That is a question to be asked in forum…..

      You cau use the intertative form in that case in WD and pass the OTF output of your ADOBE Form into it Converted to XSTRING.

      (0) 

Leave a Reply