Skip to Content
Author's profile photo Former Member


Here am going to explain how we can show smartform as in pdf format in webui screen.

Step 1: Create a BSP Page in your application and give the extension as  .pdf.


Step 2: Go to OnInitialization Event Handler method in ur page and write the  fallowing  code.

DATA    lv_xlen              TYPE i.
DATA  lv_pdf           TYPE xstring.

CALL FUNCTION ‘XXXXXXXXXXXXXXXX’   ”Your FM To Get otf data of your SmartForm

                          iv_status = XXXXXXXX
                          ev_otf    = lv_pdf.

lv_xlen = xstrlen( lv_pdf ).
data = lv_pdf length = lv_xlen ).
response->set_header_field( name = if_http_header_fields=>content_type
value = ‘application/pdf’ ).
response->set_header_field( name  =  if_http_header_fieLds=>CACHE_CONTROL 
value = ‘max-age=0’ ).
code = 200 reason = ‘OK’ ).
response->server_cache_expire_rel( expires_rel =
180 ).

Note: Here lv_pdf is the converted otf data of your smart form.


Step 3: Change the Mime Type of your BSP Page into application/pdf in properties tab .


Step 4:   To maintain the session we have 3 options in our bsp page properties tab.

Choose ‘Stateful from Now on radio button’ and make lifetime as ‘Session’ by us

ing dropdown.




Step 5:

data:  gv_url type string.

Add the Fallowing code in the .htm page in view to open smart form in new window.

if controller->gv_url is not initial.
<script language=
“<%= controller->gv_url %>”).focus();
clear controller->gv_url.
%>                   “ We have to pass the URL of your BSP page to the variable gv_url.

Step 6:  Finally  call the BSP Page by using the url of the BSP page in handler method.

               Now we have to assign the BSP URL  to gv_url to call the BSP page.

               You will get the URL of BSP page in the properties tab of BSP page.


Assigned Tags

      You must be Logged on to comment or reply to a post.
      Author's profile photo Andrei Vishnevsky
      Andrei Vishnevsky

      Below I will share my personal feelings about the post.

      As far as it's a document it must be well structured, without errors, same style all across the document. And have you ever seen "Hi all", "Happy Reading" and "Cheers" in documents? Me not. In blogs - yes, it's ok. But not in documents. I think the document should be reworked.

      The general idea of the post is quite interesting.

      Author's profile photo Former Member
      Former Member

      Hello Ravi ,

        Its Working Now . Thanks for sharing your knowledeg . Its a really very usefull document you have posted 🙂

      Thanks and Regards,

      Nikhil Kulkarni

      Author's profile photo Former Member
      Former Member

      Hello ,

      I have a problem ,

      1- i have my event methode EH_ONGENERATE_FORM : i give URL value

      2- in htm(overwiew.htm) page I have put the code in ""<%= controller->gv_url %>").focus();" .....

      where gv_url  contain the the url of bsp page(bsp.pdf) which contain my smartform .

      3- when i execute from web ui (i click in button) i works for the first time , after if i click a second time its  not working , if i change the url by it works , its not able to exectute the same url two times succusively .

      4- if i execute for a second time without changing in debugging its not working but if i click in anther button which refresh overwiew.htm  it works .

      Can you help me please

      Author's profile photo Former Member
      Former Member

      I have the same problem as Rida.  When you click the button again the page does not open.  Mohamed ELBEQQAL did you find the solution for this?

      Author's profile photo Former Member
      Former Member


      Its my solution , that will help you :

      Try to pass by different part for each execution :   (use gv_print to switch eache time)

      if controller->gv_url is not initial.

      * Swtich

        if controller->gv_print is not initial .


      <script language="javascript">"<%= controller->gv_url %>").focus();



        clear controller->gv_print.



      <script language="javascript">

      popup_window ="<%= controller->gv_url %>");



        controller->gv_print = 'X'.

        endif .

        clear controller->gv_url.


      I hope that help you .