Call smartform in web dynpro abap

hi guys,
      I am tring to create PDF from smartform but am getting sy-subrc = 1 error after call function LV_FNAM.
I am attaching the code below. Am not using InteractiveForm UI Elemnt .
data: lv_fnam type rs38l_fnam,
      ls_ssfctrlop type ssfctrlop,
      ls_ssfcompop type ssfcompop,
      ls_book type ppftbook,
      ls_job_output_info type ssfcrescl,
      ls_job_output_options type ssfcresop,
      lv_bytecount type i,
      lt_lines type table of tline,
      ls_line type tline,
      lv_string type string,
      lv_buffer type xstring,
      l_xline type xstring,
      l_pdfstring type xstring,
      it_add_rel type table of zprint_add_rel.
*      p_pdf type xstring.
data : wa_board type mara-matnr,
       plant type marc-werks.
wa_board =  'SYPJ764'.
plant = '2001'.
call function 'SSF_FUNCTION_MODULE_NAME'
exporting
formname = 'ZSSF_ADD_REL'
importing
fm_name = lv_fnam.
ls_ssfctrlop-no_dialog = 'X'.
ls_ssfctrlop-getotf  = 'X'.
ls_ssfctrlop-preview = 'X'.
ls_ssfcompop-tdnoprev = 'X'.
ls_ssfcompop-tdtitle = 'X'.
ls_ssfcompop-tdnewid = 'X'.
call function lv_fnam
exporting
control_parameters = ls_ssfctrlop
output_options = ls_ssfcompop
*is_book = ls_book
board = wa_board " 'SYPJ764'
plant = plant " '2001'
importing
job_output_info = ls_job_output_info
job_output_options = ls_job_output_options
tables
it_add_rel_i = it_add_rel
exceptions
formatting_error = 1
internal_error = 2
send_error = 3
user_canceled = 4
other = 5.
if sy-subrc <> 0.
endif.
*convert to pdf
call function 'CONVERT_OTF'
exporting
format = 'PDF'
importing
bin_filesize = lv_bytecount
tables
otf = ls_job_output_info-otfdata
lines = lt_lines
exceptions
err_conv_not_possible = 1
err_bad_otf = 2.
loop at lt_lines into ls_line.
lv_string = ls_line.
export mydata = lv_string to data buffer lv_buffer.
import mydata to l_xline from data buffer lv_buffer in char-to-hex mode.
concatenate l_pdfstring l_xline into l_pdfstring in byte mode.
endloop.
p_pdf = l_pdfstring.
Please help me out with this error.
Regards,
Santosh

Hi Santhosh,
Please find the below code:
FUNCTION ZP3088_NEW_JOINEE_ACT.
*"*"Local Interface:
*"  IMPORTING
*"     REFERENCE(PERNR) TYPE  PERSNO
*"  EXPORTING
*"     REFERENCE(L_DISPLAY_PDF) TYPE  NUM1
*"     REFERENCE(L_DATA) TYPE  XSTRING
*"  EXCEPTIONS
*"      TRAINEE_PERNR
* Tables declaration
  TABLES: NAST,PA0041.
*   Type pools declaration
  TYPE-POOLS: SZADR.
*   Internal table declaration
  DATA: L_PDF_LEN TYPE I,
        IT_PDF_LINES TYPE TABLE OF TLINE,
        JOB_OUTPUT_INFO TYPE  SSFCRESCL.
*   Variables declaration
  DATA: G_RETCODE LIKE SY-SUBRC,
        G_FMNAME TYPE RS38L_FNAM.
  DATA: L_HIRE_DATE TYPE DATS,
        L_INCLUDE_DATE TYPE DATS,
        L_WEEK_DAYS TYPE P,
        IT_P0041 LIKE PA0041.
  DATA: DAR TYPE PA0041-DAR01,
        DAT TYPE PA0041-DAT01.
  DATA: L_DEVICE(30) TYPE C,
        LA_CTRL_FORM TYPE SSFCTRLOP,
        LA_OUTPUT_OPT TYPE SSFCOMPOP.
  data: l_persg type PA0001-persg. 
* Start of Actual Code
  SELECT SINGLE persg
    from PA0001
    INTO l_persg
   where pernr eq pernr
     and endda eq '99991231'.
    if l_persg eq 'T' or
       l_persg eq 'W' or
       l_persg eq 'X'.
      raise trainee_pernr.
    endif.
  L_DISPLAY_PDF = 0.
  SELECT SINGLE * FROM PA0041 INTO IT_P0041
         WHERE PERNR EQ PERNR.
  IF SY-SUBRC = 0.
    DO 12 TIMES VARYING DAR FROM IT_P0041-DAR01
                              NEXT IT_P0041-DAR02
                  VARYING DAT FROM IT_P0041-DAT01
                              NEXT IT_P0041-DAT02.
      CASE DAR .
*        WHEN '09'.          "Hiring Date
        WHEN '51'.          "Hiring Date
          L_HIRE_DATE = DAT.
          EXIT.
        WHEN ''.
          EXIT.
      ENDCASE.
    ENDDO.
  ENDIF.
*To get the no. of weekdays between the hire date and current date excluding sat and sun
  IF NOT L_HIRE_DATE IS INITIAL.
    WHILE L_HIRE_DATE LE SY-DATUM.
      CALL FUNCTION 'BWSO_DATE_GET_FIRST_WEEKDAY'
        EXPORTING
          DATE_IN  = L_HIRE_DATE
        IMPORTING
          DATE_OUT = L_INCLUDE_DATE.
      DO 5 TIMES.
        " Making sure that it starts from the from date till to_date calculate before
        IF L_INCLUDE_DATE GE L_HIRE_DATE AND L_INCLUDE_DATE LE SY-DATUM.
          L_WEEK_DAYS = L_WEEK_DAYS + 1.
        ENDIF.
        L_INCLUDE_DATE = L_INCLUDE_DATE + 1.
      ENDDO.
      L_HIRE_DATE = L_INCLUDE_DATE + 2.
    ENDWHILE.
IF L_WEEK_DAYS LE 30.
      L_DISPLAY_PDF = 1.         "Display the PDF document
    ELSE.
      L_DISPLAY_PDF = 0.         "Do Not Display the PDF document
    ENDIF.
  ENDIF.
  IF L_DISPLAY_PDF = 1.
* Clear local variables
    CLEAR:   L_DEVICE,
             LA_CTRL_FORM,
             LA_OUTPUT_OPT.
** Spool Parameters
    LA_OUTPUT_OPT-TDIMMED = 'X'.
    LA_OUTPUT_OPT-TDDELETE = 'X'.
    LA_OUTPUT_OPT-TDLIFETIME = 'X'.
    LA_OUTPUT_OPT-TDDEST = 'LOCL'.
* Get Smartform function module name
    CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
      EXPORTING
        FORMNAME           = 'ZP3088_NEW_JOINEE_ACT_PDF'
      IMPORTING
        FM_NAME            = G_FMNAME
      EXCEPTIONS
        NO_FORM            = 1
        NO_FUNCTION_MODULE = 2
        OTHERS             = 3.
    IF SY-SUBRC <> 0.
      G_RETCODE = SY-SUBRC.
      SYST-MSGTY = 'E'.
    ELSE.
* Parameters passes to get the output in PDF format
      LA_CTRL_FORM-NO_DIALOG = 'X'.
      LA_CTRL_FORM-PREVIEW = SPACE.
      LA_CTRL_FORM-GETOTF = 'X'.
      LA_CTRL_FORM-LANGU = NAST-SPRAS.
      LA_CTRL_FORM-DEVICE = 'PRINTER'.
Edited by: wahid hussain syed on Nov 4, 2010 3:41 AM
Edited by: wahid hussain syed on Nov 4, 2010 3:41 AM
Edited by: Neil Gardiner on Nov 4, 2010 2:04 PM

Similar Messages

  • Smartform in web dynpro Abap

    Hi,
    I'm trying to implement a web dynpro abap with a smartform.
    I used the "How to Display a Smartform as PDF document in Web Dynpro for ABAP" document that e can find on sdn.
    My problem is that when the form is called, there is  a dump
    "Please maintain an output device in your user master data. ".
    I copied  the code in a report and the form is displayed.
    Did I miss something?
    Kr
    Karim

    This workaround solution for smartForms sends the output to the Spool and then converts the spool to PDF.  For it to work it has to have a printer id for the formatting to the spool. You must maintain a default printer in your user ID or pass in a printer into the output settings of the smartForms function module. Because all of this is occuring in the background, the smartForms function modules can't just popup a dialog asking for a printer.

  • How to call call transaction in web dynpro abap

    hello experts,
    i need to call one RFC in web dynpro.In RFC we maintained the BDC program. but while calling the same RFC in web dynpro through service call function, it is not working.Kindly suggest any way out.this is very urgent.
    Regards

    Hi Rajat,
    Please use the below mentioned link.May be it will help you:
    The webdynpro/ABAP (WDA) calling RFC enabled FM of other ECC systems
    Thanks and Regards,
    Neha

  • Calling a smart form on click of a button in web dynpro abap

    Hi experts,
    I have a requirement like if I click a button in a view i need ti generate a PDF through smart form.
    Is this possible. If so please tell me the way..
    Thanks & Regards

    Hi Sharma,
    Create Interactive form in your view, create one node say PDF_SOURCE under this one attribute PDF_SOURCE of type XSTRING.
    Bind this to IF form Datasource and pdfsource.
    in your button action write code to call your smartform
    using SSF_FUNCTION_MODULE_NAME
    using FM  CONVERT_OTF and attach_file_to_response
    *convert to pdf
      call function 'CONVERT_OTF'
        EXPORTING
          format                = 'PDF'
        IMPORTING
          bin_filesize          = lv_bytecount
        TABLES
          otf                   = ls_job_output_info-otfdata
          lines                 = lt_lines
        EXCEPTIONS
          err_conv_not_possible = 1
          err_bad_otf           = 2.
      loop at lt_lines into ls_line.
        lv_string = ls_line.
        export mydata = lv_string to data buffer lv_buffer.
        import mydata to l_xline from data buffer lv_buffer in char-to-hex
        mode.
        concatenate l_pdfstring l_xline into l_pdfstring in byte mode.
      endloop.
      call method cl_wd_runtime_services=>attach_file_to_response
        EXPORTING
          i_filename      = 'ZWTY_PACKINGSLIP'
          i_content       = l_pdfstring
          i_mime_type     = 'BIN'
          i_in_new_window = abap_false
          i_inplace       = abap_false.
    also check this..
    http://abapcodexperiments.wordpress.com/2011/03/20/smartform-pdf-webdynpro-abap/
    Call smartform in web dynpro abap
    Cheers,
    Kris.

  • How can I call a java object from Web dynpro ABAP application?

    I made Web dynpro ABAP application and posted it to SAP EP.
    For certain business purpose, we need to call external 3rd party java object using 3rd party's java api in Web dynpro application.
    Is there anybody who experienced this kind of java interface issue?
    I know Web dynpro Java environment can fully support this kind of requirement. but regarding Web dynpro ABAP, I couldn't find any clue for this.
    Any comment or suggestion would be greatly appreciated.
    Thanks,
    Raymond, ABAP Consultant

    if you have jco configured, then you can make calls to java api from ABAP .
    check out this weblog.
    /people/gregor.wolf3/blog/2004/08/26/setup-and-test-sap-java-connector-outbound-connection
    Raja

  • Problem in calling abap editor with the program name in Web Dynpro ABAP

    Hi,
    I have to caal ABAP Editor screen with the display of program after clicking a button from web dynpro abap application.
    I am able to call the ABAP Editor initial screen, but i want the editor display screen with a program.
    How to do that?
    Please find my code below:
      DATA : FINAL_URL TYPE STRING,
             URL TYPE STRING.
      DATA: LV_HOST TYPE STRING,
            LV_PORT TYPE STRING.
    DATA V_TCODE TYPE TCODE.
      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.
      DATA:  LD_URL TYPE STRING.
    V_TCODE = 'SE38'.
    *Call below method to get host and port
      CL_HTTP_SERVER=>IF_HTTP_SERVER~GET_LOCATION(
         IMPORTING
           HOST = LV_HOST
           PORT = LV_PORT ).
      CONCATENATE 'http'
      '://' LV_HOST ':' LV_PORT '/sap/bc/gui/sap/its/webgui/?sap-client=&transaction=' V_TCODE '&OKCODE=SHOW'
      INTO URL.
      LO_API_COMPONENT  = WD_COMP_CONTROLLER->WD_GET_API( ).
      LO_WINDOW_MANAGER = LO_API_COMPONENT->GET_WINDOW_MANAGER( ).
      LD_URL = URL.
      CALL METHOD LO_WINDOW_MANAGER->CREATE_EXTERNAL_WINDOW
        EXPORTING
          URL    = LD_URL
        RECEIVING
          WINDOW = LO_WINDOW.
      LO_WINDOW->OPEN( ).
    Now, how to pass my Zprogram name into the URL.
    I need to get the editor screen with the display of the program.
    Thanks,
    Radhika

    Hi Kiran,
    Please find my code below:
    DATA :   URL TYPE STRING.
      DATA: LV_HOST TYPE STRING,
            LV_PORT TYPE STRING.
      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.
      DATA:  LD_URL TYPE STRING.
    *Call below method to get host and port
      CL_HTTP_SERVER=>IF_HTTP_SERVER~GET_LOCATION(
         IMPORTING
           HOST = LV_HOST
           PORT = LV_PORT ).
      CONCATENATE 'http'
    '://' LV_HOST ':' LV_PORT '/sap/bc/gui/sap/its/webgui/?&transaction=se38&RS38M-PROGRAMM=Y2PSOLTREE&~okcode=shop'
      INTO URL.
      LO_API_COMPONENT  = WD_COMP_CONTROLLER->WD_GET_API( ).
      LO_WINDOW_MANAGER = LO_API_COMPONENT->GET_WINDOW_MANAGER( ).
      LD_URL = URL.
      CALL METHOD LO_WINDOW_MANAGER->CREATE_EXTERNAL_WINDOW
        EXPORTING
          URL    = LD_URL
        RECEIVING
          WINDOW = LO_WINDOW.
      LO_WINDOW->OPEN( ).
    Here,, Y2PSOLTREE is the program, that should show in SE38 screen.
    I used the above code, but still it is showing the SE38 initial screen.
    Thanks,
    Radhika

  • Calling adobe form from Web Dynpro ABAP

    Hi Friends,
                        This is the following error, which i got when i tested my application. Calling adobe form from Web Dynpro ABAP.
      WebDynpro Exception: ADS: Request start time: Tue Nov 16 14:00:22 YEKT
      2010(200,101).
                        Can some one tell me how to solve this....
    Regards
    Sankar

    Hi,
    Please refer to this same link in forum
    WebDynpro Exception: ADS: Request start time, start Interactive Form
    WebDynpro Exception: ADS: Request start time
    Thanks
    Pradeep

  • Web Dynpro ABAP call transaction in the foreground

    In Screen Painter/SAP ALV, we can create a screen where for example if you double click on a sales order field it can take you a VA03 transaction by :
    call transaction VA03 ... and skip first screen.
    I am creating Web Dynpro ABAP application that needs to do the same thing where if we click on the field, it will take to VA03 transaction or other transactions.
    Has anyone done this in Web Dynpro ABAP? I have done some research and determine that we cannot call transaction in the foreground? I hope I am wrong.  Any help/insights will be greatly appreciated.

    Hi Phong,
    WDA is generic client to Netweaver connection based on HTTP/S.
    At this stage on a few clients are supported. WEB dynpro client and Browsers...
    SAPGUI connects to SAP using a different protocol.
    No SAPGUI connection is implied by a WDA client connection.
    Therefore  abap statements that invoke screens and otherwise assume SAPGUI
    is connected are not supported in WDA.   eg call screen, call transaction
    You can either
                         a) build your own WDC to front end calls to BAPIs to get the Sales order data.
                        b) open/ exit to the new WDC for Sales Orders in ERP2005
                              see LORD_MAINTAIN_COMP
                           c) exit to the INTERNAL ITS URL for transaction VA03 
                               eg http://<host>:<port>/sap/bc/gui/sap/its/webgui?~Transaction=VA03
                              but getting the skip first screen may require you to call custom tran ZVA03
                               which calls VA03 to skip first screen setting the PID appropriately.
    Hopefully you opt for option a) or b).
    c) can work... I have used it from BSPs but it not pretty.
    regards
    Phil

  • Web Dynpro ABAP calling another ABAP program

    I have a question and just want to know if it's possible or not.
    Is it possible to write a Web Dynpro ABAP program that calls another ABAP program which happens to be an ALV report?
    Rather than re-write the ABAP ALV report, I was wondering if it's possible to call the ABAP ALV report within a Web Dynpro ABAP program and display the results within the Web Dynpro program.
    If it's not possible, then I assume it would be better to re-write the code from the ABAP ALV report in the Web Dynpro ABAP program.
    Thanks
    John

    The ALV report in your classic program is coded to be displayed in the GUI only.
    Your best bet would be to create a Function Module or Method that will return the data to be used in your ALV.  Simply call the Function/Method from your Web Dynpro and then bind the table to the DATA context node of the ALV INTERFACE CONTROLLER.

  • How to call custom themes for Web Dynpro ABAP Application?

    Hi,
    I need to change the appearance of Web Dynpro ABAP application. So far I followed below steps,
    1.     Created theme folder u2018testngou2019 (SE80->MIME Repositoty -> SAP->PUBLIC->BC->UR->nw5->themes -> u2018testngou2019 ).
    2.     used program BSP_UPDATE_MIMEREPOS to dowmloaod content of  u2018sap_tradeshowu2019 (SE80->MIME Repositoty -> SAP->PUBLIC->BC->UR->nw5->themes -> sap_tradeshowu2019) to desktop.
    3.     Modified the themes using Eclipse Theme Editor.
    4.     used program BSP_UPDATE_MIMEREPOS to upload modified themes to MIME repository u2018testngou2019  (SE80->MIME Repositoty -> SAP->PUBLIC->BC->UR->nw5->themes ->  u2018testngou2019) .
    My current URL is like http://server.name:XXXX/sap/bc/webdynpro/sap/hrrcf_a_startpage_int_cand?sap-client=XXX.
    Now I want to know how custom themes called for Web Dynpro ABAP Application.
    Is my approach correct?
    ...Naddy

    Hi Naddy,
    What you used is one way and even I failed when tried that method,
    Instead go to SE38 - WD_THEMES - and you need to upload the zip file and you need to follow a folder structure.
    it is case sensitive, atleast the zip file.
    Make a zip file by name "Project.zip" -
    Create a Folder Project and have the below folder structure,
    1  data - all the properties files and also the designinfo file, below is the code
    2  themes - (to get all the files download the theme from portal and you will have all the folders)
       2.1  ur
         2.1.1 name of the theme
           2.1.1.1 common
           2.1.1.2 csf
           2.1.1.3  r
           2.1.1.4  ur - all the css files (would be good if you can get the files from the server.)
           2.1.1.5   WSRP
    3  war - empty folder
    *.designinfo
    isVisible=true
    version=7.0.14.1.0
    isDefault=false
    isSapDesign=false
    designName=**** name of the theme
    Once done create a zip file and click on Start Import and give the path and will ask for transport request, it will take a while to upload once done as mentioned in the use the parameter sap-ep-themeroot="path"
    This will resolve the issue.
    Cheers-
    Pramod
    reward points if helpful

  • How to call an web dynpro abap application with an particular theme

    Dear friends,
    i have created one web dynpro abap application. i created one theme XYZ in portal with required font size. when i applied this theme on portal all web dynpro application use this theme.
    i want to use current theme for one application not for all.
    is it poosible to call an web dynpro abap appl with the particular theme where as others should not be temper with this theme.
    please guide me by some useful steps.
    regards
    sunil

    Sunil,
    Check if this helps.
    http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/7015b1f9-535c-2910-c8b7-e681fe75aaf8?QuickLink=index&overridelayout=true
    Cheers!
    Sandeep Tudumu

  • How to call web dynpro ABAp application into workflow

    Hello All,
    How to call webdynpro application into workflow .Is it possible ?
    Scenario is : A web dynpro application should flow into 3 levels of approvals .
    Please share your knowledge .
    Thanks
    Sonal

    >
    Saurav Mago wrote:
    > hi,
    > I dont think from workflow , you can call WD application. 
    >
    > Thanx.
    Actually you can configure a workitem to launch WDA via UWL ( http://help.sap.com/saphelp_nw70ehp1/helpdata/en/59/d516690e854c7090ae15bf492a869f/frameset.htm ) or in the NetWeaver Business Client using the Business Workflow Workplace (WDA Application SWF_WORKPLACE).
    There is also a chapter in the upcomming SAP Press 2nd edtion workflow book on different aspects of Web Dynpro ABAP integration into Workflow:
    http://www.sappress.com/product.cfm?account=&product=H3057

  • Calling Web Dynpro ABAP application as work item through workflow.

    Hi experts,
    I want to call a Web Dynpro ABAP applicaiton through Workflow as UWL work item..
    Can anyone please provide me inputs about how can i achieve this?

    Hi Abhishek
    How will tha Task recognize which Web dynpro applicaiton needs to be processed.
    see in the workflow take the task number which you want to do for approval. That task number you register in t-code SWFVISU. so when the workflow trigger the goes to the approver the task is directly linked to the web dynpro screen which you have registered in SWFVISU. So when the task is click the corresponding web dynpro screen tagged to the task will get opened.
    I dont no weather task is available or not. It purly depends on the module and the workflow.
    I think i have answered you question correctly.
    Regards
    vijay

  • SAP GUI call from Web Dynpro Abap

    Hi all,
    I heard about the possibility to call the SAP GUI directly from my Web Dynpro Abap Application, so that the GUI is integrated in my web browser. But i could not find any information about that.
    Maybe you can help me.
    Thanks,
    Johannes

    Hi Johannes,
    Its not possible to directly call your R/3 GUI from your WDA. You can try the "Screen Design Time Conversion" tool in SAP. You can go through this [link|http://help.sap.com/saphelp_nw70ehp1/helpdata/en/30/f2156a26fb4b4d86c5b0ce9f86bfb3/frameset.htm] for further details regarding it.
    But please also pay heed to Thomas's advise in [here|Is there a converter for classic dynpros?;.
    Regards,
    Uday

  • How to View Smartforms or SAP Script Forms in Web Dynpro ABAP

    Do anyone have idea of how to View Smartforms or SAP Script Forms in Web Dynpro ABAP?
    Please let me know. Thanks

    Hi Sameeksha,
    You can display an smartform in WDA as an pdf file. Try go through this [article |https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/f0de1eb8-0b98-2910-7996-8a3c2fcf6785]where Nanda does explain about the same.
    Regards,
    Uday

Maybe you are looking for

  • Creation of "Web Dynpro for Java"  for SAP transaction

    Hi All,          In EP when we create SAP transaction iView for SAP transaction, a)ITS server is required if we choose SAP GUI Type as WebGui(Performance wise as well as some other issues) b)SAP GUI has to be installed if we choose SAP GUI Type as Wi

  • Windows 7 rc1 boot camp flash drive

    I posted this same post in other section. Someone suggested I post the question here. How can I, on my mac, install windows 7 on a flash drive then boot from that flash drive for the boot camp install? My boot camp install stalls when expanding the f

  • 805a01f4 error with updating nokia drive

    Hello, I have bought a new windows 8 phone from Nokia. Every feature which is default with the phone is great and I have no issues with any of them. But when am trying to open the Windows Store to update Nokia drive, am getting the error code with th

  • Spreadsheet output on more than one sheet in the same workbook

    I have created many reports having the output being a spreadsheet. But the output is on 1 worksheet in 1 workbook. Any thoughts on how to make 1 report output to more than 1 worksheet in 1 workbook? We are using Reports 10g. Thanks!! Kris

  • Problem in search field

    hi i am working on module pool program. in the screen i have one field called name. if user enter any value in the name field(A to Z),and press the search button,it should featch the all the data in to itab.how to search this,is there any select quer