Want to create a function module  which will convert smartform into PDF .

Hi All ,
Requirement : I want to create a function module/report  which will convert smartform into PDF .
Thanks in advance

Hi All ,
zsuresh_test : for converting smartform into pdf.
when I am excuting this report(zsuresh_test) and by passing the smartform name FOPCR_STANDARD_F1
I am getting error :
Incorrect parameter with CALL FUNCTION
Can you  please help me out..
REPORT zsuresh_test.
Variable declarations
DATA:
w_form_name TYPE tdsfname VALUE 'FOPCR_STANDARD_F1',
w_fmodule TYPE rs38l_fnam,
w_cparam TYPE ssfctrlop,
w_outoptions TYPE ssfcompop,
W_bin_filesize TYPE i, " Binary File Size
w_FILE_NAME type string,
w_File_path type string,
w_FULL_PATH type string.
Internal tables declaration
Internal table to hold the OTF data
DATA:
t_otf TYPE itcoo OCCURS 0 WITH HEADER LINE,
Internal table to hold OTF data recd from the SMARTFORM
t_otf_from_fm TYPE ssfcrescl,
Internal table to hold the data from the FM CONVERT_OTF
T_pdf_tab LIKE tline OCCURS 0 WITH HEADER LINE.
This function module call is used to retrieve the name of the Function
module generated when the SMARTFORM is activated
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
formname = w_form_name
VARIANT = ' '
DIRECT_CALL = ' '
IMPORTING
fm_name = w_fmodule
EXCEPTIONS
no_form = 1
no_function_module = 2
OTHERS = 3
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
Calling the SMARTFORM using the function module retrieved above
GET_OTF parameter in the CONTROL_PARAMETERS is set to get the OTF
format of the output
w_cparam-no_dialog = 'X'.
w_cparam-preview = space. " Suppressing the dialog box
" for print preview
w_cparam-getotf = 'X'.
Printer name to be used is provided in the export parameter
OUTPUT_OPTIONS
w_outoptions-tddest = 'LP01'.
CALL FUNCTION w_fmodule
EXPORTING
ARCHIVE_INDEX =
ARCHIVE_INDEX_TAB =
ARCHIVE_PARAMETERS =
control_parameters = w_cparam
MAIL_APPL_OBJ =
MAIL_RECIPIENT =
MAIL_SENDER =
output_options = w_outoptions
USER_SETTINGS = 'X'
IMPORTING
DOCUMENT_OUTPUT_INFO =
job_output_info = t_otf_from_fm
JOB_OUTPUT_OPTIONS =
EXCEPTIONS
formatting_error = 1
internal_error = 2
send_error = 3
user_canceled = 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.
t_otf[] = t_otf_from_fm-otfdata[].
Function Module CONVERT_OTF is used to convert the OTF format to PDF
CALL FUNCTION 'CONVERT_OTF'
EXPORTING
FORMAT = 'PDF'
MAX_LINEWIDTH = 132
ARCHIVE_INDEX = ' '
COPYNUMBER = 0
ASCII_BIDI_VIS2LOG = ' '
PDF_DELETE_OTFTAB = ' '
IMPORTING
BIN_FILESIZE = W_bin_filesize
BIN_FILE =
TABLES
otf = T_OTF
lines = T_pdf_tab
EXCEPTIONS
ERR_MAX_LINEWIDTH = 1
ERR_FORMAT = 2
ERR_CONV_NOT_POSSIBLE = 3
ERR_BAD_OTF = 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.
To display File SAVE dialog window
CALL METHOD cl_gui_frontend_services=>file_save_dialog
EXPORTING
WINDOW_TITLE =
DEFAULT_EXTENSION =
DEFAULT_FILE_NAME =
FILE_FILTER =
INITIAL_DIRECTORY =
WITH_ENCODING =
PROMPT_ON_OVERWRITE = 'X'
CHANGING
filename = w_FILE_NAME
path = w_FILE_PATH
fullpath = w_FULL_PATH
USER_ACTION =
FILE_ENCODING =
EXCEPTIONS
CNTL_ERROR = 1
ERROR_NO_GUI = 2
NOT_SUPPORTED_BY_GUI = 3
others = 4
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Use the FM GUI_DOWNLOAD to download the generated PDF file onto the
presentation server
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
BIN_FILESIZE = W_bin_filesize
filename = w_FULL_PATH
FILETYPE = 'BIN'
APPEND = ' '
WRITE_FIELD_SEPARATOR = ' '
HEADER = '00'
TRUNC_TRAILING_BLANKS = ' '
WRITE_LF = 'X'
COL_SELECT = ' '
COL_SELECT_MASK = ' '
DAT_MODE = ' '
CONFIRM_OVERWRITE = ' '
NO_AUTH_CHECK = ' '
CODEPAGE = ' '
IGNORE_CERR = ABAP_TRUE
REPLACEMENT = '#'
WRITE_BOM = ' '
TRUNC_TRAILING_BLANKS_EOL = 'X'
WK1_N_FORMAT = ' '
WK1_N_SIZE = ' '
WK1_T_FORMAT = ' '
WK1_T_SIZE = ' '
IMPORTING
FILELENGTH =
tables
data_tab = T_pdf_tab
FIELDNAMES =
EXCEPTIONS
FILE_WRITE_ERROR = 1
NO_BATCH = 2
GUI_REFUSE_FILETRANSFER = 3
INVALID_TYPE = 4
NO_AUTHORITY = 5
UNKNOWN_ERROR = 6
HEADER_NOT_ALLOWED = 7
SEPARATOR_NOT_ALLOWED = 8
FILESIZE_NOT_ALLOWED = 9
HEADER_TOO_LONG = 10
DP_ERROR_CREATE = 11
DP_ERROR_SEND = 12
DP_ERROR_WRITE = 13
UNKNOWN_DP_ERROR = 14
ACCESS_DENIED = 15
DP_OUT_OF_MEMORY = 16
DISK_FULL = 17
DP_TIMEOUT = 18
FILE_NOT_FOUND = 19
DATAPROVIDER_EXCEPTION = 20
CONTROL_FLUSH_ERROR = 21
OTHERS = 22
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.

Similar Messages

  • Using a function module i want to create another function module

    Hi all,
            My requirement is by using a function module i want to create another function module(if needs modify action should also be done if i need this is for the created function module) and the main thing is that the function module which we are used to create is should be RFC enabled.
    Thanks,
    Vichu.

    Hi,
    You can do one thing... you write the BDC code in the function module name you are creating... so that if you call the function module in a program and execute that program and if you give the function module to be created in the selection screen of the program... in this way there is chance of creating another function module.
    Hope this would help you.
    Good luck
    Narin

  • Function Module which will take Wekk No & Return date range (from & To dat)

    Hello everyone,
    I need a Function Module which will take Week No as an input Parameter & return me the date range
    (From date & To date of that week) .
    Thanks in advance!
    Cheers!
    Moderator message: date calculation questions = FAQ, please search before posting.
    Edited by: Thomas Zloch on Nov 2, 2010 5:25 PM

    Hi,
         Please write the below logic..
    data : v_date11 type sy-datum,
              monday    type sy-datum,
              sunday  type sy-datum,
              v_count1 type i .
    *v_count1 = 20 * 7.            "   Say U want details for 20th week , or give a parameter for week and multiply with 7*
    v_date11 = '20100101'.     "   take the starting day of the year ....
    v_date11 = v_date11 + v_count1.   " add to the date
    CALL FUNCTION 'GET_WEEK_INFO_BASED_ON_DATE'   <-- call this FM
    EXPORTING
       DATE          = v_date11
    IMPORTING
      WEEK          = WEEK
       MONDAY        = MONDAY <-- will have the week starting day
       SUNDAY        = SUNDAY
    Regards,
    Srini.

  • Any Function Module which will give user id or position

    Hello Friends,
       is there any standard function module which will give the attribute position id or user name if i pass the 'attribute id as CNT' with value of the CNT. i know there is a standard function module 'BBP_READ_ATTRIBUTES'. but this FM will give the value of the attribute id if i pass the user id and attribute id but i want user id or position when i pass attribute id and value.
    john.

    Hi,
    See this related thread:
    Re: Get all users given a specific product category
    You cna use the similar approach to find for the attribte cost centre.
    BR,
    Disha.

  • I need to create RFC function module which creates the IDOC

    Hi-
    Any idea how to create RFC function module which creates the outbound IDOC. If you have any sample code please forward to me.
    Thanks,
    Sony

    My Problem is
    Whenever they create Invoice using T-code's like FV65(Parked Document), automatically should create IDOC's...
    I have used message type FIDCC1 but this message type is usefull only for Posting documents.
    1. Whenever they create parked document, entries will be stored in BKPF(Parked Document-Filed-BKPF-BSTAT = 'V') and Bseg....
    2. I have to read entries from those tables and should create IDOC...
    3. I checked FM's(FI_IDOC_CREATE_FIDCC1, FI_IDOC_PREPARE) but are not useful...
    4. Now I need to write one RFC function module and that FM should create the IDOC's....
    Can anyone please help me out?
    Thanks,
    Sony

  • Function module which will capture system generated errors

    hi gurus,
      What is the name of the function module which will capture system generated errors and will populate a internal table?

    hi,
    there is a backgroung job running, if it fails i need to catch the system error because of which the job has failed
    Edited by: arunchandra c p on Aug 27, 2008 2:02 PM

  • RFC enabled function module which will be called from XI

    Hi Abappers,
    I have to send confirmation of the sales orders created by inbound Idocs ORDERS05 to XI. For this I have to use outbound Idoc ALEAUD01. But since I also need to send NETWR(from VBAK) and there is no field in this Idoc for that,
    I have to develop an RFC enabled function module for which a RFC lookup will be performed from XI. This function module has to return NETWR values for sales orders. Can anyone please tell me how to go about with this function module.
    Thanks in advance.

    Hi Priyanka,
    Add a parameter in <b>tables tab</b> of function module with reference to NETWR. It'll work.
    Regards,
    Younus
    Reward Helpful Answers!!!!

  • Is there any function module which will upload storage locations for a mat

    Hi gurus,
      Is there any function module or BAPI to extend the storage locations of material which is done through <b>MMSC</b> transaction. I need to write a program to upload new storage locations for some materials.Please advise.
    Thanks ,
    Sam.

    You can do this using the BAPI_MATERIAL_SAVEDATA
    Regards,
    Rich Heilman

  • I want to create a Firefox Extension which will display a webpage. It will be like user should write a something in browser like "about:webpage" How can i load the WebPage in Firefox. The user should have a feel that a webpage is being loaded.

    My extension on clicking something should open a webpage and that webpage should be able to communicate with the servers.
    PS: I have javascript and CSS in that Page. If i cannot make then what changes do i need to make in the web page for that change. I am developing as HTML/Javascript does not allow cross domain queries. I hope that cross-domain queries are possible if i use extension.

    You may find [https://addons.mozilla.org/en-US/firefox/developers this] a useful resource :)

  • How to Create a Function module z_create and to track the error records?

    I want to create a function module z_create which will insert the data from the internal tables gt_model_master and gt_model  into the corresponding database custom tables y_model_master.
    Secondly if any error is encountered during the above updation, then how to track those error records ?

    HI,
    check the sy-subrc ,if it is zero the insertion is success,otherwise use 
    message class.
    if sy-subrc ne 0.
    message e052(zmessage).
    endif.
    Edited by: rakesh dhudipala on Feb 12, 2008 2:33 PM
    Edited by: rakesh dhudipala on Feb 12, 2008 2:33 PM

  • How can create a function module for currency and quantity fields

    hi,
    i want to create a function module with some fields.when i activated it give some errors for 
    netpr,menge,wemng  fields(currency, quantity fields).error is it asks for reference fields. 
    please send me solution for it.
    sreenu.

    Hi Sreenu,
    While creating CURRENCY/QUANTITY fields in the DataBase Table, you have to enter a REFERENCE TABLE and a REFERENCE FIELD to the field.
    For that, after entering the field name and the data type in the correcponding columns, you have to place the cursor on the data type of the required field and click the CURRENCY/QUANTITY FIELDS tab. You will find two columns called REFERENCE TABLE and a REFERENCE FIELD.
    you have to enter a reference table in which a currency/quantity field is used and a reference field which is a currency/quantity field in that table.
    For Example, below is the table details.
    FIELD DATATYPE LENGTH DEC.PLACES REF.TABLE REF.FIELD
    1.SNO     CHAR 5
    2.AMOUNT  CURR 10     2          T001      WAERS
    3.NOS     QUAN 5                 KNA1      /VSO/R_PAL_UL
    Here Field 2(AMOUNT) is a CURR field whose Ref. Table is T001 and Ref. Field is WAERS and Field 3(NOS) is a QUAN field whose Ref. Table is KNA1 and Ref. Field is /VSO/R_PAL_UL.
    Hope this will help you.
    Regards,
    Vaitheeswaran

  • Creating a function module in background

    Hi
    Is there any way by which if i want to create any function module in background .
    like in any screen i have created a button  and on pressing that button a blank fucntion module should be created in the function group that is already created .
    waiting for your reply.

    Hello, Ashish;
    When you mention a "Function Module" where are you trying to create it? The report designer? A .NET form?
    What version of Crystal Reports are you using?
    What version of Visual Studio .NET?
    What requirements are you trying to meet?
    Elaine

  • Functional module which get triggered after posting of the document F-22

    Hi,
    I am posting the documents using the transaction F-22. I need to update some table after the documet will get post.
    I try to find out the BTE'S in the transaction FIBF but unable to find it out.
    Can anyone help me to find out the relvant functional module which will get triggered after the posting of the documents.
    Please help me with this.
    Thanks in advanced.
    Regards,
    Darshana

    Hi Harini,
    It is also not get triggered while i am posting the documents.
    Can you please suggest me some more functional modules.
    Thanks in advanced.
    Regards,
    Darshana

  • Function module which sort the entries in Table maintance generator

    hi
        I want to know the function module which is used to sort the entirs in table maintance genrator.
    Thanks

    Hi,
    Go to the TMG program .You can change the code there.
    Rgds,
    Anversha

  • I'm very new tp SAP ABAP, how to create a function module..V.URGENT

    hi folks,
    I'm very new to sap abap.
    I want to create a function module.
    the following is my requirement.
    by passing(eporting parameters to funtion module from pgm point of view) a field, i want to get(importing parameters from the funtion module, from pgm point of view) some 7 fields(of various tables).
    please also tell me how can code an inner join for tables 5 tables(a,b,c,d,e). i'm joining a on b, b on c, c on d,the problem here is that i can not join d on e as there are no common fields in d and e.
    can i join e and c or b, there are no common fields even in a and e.
    please tell me the solution as soon as possible, this very important and urgent deliverable.
    thanks in advance

    Here is link for creating function modules
    <a href="http://help.sap.com/saphelp_47x200/helpdata/en/9f/db98fc35c111d1829f0000e829fbfe/frameset.htm">Creating Function Modules</a>
    Regds
    Manohar

Maybe you are looking for

  • I got a new MacBook, and iChat will not open at all.

    About a month ago, I got a new MacBook (the regular one, not Air or Pro). Everything is working fine, except for iChat. It has never opened since purchasing my new computer and it continues not to. When you double click the iChat icon, "iChat" appear

  • Error While using LKM File to Oracle(SQLLDR)

    Hi , When I am trying to load the data from flat file to oracle table using LKM File to oracle (SQLLDR) it is getting failed with below error message. SQL*Loader-128: unable to begin a session ORA-01034: ORACLE not available ORA-27101: shared memory

  • 6i help needed!!!

    n reports 6i is there any difference in architecture between using run_product and srw.run_report(which according to 6i doc calls rwrun60.exe)? The reason is I that have the same report submitted by the above two processes produce font difference in

  • Scanned PDF Images show up black in ScreenSaver Mode

    In the past I've scanned random images, converting them to PDF files and adding them to a folder of photos to be used as a screensaver on my Mac, but the latest batch (on a new iMac, operating Mac OS X, v. 10.5.4 w/a 2.66 GHz Intel Core 2 Duo process

  • Macbook to Smart TV Streaming

    I have just purchased a Smart TV, I am trying to stream my movie I have on my Macbook to my Smart TV through wifi, Is this possible?