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 ).
response->set_data( 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’ ).
response->set_status( 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
Coding in BSP COMPONENT:
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.
window.open(“<%= controller->gv_url %>”).focus();
%> “ 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.