Attach smartform to T code FBCJ

HIIII Experts,
Can you please tell me how to attach a driver program smartform to T Code FBCJ(Cash voucher), I have already created a smartform for the same, but dont know how to attach it?? PLS HELP!!!!!
Regards
Rajeev khatri

Hi,
1. Goto in NACE
2. You need to ask your functional buddy to let you know about Application area,for example take V3 (Billing).
3. Select V3 from the list and then click on Output Types, select any output type (Which you wud like to give to your smartform)
4. Else if you like to create a new one for your script, then on same screen click on change button, then click on New Entries
And give all the detailed info.
5. To use existing output types, select a output type like "ZEDI", at the left hand side double click on Processing Routines.
6. In the Processing Routines block, Give the Program name as print program and here you need to give your Smart form name in Form option.
Save it.
Edited by: Lokesh Tarey on Jan 13, 2012 7:47 AM

Similar Messages

  • Changing Field Description in  T.Code FBCJ

    Hi SAP Gurus,
    I am facing a problem with the T.Code FBCJ.  In our organisation we have several branches where they use to save the Cash Payment transactions, they do not post it.While posting the transaction at HO, if the authorised person finds that "Business Transaction" assigned to the line item is not correct and wants to correct the Transaction, the system does not permit for that. As the field where changes required remains in DISPALY MODE only. Then please help me how to go for the change in that particular Field of "Business Transaction".
    Please help me ASAP.
    Regards
    Rajesh

    Hi Rajesh,
    When you save a transaction in cash journal system updates your cash register and it generates a cash document number and this is different from the accouting document number. At the time of posting system posts this transaction into accouting and generates an accounting document.
    If system allows you to change the business transaction at the time of posting, then it means two different business transaction assignment for the same cash transaction, which should not be the case and is also not possible. Posting just posts the document in to accounting and if you want to change the business transaction, you need to cancel it and create it with the right business transaction.
    Hope this helps...
    regards,
    Rengaraj

  • Help regarding attaching smartform to a report program for QM module

    Hii,
    I have developed a certifiacate of analysis smartform for QM module and i attached it to a output type ...but i need to attach this smartform to a standard report RQCAAP01. can anyone help me what customizations i should do in report program in order to attach smartform.
    Regards,
    Venkat Akella.

    I attached smartform in NACE to LQCB output type but i should also make changes in report program RQCAAP01..can u please let me know what customizations i should do in tht report program to attach the smartform..

  • How to attach smartform to tcode F.27 while assgning the correspondance..

    Hello,
    Using OB96 tcode when we try to assign correspondance, I can see only provision for attaching the Script. Is there anyway, where we can attach SMARTFORM in the 'Form Name' column?
    Thanks,
    Jyoti

    Hi
    I am sorry, this FORUM is only for SAP Service Marketplace issues. Please open a customer message for your request.
    thanks and regards Martin

  • Attaching Smartform to a Z Screen

    Hi Guys,
    We have attached a Z Screen to Purchase Requisition Number screen to display Terms & Conditions (TCode: ME23n). To that Z screen I wish to attach Smartform which I have developed taking PR no as input which the screen is already displaying.
    Please let me know the required things like ( creating Work Area and Application) <b>in detail.</b>
    TIA,
    Nitin

    Hi Nitin,
    so thats very easy way of solving things.
    jst create a new output type say ,YNEU  in the nace output type EF and define the print program as the std one (SAPFM06p(i think)) and attach ur form...it will ask an customizing request number to do this ......by doing this way u can overcome the problem of the std putput type NEU.

  • Assign Smartforms to Transaction Code F.27

    How to assign SMARTFORMS to transaction Code F.27

    Hi,
    Refer to the link given below.
    http://help.sap.com/saphelp_nw04s/helpdata/en/6e/db0cee629b4f43a4f93f59e979aa8a/frameset.htm
    Regards
    Rajesh Kumar

  • Error in preparing cash journal through T code - FBCJ

    Hi All,
    The following error is throughing, while I am preparing cash journal through T code-FBCJ.
    1. Posting Date is initial.(Massage No F5669)
    2. Only enter initial document type for russian company code (Message. F5A402)
    3. Number range interval 01 does not exist (where number range is 01 is already exist)
    I am using ECC 6.0 software.
    Please suggest me how to solve the problem.
    Thanks,
    Sitansu.

    Hi.
    Answers for your query.
    1. Posting Date is initial.(Massage No F5669)
    Solution - Check posting date is matching with your period opened.
    2. Only enter initial document type for russian company code (Message. F5A402)
    Solution - Check with document type that is used for your company code
    3. Number range interval 01 does not exist (where number range is 01 is already exist)
    Solution - Check number ranges are created for current year.

  • In T.code FBCJ how reverse the cash receipt

    Hi
    Gurus
    In T.code FBCJ how to verse the cash receipt. i posted one document as follows:
    40 Petty cash Dr 50000
    50 State Bank Cr 50000
    Now i want reverse the above document.  it will not allow to reverse. 
    can any one please advise me.  How to reverse the cash receipt.
    iam awating.
    Anil

    Hi anil
    select the line item you want reverse
    goto edit and delete entry
    a message will come select yes and put reversal reasons and date
    a message will come that this line  item open to be cleared
    Thanks
    Ansuman

  • Configuration of smartform fir t-code: FB60,FB65

    Hi all,
    can anyone let me know,where exactly smartform for t-code FB60 and FB65 are configure.
    From which t-code are these smartform layouts seen?
    Is it from same t-codes .
    I came to know that it is seen in t-code: FBL1N.
    Is it enough if we copy the driver program that is there for already for script for a samrtform also?
    Kindly help me out in this issue.
    Thanks in advance.

    Double click the node then you will have the option to create before loop , after loop or during loop.
    When you will create before, after and during loops?
    Before-Loop will be created :
         The exit-before loop runs before the processing of the form level. The internal table that is the next to run is transferred to this exit. In this user exit you can also modify the table and the entries, for example to reorganize these or change values.
    You can use the exit-before loop to
          Read additional data from the database
          Initialize summation variables
          Sort the table entries to be processed
          Transmit new page commands for SAPscript
    During Loop will be created:
         The exit-during loop runs while the form level is being processed - immediately after data is transported to the respective work areas. Therefore, the work areas belonging to the relevant form level, to the corresponding 1:1 levels and to all form levels higher in the hierarchy can be used in this user exit. You must therefore use this user exit to perform summations.
      You can use the exit-during loop to:*
        Perform summations
        Read additional data from the database
    After loop will be created on
    The exit-after loop runs after the form level is processed after all the form levels lower in the hierarchy are processed. In this user exit you can transmit final instructions, for example you can prepare a total for expenditure or insert a manual page break.
       You can use the exit-after loop to:
    Analyze the summation
    Transmit new page commands for SAPscript
    Initialize totals fields.
    Regards,
    Siva

  • How to findout smartforms names attached to Standard T-Codes.

    Dear Gurus
    Is there anyway to find out which smartform is added to standard t-code
    Like in T-Code VF02
    there is a smartform attached when we click on the ISSUE OUTPUT.
    i want to know what is the name of that smartform..
    Regards
    Saad Nisar

    Hi Khatib,
    Use TNAPR table and provide program name to PGNAM and execute it. If it is attached to any output type configured through NACE then you will get script/smart form attached to this program but I am not sure there is an direct way to get output type for transaction code.
    As suggested by others, In NACE you can find output types based on Application. Select one of the application and click on output types to know the output types under an application.
    Thanks,
    Vinay

  • Attach Smartform to Transaction

    Hi
    Read n worked on all the tutorilas in SAP Technical .com n SDN on creating SmartForms n SmartStyles.
    How do we attach the form to the transaction eg. smartform to PO (ME21N) ?
    Though, general in its nature but not a question for interview so please regard as genuine enquiry.
    any help is appreciated.

    Hi
    When a Output type in an apllication doc is configured with a Medium, Partner, Lang and other communication paramters an entry is created in NAST table
    so to trigger the output an entry in NAST is compulsory
    Output is a link between the Driver Program and the Sapscript,
    An output type summarizes messages of the same meaning. It contains parameters that are valid for all its assigned messages, for example appropriate partner functions.
    Transmission medium is a medium which the layout will be come out, this may be printout, Fax or Mail
    Check this link.
    http://help.sap.com/saphelp_nw2004s/helpdata/en/c8/19884743b111d1896f0000e8322d00/content.htm
    ex-how to config output type.
    You will assign output types using Transaction NACE.
    Do the follow steps to assign output type
    1)Select Application Type V2 which will have description Shipping.
    2)Click on Output types button.
    3)Go to change mode by pressing Ctrl+F4.
    4)Select one output type which already exists
    5)Do Copy As(F6)
    6)Give your output type against Output Type field.
    7)Under General data Tab, Give Program and Form routine and Save the data.
    i think it a work of functional guy but at senior level i think it is not a big deal for abaper.
    Check the following documentation
    In NACE t-codewe have the application for each one. based on the application output type can be defined, based on output type script and print progrma can be defined.
    If suppose data can be read from EDI then we should go for condition records.
    So whenever we execute the script first composer checks the output type and then execute the program. in program whenever opn form FM will be populate then script will open first. After that again program till another FM will populate if it then script will populate........like it is cycle proces. Composer does all these things and at last it will submit that output to spool.
    Go to the Transaction NACE.
    choose the related sub module.. like billing or shipping
    doubel click on Output Types
    Choose the Output Type for which whcih you wanted your script to trigger
    Then select the Output Type and double click on Processing Routine
    Then go to create new entries--> Select the Medium (1- print output), then enter your Script and Print Program detls --> Save and come out
    Now go to the Transaction (for which you have created the output type)... Issue output--> Select the output type --> Print....
    Device Types for SAP Output Devices (Detail Information)
    Definition
    The device type indicates the type of printer to be addressed. When you define an output device, choose the name of the device type that was defined in the SAP System for your printer model, such as Post2 for a PostScript printer. In the case of frontend printing under Microsoft Windows, you can also use the generic (device-independent) device type SWIN.
    The system uses the information in the device type to convert a document from the internal SAP character representation (spool request in OTF or in text format) to a device-specific, print-ready data stream (output request). Since a device type specifies attributes that apply to all devices of a certain model, it can be shared among device definitions. For example, all devices in the SAP spool system that are compatible with Hewlett-Packard LaserJet IIID printers would use the HPLJIIID device type.
    You should not confuse the device type with the printer driver. The device type is the total of all attributes of an output device that the SAP System must know to control the output device correctly, such as control commands for font selection, page size, character set selection, and so on. These attributes also include the printer driver that SAPscript/Smart Forms (the SAP form processor) should use for this printer. The SAPscript printer driver that is to be used for devices of this type for output formatting is therefore only an attribute that the device type specifies.
    How do I choose the correct device type?
    • In most cases, the SAP System already provides the appropriate device type for the printer type for the printer model that you want to use.
    These standard device types are completely defined and need no modification or extension before you use them in device definitions.
    • You can also download missing device types from the sapserv server. For a current list of the supported device types, see SAP Note 8928 in the SAP Service Marketplace.
    • Most printers can be controlled using a generic format, such as PostScript. They can be switched to a mode that is compatible with one of the standard printers for which an SAP device type is available. In this case, a supported model is emulated.
    • Almost all printers are delivered with Microsoft Windows printer drivers. The system can control these printers with the generic (device-independent) device type SWIN. The Microsoft Windows spool system then performs the processing of the print data.
    • If the specified device types are not available, and generic device types cannot be used, you must create your own device type or edit a copy of an existing device type. We recommend that only those with specialist knowledge of the SAP Spool System and printer driver code do this. For more information, see Defining a New Device Type .
    Attributes of a Device Type
    A device type is distinguished by the attributes listed below. If you change an existing device type or create a new device type, you must change at least some of these attributes.
    • Character set: A character set specifies the codes with which characters must be represented in the print-ready output stream (output request). This code replaces the generic SAP characters set that is used internally by the SAP spool system (spool request).
    • Printer driver: You can specify different printer drivers for printing SAPscript documents and ABAP lists.
    • Print controls: Print controls represent printer operations, such as boldface or changing the font size. These print control are replaced by printer-specific commands during the creation of the output request from a spool request.
    • Formats: Formats specify the format supported by the SAP system. The system differentiates between SAPScript formats (DINA4 and LETTER) and ABAP list formats (X_65_132 = 65 rows/132 columns).
    • Page format: A page format is the interface between a format and SAPscript. It specifies the paper dimensions with which SAPScript can calculate the row and column lengths.
    • Actions: Actions are output device-specific commands that are required for the implementation of a format. The action printer initialization, for example, can contain a printer command with which the number of rows on a page is defined. There is a set of actions for every format supported by a device type.
    Nace
    If Found Help Full Do Reward.
    Regards.
    Eshwar.

  • Attaching smartform in NACE

    Hi all ,
          I am working with sale order smartform. i started it from scratch.i created  the form and the driver program. i used the parameter option in my the driver program to call the the smartform.
               now i have to attach it in the NACE transaction.
                 what all are the changes that has to be done in my driver program????
    Please find my codes.
    *& Report  ZSD_SALEORDER_DRIVER
    REPORT  ZSD_SALEORDER_DRIVER.
    PARAMETERS: DOCUMENT LIKE VBAK-VBELN.
    DATA : fm_name TYPE rs38l_fnam.
    CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
        EXPORTING
          formname                 =  'ZSALE_ORDER'
      VARIANT                  = ' '
      DIRECT_CALL              = ' '
       IMPORTING
         fm_name                   = fm_name
    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.
      CALL FUNCTION fm_name
        EXPORTING
      ARCHIVE_INDEX              =
      ARCHIVE_INDEX_TAB          =
      ARCHIVE_PARAMETERS         =
      CONTROL_PARAMETERS         =
      MAIL_APPL_OBJ              =
      MAIL_RECIPIENT             =
      MAIL_SENDER                =
      OUTPUT_OPTIONS             =
      USER_SETTINGS              = 'X'
       document                    = document
    *TABLES
         i_pfg                      = lt_pfg
    IMPORTING
      DOCUMENT_OUTPUT_INFO       =
      JOB_OUTPUT_INFO            =
      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.
    Thanks in advance

    Follow this sample example
    Goto Transaction NACE --> Select Application V1(Sales) --> Click on Output Types --> Select the output type as BA00 (as generally BA00 is the output type associated with Sales Order ) --> Double click on the Processing Routines folder on the left and it will display the Form name and the corresponding driver programs name.
    Close the thread if your question is answered.
    Regards,
    SaiRam

  • Opening and closing balance diff.In T.code FBCJ

    Hi exports,
    While we r checking Fbcj T.code for a day, the the closing balance of the day is difference for the next day opening balance.What is the reason behind that.
    Eg. In FBCJ-
    30.3.2010       closing balance is      46,888.00/-
    31.3.2010       Opening balance is    46,874.00/-
    So how to solve.
    Thanks
    Rohit

    Hello Rohit!
    Run the report RFCJ1 to delete the balance table TCJ_BALANCE. This table
    exists for performance reasons only. The balance table is regenerated   
    when the cash journal is used.                                          
    Now check the balance in the cash journal - the balance displayed       
    corresponds to the actual total of the line items.                      
    The behaviour is explained in the SAP Note:  1309577 - FBCJ: Incorrect balance in cash journal .
    REgards,
    REnan

  • Problem by  Sending an Email with attached Adobe Interactive Form (Code)

    Thanks. I have written Programm, but it does not work as i want it to do. I will send an Email with attached Adobe Interactive Firm to [email protected]. I tried it with "*lo_recipient = cl_sapuser_bcs=>create( sy-uname )" at the marked(bold, fat) position. It worked but the Email was send to my SAP-Account, but i want to send to [email protected], so I tried this (see at code in bold, fat):
    lo_rec TYPE adr6-smtp_addr VALUE '[email protected]'. " Empfänger Receiver
    lo_recipient = cl_cam_address_bcs=>create_internet_address( lo_rec ).
    But it doens`t send the email.
    Can anybody help me please???
    Kevin
    Here my Code:
    Report FP_EXAMPLE_01
    Printing of documents using PDF based forms
    REPORT z_example_02.
    Data declaration
    DATA: carr_id TYPE sbook-carrid,
    customer TYPE scustom,
    bookings TYPE ty_bookings,
    connections TYPE ty_connections,
    fm_name TYPE rs38l_fnam,
    fp_docparams TYPE sfpdocparams,
    fp_outputparams TYPE sfpoutputparams,
    error_string TYPE string,
    l_booking TYPE sbook,
    t_sums TYPE TABLE OF sbook,
    l_sums LIKE LINE OF t_sums,
    fp_formoutput TYPE fpformoutput.
    PARAMETER: p_custid TYPE scustom-id DEFAULT 38.
    SELECT-OPTIONS: s_carrid FOR carr_id DEFAULT 'AA' TO 'ZZ'.
    PARAMETER: p_form TYPE tdsfname DEFAULT 'FP_EXAMPLE_01'.
    PARAMETER: language TYPE sfpdocparams-langu DEFAULT 'E'.
    PARAMETER: country TYPE sfpdocparams-country DEFAULT 'US'.
    Get data from the following tables: scustom(Flight customer)
    sbook (Single flight reservation)
    spfli (Flight plan)
    SELECT SINGLE * FROM scustom INTO customer WHERE id = p_custid.
    CHECK sy-subrc = 0.
    SELECT * FROM sbook INTO TABLE bookings
    WHERE customid = p_custid
    AND carrid IN s_carrid
    ORDER BY PRIMARY KEY.
    SELECT * FROM spfli INTO TABLE connections
    FOR ALL ENTRIES IN bookings
    WHERE carrid = bookings-carrid
    AND connid = bookings-connid
    ORDER BY PRIMARY KEY.
    Print data:
    First get name of the generated function module
    CALL FUNCTION 'FP_FUNCTION_MODULE_NAME'
    EXPORTING
    i_name = p_form
    IMPORTING
    e_funcname = fm_name.
    IF sy-subrc <> 0.
    MESSAGE e001(fp_example).
    ENDIF.
    Set output parameters and open spool job
    fp_outputparams-nodialog = 'X'. " suppress printer dialog popup
    fp_outputparams-getpdf = 'X'. " launch print preview
    CALL FUNCTION 'FP_JOB_OPEN'
    CHANGING
    ie_outputparams = fp_outputparams
    EXCEPTIONS
    cancel = 1
    usage_error = 2
    system_error = 3
    internal_error = 4
    OTHERS = 5.
    Set form language and country (->form locale)
    fp_docparams-langu = language.
    fp_docparams-country = country.
    *fp_docparams-fillable = 'X'.
    *fp_docparams-langu = 'E'. "wird jetzt automatisch gesetzt, bzw. kann dynamisch verändert werden
    *fp_docparams-country = 'GB'. "wird jetzt automatisch gesetzt, bzw. kann dynamisch verändert werden
    currency key dependant summing
    LOOP AT bookings INTO l_booking.
    l_sums-forcuram = l_booking-forcuram.
    l_sums-forcurkey = l_booking-forcurkey.
    COLLECT l_sums INTO t_sums.
    ENDLOOP.
    Now call the generated function module
    CALL FUNCTION fm_name
    EXPORTING
    /1bcdwb/docparams = fp_docparams
    customer = customer
    bookings = bookings
    connections = connections
    t_sums = t_sums
    IMPORTING
    /1bcdwb/formoutput = fp_formoutput
    EXCEPTIONS
    usage_error = 1
    system_error = 2
    internal_error = 3
    OTHERS = 4.
    IF sy-subrc <> 0.
    CALL FUNCTION 'FP_GET_LAST_ADS_ERRSTR'
    IMPORTING
    e_adserrstr = error_string.
    IF NOT error_string IS INITIAL.
    we received a detailed error description
    WRITE:/ error_string.
    EXIT.
    ELSE.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.
    ENDIF.
    Close spool job
    CALL FUNCTION 'FP_JOB_CLOSE'
    EXCEPTIONS
    usage_error = 1
    system_error = 2
    internal_error = 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.
    *********************Send the form*******************
    *********************to the Customer*****************
    *********************via Email***********************
    *IF i_down = abap_true.
    DATA: filename TYPE string,
    path TYPE string,
    fullpath TYPE string,
    default_extension TYPE string VALUE 'PDF'.
    Data:
    lt_att_content_hex TYPE solix_tab.
    *DATA: data_tab TYPE TABLE OF x255.
    CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
    EXPORTING
    buffer = fp_formoutput-pdf
    TABLES
    binary_tab = lt_att_content_hex.
    CLASS cl_bcs DEFINITION LOAD.
    DATA:
    lo_send_request TYPE REF TO cl_bcs VALUE IS INITIAL.
    lo_send_request = cl_bcs=>create_persistent( ).
    DATA:
    lt_message_body TYPE bcsy_text VALUE IS INITIAL.
    DATA: lo_document TYPE REF TO cl_document_bcs VALUE IS INITIAL.
    APPEND 'Dear Vendor,' TO lt_message_body.
    APPEND ' ' TO lt_message_body.
    APPEND 'Please fill the attached form and send it back to us.'
    TO lt_message_body.
    APPEND ' ' TO lt_message_body.
    APPEND 'Thank You,' TO lt_message_body.
    lo_document = cl_document_bcs=>create_document(
    i_type = 'RAW'
    i_text = lt_message_body
    i_subject = 'Vendor Payment Form' ).
    DATA: lx_document_bcs TYPE REF TO cx_document_bcs VALUE IS INITIAL.
    TRY.
    lo_document->add_attachment(
    EXPORTING
    i_attachment_type = 'PDF'
    i_attachment_subject = 'Vendor Payment Form'
    i_att_content_hex = lt_att_content_hex ).
    CATCH cx_document_bcs INTO lx_document_bcs.
    ENDTRY.
    lo_send_request->set_document( lo_document ).
    DATA:
    lo_sender TYPE REF TO if_sender_bcs VALUE IS INITIAL,
    lo_send TYPE adr6-smtp_addr VALUE '[email protected]'. "Absender SENDER
    lo_sender = cl_cam_address_bcs=>create_internet_address( lo_send ).
    Set sender
    lo_send_request->set_sender(
    EXPORTING
    i_sender = lo_sender ).
    Create recipient
    DATA:
    lo_recipient type ref to if_recipient_bcs value is initial.
    Data:
    lo_rec TYPE adr6-smtp_addr VALUE '[email protected]'. " Empfänger Receiver
    lo_recipient = cl_cam_address_bcs=>create_internet_address( lo_rec ).
    *lo_recipient = cl_sapuser_bcs=>create( sy-uname ).
    Set recipient
    lo_send_request->add_recipient(
    EXPORTING
    i_recipient = lo_recipient
    i_express = 'X' ).
    *lo_send_request->add_recipient(
    *EXPORTING
    *i_recipient = lo_recipient
    *i_express = 'X' ).
    Send email
    DATA: lv_sent_to_all(1) TYPE c VALUE IS INITIAL.
    lo_send_request->send(
    EXPORTING
    i_with_error_screen = 'X'
    RECEIVING
    result = lv_sent_to_all ).
    COMMIT WORK.
    MESSAGE 'The payment form has been emailed to the Vendor' TYPE 'I'.

    Hi Kevin,
    Please try this code to send your mail, i wrote it and works well in many system.
    Take care if in your profile you got an e-mail adress define .
    Take care also of trnasaction SCOT customizing, are you able to send mail to e-mail adress ?
    Let me know if it's works.
    Best regards.
    <i>**----
    CLASS-DEFINITIONS
    DATA: send_request       TYPE REF TO cl_bcs.
    DATA: document           TYPE REF TO cl_document_bcs.
    DATA: sender             TYPE REF TO cl_sapuser_bcs.
    DATA: recipient          TYPE REF TO if_recipient_bcs.
    INTERNAL TABLES
    DATA: l_mailtext TYPE soli_tab.
    DATA: iaddsmtp   TYPE TABLE OF bapiadsmtp.
    DATA: ireturn    TYPE TABLE OF bapiret2.
    VARIABLES
    DATA: mail_line  LIKE LINE OF l_mailtext.
    DATA: bapiadsmtp         TYPE bapiadsmtp.
    DATA: subject    TYPE so_obj_des.
    DATA : att_subject TYPE so_obj_des.
    DATA : w_except TYPE REF TO cx_root .
    CONSTANTS : c_defmail TYPE ad_smtpadr VALUE
                     '[email protected]' .
    FIELD-SYMBOLS : <smtp> TYPE bapiadsmtp.
    *Convert the pdf given by function module into Binary .
    CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
      EXPORTING
        buffer     = output-pdf "PDF file from function module
      TABLES
        binary_tab = hexa.
    *Set subject of the mail
    subject = 'Exemple de PDF interactif'.
    Set text of the mail
    mail_line = 'Merci de remplir le formulaire et nous le retourner'.
    APPEND mail_line TO l_mailtext .
    Set the name of the attached document
    att_subject = 'Template du PDF'.
    TRY.
    Create persistent send request
        send_request = cl_bcs=>create_persistent( ).
    Get sender object
        sender = cl_sapuser_bcs=>create( sy-uname ).
    Add sender
        CALL METHOD send_request->set_sender
          EXPORTING
            i_sender = sender.
    Read the E-Mail address for the user
        CALL FUNCTION 'BAPI_USER_GET_DETAIL'
          EXPORTING
            username = sy-uname
          TABLES
            return   = ireturn
            addsmtp  = iaddsmtp.
        LOOP AT iaddsmtp ASSIGNING <smtp> WHERE std_no = 'X'.
          CLEAR bapiadsmtp.
          MOVE <smtp> TO bapiadsmtp.
        ENDLOOP.
        CASE bapiadsmtp-e_mail.
          WHEN space.
    No adress main for user, so send it to the default mail adress
            recipient =
         cl_cam_address_bcs=>create_internet_address( c_defmail ).
          WHEN OTHERS.
            recipient =
         cl_cam_address_bcs=>create_internet_address( bapiadsmtp-e_mail ).
        ENDCASE.
    Add recipient with its respective attributes to send request
        CALL METHOD send_request->add_recipient
          EXPORTING
            i_recipient  = recipient
            i_express    = 'X'
            i_copy       = space
            i_blind_copy = space
            i_no_forward = space.
    Set that you don't need a Return Status E-mail
        CALL METHOD send_request->set_status_attributes
          EXPORTING
            i_requested_status = 'E'
            i_status_mail      = 'E'.
    set send immediately flag
        send_request->set_send_immediately( 'X' ).
    *Build Document
        document = cl_document_bcs=>create_document(
                            i_type    = 'RAW'
                            i_text    = l_mailtext
                            i_subject = subject ).
        add attachment to document
        CALL METHOD document->add_attachment
          EXPORTING
            i_attachment_type    = 'PDF'
            i_attachment_subject = att_subject
            i_att_content_hex    = hexa.
    Add document to send request
        CALL METHOD send_request->set_document( document ).
    Send document
        CALL METHOD send_request->send( ).
        COMMIT WORK.
      CATCH cx_send_req_bcs INTO w_except.
      CATCH cx_address_bcs INTO w_except.
      CATCH cx_document_bcs INTO w_except.
    ENDTRY.</i>

  • Want to attach smartform as workitem but it doesn't work.

    Dear Experts,
    I want attach 'SMARTFROMS' or PWB Forms as workitem attachment but i couild not able to do .My method code is as follows...
    function zbi_bill_revision_v1.
    ""Local Interface:
    *"  IMPORTING
    *"     REFERENCE(WID) TYPE  SWW_WIID
    *"     REFERENCE(L_DOCNO) TYPE  E_PRINTDOC
    *"  EXPORTING
    *"     REFERENCE(L_WID) TYPE  SWW_WIID
    data: l_wid type SWW_WIID.
      include <cntn01>.
      types : begin of ty_i_tline,
               i_tline  type tline,
              end of ty_i_tline.
      data: ls_control_parameters type ssfctrlop,
            w_compop         type ssfcompop,
            w_return         type ssfcrescl,
            v_len_in         type so_obj_len,
            it_i_otf         type itcoo occurs 0 with header line,
            it_i_tline       type table of ty_i_tline,
         it_zbillasses    TYPE zbill_assessment,
            out_opt          type ssfctrlop,
            fm_name          like rs38l-name,
            test_flag        type sysubrc,
            message_lines    type standard table of  swr_messag,
            message_struct   type standard table of swr_mstruc,
            att_head         type swr_att_header,
            it_solix_tab     type tsfixml,
           wid              TYPE sww_wiid,
            att_id           type swr_att_id,
            l_c              type efg_strn_printdata,
           wa_assesment     type zbill_assessment,
            wa_bill_ht       type zbill_invoice_ht.
         w_compop         type ssfcompop.
    CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
       EXPORTING
         formname                 = 'ZFORMBI_HIGH_TENSION_EMAIL'
      VARIANT                  = ' '
      DIRECT_CALL              = ' '
      IMPORTING
        fm_name                   = fm_name
      EXCEPTIONS
        no_form                   = 1
        no_function_module        = 2
        OTHERS                    = 3
    IF sy-subrc <> 0.
    ENDIF.
    CALL FUNCTION 'SSF_GET_DEVICE_TYPE'
       EXPORTING
         i_language             = sy-langu
       IMPORTING
         e_devtype              = w_compop-tdprinter
       EXCEPTIONS
         no_language            = 1
         language_not_installed = 2
         no_devtype_found       = 3
         system_error           = 4
         OTHERS                 = 5.
    IF sy-subrc <> 0.
    ENDIF.
    w_compop-tdnoprev               = 'X'.
    ls_control_parameters-getotf    = 'X'.
    ls_control_parameters-no_dialog = 'X'.
    DATA: it_isu_bi_bill_s_doc_header TYPE isu_bi_bill_s_doc_header.
    CALL FUNCTION '/1BCDWB/SF00000426'
       EXPORTING
      ARCHIVE_INDEX              =
      ARCHIVE_INDEX_TAB          =
      ARCHIVE_PARAMETERS         =
        control_parameters         = ls_control_parameters
      MAIL_APPL_OBJ              =
      MAIL_RECIPIENT             =
      MAIL_SENDER                =
        output_options             = w_compop
        user_settings              = 'X'
         pwb_data                   = it_isu_bi_bill_s_doc_header
         c                          = l_c
         wa_bill_ht                 = wa_bill_ht
      IMPORTING
      DOCUMENT_OUTPUT_INFO       =
        job_output_info            = w_return
      JOB_OUTPUT_OPTIONS         =
      EXCEPTIONS
        formatting_error           = 1
        internal_error             = 2
        send_error                 = 3
        user_canceled              = 4
        OTHERS                     = 5
    IF sy-subrc <> 0.
    ENDIF.
    it_i_otf[] = w_return-otfdata[].
    CLEAR w_return-otfdata[].
      data: x_printparams   type eprintparams,
              it_ranges     type standard table of efg_ranges,
              wa_ranges     type efg_ranges,
              c_fclass(12)  type c value 'IS_U_BI_BILL',
              lt_itcoo      type standard table of itcoo,
              g_docno       type erdk-opbel.
    clear: wa_erdk.
      select single *
        from erdk
          into wa_erdk
            where opbel = l_docno.
      x_printparams-formkey   = wa_erdk-formkey.
      x_printparams-tdnoprev  = 'X'.
      x_printparams-tdnoprint  = 'X'.
    x_printparams-NO_OPEN_FORM = 'X'.
    x_printparams-NO_CLOSE_FORM = 'X'.
      x_printparams-tdgetotf = 'X'.
      x_printparams-formclass = c_fclass.
      wa_ranges-low           = wa_erdk-opbel.
      append wa_ranges to it_ranges.
    data : x_header  type  rfgen-header.
      call function 'EFG_PRINT'
        exporting
        X_HEADER                    = X_HEADER
          x_printparams               = x_printparams
        X_ARCHIVE_INDEX             =
        X_ARCHIVE_PARAMS            =
         x_dialog                    = ' '
        X_RECIPIENT                 =
        X_SENDER                    =
        X_STRN_COLLINFO             =
        X_TABN_SEL_PER_FCLASS       =
        REF_LOG                     = CL_EFG_LOG_NULL=>S
        I_FLG_EMSG                  = '+'
      IMPORTING
        Y_ITCPP                     =
        Y_RDI_RESULT                =
        Y_PRINTPARAMS               =
        Y_SF_RESULT                 =
        Y_TAB_GENDATA               =
        Y_TABN_SEL_PER_FCLASS       =
        Y_PDF_RESULT                =
        tables
          xt_ranges                   = it_ranges
        XT_RANGES1                  =
        XT_RANGES2                  =
        XT_RANGES3                  =
        XT_RANGES4                  =
        XT_RANGES5                  =
        XT_RANGES6                  =
        XT_RANGES7                  =
        XT_RANGES8                  =
        XT_RANGES9                  =
         yt_otf_data                  = lt_itcoo
       exceptions
         not_qualified               = 1
         formclass_not_found         = 2
         form_not_found              = 3
         formclass_invalid           = 4
         print_failed                = 5
         form_invalid                = 6
         cancelled                   = 7
         func_invalid                = 8
         not_authorized              = 9
         others                      = 10
      if sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      endif.
      data: pdf_bin type xstring,
            l_size type i.
      call function 'CONVERT_OTF'
        exporting
          format                = 'PDF'
          max_linewidth         = 132
        importing
          bin_filesize          = l_size
          bin_file              = pdf_bin
        tables
          otf                   = lt_itcoo[]
          lines                 = it_i_tline
        exceptions
          err_max_linewidth     = 1
          err_format            = 2
          err_conv_not_possible = 3
          err_bad_otf           = 4.
      call function 'SCMS_XSTRING_TO_BINARY'
        exporting
          buffer                = pdf_bin
      APPEND_TO_TABLE       = ' '
       importing
         output_length          = l_size
        tables
          binary_tab            = it_solix_tab
      att_head-file_type = 'B'.
      att_head-file_name = 'Billing Revision'.
      att_head-file_extension = 'PDF'.
      att_head-language = 'EN'.
    l_wid = wid + 2.
      call function 'SAP_WAPI_ATTACHMENT_ADD'
      exporting
        workitem_id          = wid
        att_header           = att_head
        att_txt              = 'Bill Assessment'
        att_bin              = pdf_bin
       document_owner       = sy-uname
       language             = sy-langu
      DO_COMMIT            = 'X'
    importing
       return_code          = test_flag
       att_id               = att_id
    tables
       message_lines        = message_lines
       message_struct       = message_struct.
    endfunction.
    when execute code it shows attachment successfully created but it does'nt show in attachment.
    Edited by: GURPRIT BHATIA on Jun 18, 2010 8:46 AM

    Hi,
    Pls explain it.
    I am also facing problem.
    Thanks
    Ragaven

Maybe you are looking for

  • How to recover deleted iTunes music folder

    Hi I uninstalled iTunes due to performance issues with the intention of using an external hard drive. Unfortunately I have also deleted the user/music/iTunes folder as well. It is not in the recycle bin as it was 46gb! Can someone please help me? The

  • Purchase Order - Pricing - Quantity scale from inforecord...

    Gurus Today we are running purchase order item pricing - where we have prices in inforecord - quantity scale prices... We have only one plant - and inforrecords are created for plant AAA. Quantity scale prices for plant AAA => material 801020 Qty 2 =

  • DAC 10.1.3.4.1 Services not starting up|| Error "cannot authenticate user"

    Hi, We have installed DAC server in Linux machine and client on windows. By using DAC client we restored the backup of DAC repository, DAC client was working fine still restoration and after restoring it's not logging in. It throws error like "Can't

  • CJI3 - Posting date

    Hi Guys, When I am running CJI3 the posting date is coming by default as this month like if i am running in this month, it is defaulting to 06/01/2009 to 06/30/2009. How can i stop that default or when can i control that. I dont want it to be default

  • Determine System free memory (Not memory allocated to JVM)

    Hi, I have a Swing application in which I am trying to display the available free memory and total memory for the client machine on which it is running. Runtime.getRuntime().freeMemory() and Runtime.getRuntime().totalMemory() gives me relative to the