SMARTFORM MODIFICATION

Hai SDNs,
               Please help me regarding STANDARD FORM ( Smart Form ) Modification.
Thanks in advance.
Regards,
aravind.

Hi,
Copy the Std Smartform into ZSMARTFORM and do the modifications as per your requirement.
You have to attach this Z Smartform in the NACE transaction as per your application document Output  Type.
Some times you have to modify the Std program also by copying it into Z program, such that this Smartform has to be called instead of the Std Script.
First Copy and modify the smartform and attach, see the output and check whether this smartform is triggering or not , if not then have to modify the std program by copying into Z program and attach the Z program and Z smartform and check.
Regards,
Anji

Similar Messages

  • About smartforms modification

    where to define tables used in smartform to generate invoice, what should be the fields for internal table. pls let me know

    Check the standard driver program for INVOICE SMARTFORMS RLB_INVOICE and the Smartforms u can look upto is LB_BIL_INVOICE

  • Purchase Order printing by smartforms

    Hi all
    I am trying to print PO by Smartforms. Problem is that this has to be done copying standard program. How to go about it. I searched the forum and it talked about the driver program /BPR3PF/FM06P and preconfigured Smartform /BPR3PF/MMPO_L both of which I did not find in our system (ECC 6.0) We have an up and running Sapscript PO system, but our company needs some modifications and we are familiar only with Smartforms.....any help....broad outlines?
    Thanks and best regards
    Subin

    In Standard PO  calling the script ,so the standard program SAPFM06P userful for script only
    And if  u want change script  to smart forms then you need to add your driver program .
    Steps to create Driver Program  :-
    First create the create Z Program SAPFM06P like below(Subroutine Pool)
    PROGRAM Zsapfm06P.
      TYPE-POOLS:    meein.
      INCLUDE RVADTABL.
      INCLUDE FM06P_CONST.
      INCLUDE Zfm06pe02.
    Next step is to create Zfm06pe02.
    *&  Include           ZFM06PE02
    form entry_neu using ent_retco ent_screen.
    data: l_druvo like t166k-druvo,
           l_nast like nast,
           l_from_memory,
           l_doc type meein_purchase_doc_print.
    * * Data Declaration for PO smartform Modification
    DATA: fname TYPE rs38l_fnam,
           xkomk TYPE TABLE OF komk,
           gs_output TYPE ssfcompop,
           gs_dialog TYPE ssfctrlop.
           clear ent_retco.
           if nast-aende eq space.
                l_druvo = '1'.
           else.
                l_druvo = '2'.
           endif.
         call function 'ME_READ_PO_FOR_PRINTING'
             exporting ix_nast = nast
                       ix_screen = ent_screen
             importing ex_retco = ent_retco
                       ex_nast = l_nast
                          doc = l_doc
             changing cx_druvo = l_druvo
                      cx_from_memory = l_from_memory.
             check ent_retco eq 0.
                 IF tnapr-sform NE ' '.
                   CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
                   EXPORTING formname = tnapr-sform
                   IMPORTING fm_name = fname
                   EXCEPTIONS
                       no_form = 1
                       no_function_module = 2
                       OTHERS = 3.
       IF sy-subrc EQ 0.
          gs_dialog-no_dialog = 'X'.
          gs_dialog-preview = 'X'.
          gs_output-tddest = 'LP01'.
          gs_output-tdnoprev = ' '.
          gs_output-tdnoprint = ' '.
          gs_output-tdimmed = 'X'.
          gs_output-tdnewid = 'X'.
          CALL FUNCTION fname
    " modify the interface as per your needs
            EXPORTING control_parameters = gs_dialog
                      output_options = gs_output
                      user_settings = ' '
                      zxekko = l_doc-xekko
                      zxpekko = l_doc-xpekko
            TABLES l_xekpo = l_doc-xekpo
                   l_xekpa = l_doc-xekpa
                   l_xpekpo = l_doc-xpekpo
                   l_xeket = l_doc-xeket
                   l_xtkomv = l_doc-xtkomv
                   l_xekkn = l_doc-xekkn
                   l_xekek = l_doc-xekek
                   l_xkomk = xkomk
            EXCEPTIONS formatting_error = 1
                       internal_error = 2
                       send_error = 3
                       user_canceled = 4
                       OTHERS = 5.
       ELSE.
             CALL FUNCTION 'ME_PRINT_PO'
                 EXPORTING ix_nast = l_nast
                           ix_druvo = l_druvo
                           doc = l_doc
                         ix_screen = ent_screen
                      ix_from_memory = l_from_memory
                      ix_toa_dara = toa_dara
                      ix_arc_params = arc_params
                     ix_fonam = tnapr-fonam "HW 214570
                 IMPORTING ex_retco = ent_retco.
        ENDIF.
    ELSE.
         CALL FUNCTION 'ME_PRINT_PO'
             EXPORTING ix_nast = l_nast
                       ix_druvo = l_druvo
                       doc = l_doc
                       ix_screen = ent_screen
                       ix_from_memory = l_from_memory
                      ix_toa_dara = toa_dara
                      ix_arc_params = arc_params
                      ix_fonam = tnapr-fonam "HW 214570
              IMPORTING ex_retco = ent_retco.
    ENDIF.
    endform.
    So After creating Driver program attach the program using NACE.
         Details of the nace Config as follow
      Driver Program  -- ZSAPFM06P routine will be  - ENTRY_NEU  script form -  ZMM_Purchase_Order(SF)

  • Purchase Order Driver Program Not loading SMARTFORM

    Hi,
    I have developed Z smartform by copying from standard form and tried to call from standard program only but here I am not able to call my Z smartform and I am able to call only Z SAPSCRIPT from this standard program.
    I have done all the necessary changes in NACE transaction but then also only when I keep the script name its working fine but when I replace this by smartform name the driver program is not calling smartform .!! why?
    Please do let me know why is it like this?
    Thanks
    Sudharshan

    Hi,
    PO driver program is written to support only SAPSCRIPT. So if you want to assign smartform in NACE, you should take a Zcopy of the driver program SAPFM06P with its include FM06PE02 as ZFM06PE02. And give the zprogram against the driver program field in NACE.
    Then you need to replace the entry_nue subroutine in ZFM06PE02 with the below code.
    form entry_neu using ent_retco ent_screen.
      data: l_druvo like t166k-druvo,
            l_nast  like nast,
            l_from_memory,
            l_doc   type meein_purchase_doc_print.
    * Data Declaration for PO smartform Modification
    DATA: fname TYPE rs38l_fnam,
            xkomk TYPE TABLE OF komk,
            gs_output TYPE ssfcompop,
            gs_dialog TYPE ssfctrlop.
      clear ent_retco.
      if nast-aende eq space.
        l_druvo = '1'.
      else.
        l_druvo = '2'.
      endif.
      call function 'ME_READ_PO_FOR_PRINTING'
           exporting
                ix_nast        = nast
                ix_screen      = ent_screen
           importing
                ex_retco       = ent_retco
                ex_nast        = l_nast
                doc            = l_doc
           changing
                cx_druvo       = l_druvo
                cx_from_memory = l_from_memory.
      check ent_retco eq 0.
       IF tnapr-sform NE ' '.
        CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
          EXPORTING
            formname           = tnapr-sform
          IMPORTING
            fm_name            = fname
          EXCEPTIONS
            no_form            = 1
            no_function_module = 2
            OTHERS             = 3.
        IF sy-subrc EQ 0.
            gs_dialog-no_dialog = 'X'.
            gs_dialog-preview = 'X'.
            gs_output-tddest = 'LP01'.
            gs_output-tdnoprev = ' '.
            gs_output-tdnoprint = ' '.
            gs_output-tdimmed = 'X'.
            gs_output-tdnewid = 'X'.
         CALL FUNCTION fname  " modify the interface as per your needs
            EXPORTING
              control_parameters = gs_dialog
              output_options     = gs_output
              user_settings      = ' '
              zxekko             = l_doc-xekko
              zxpekko            = l_doc-xpekko
            TABLES
              l_xekpo            = l_doc-xekpo
              l_xekpa            = l_doc-xekpa
              l_xpekpo           = l_doc-xpekpo
              l_xeket            = l_doc-xeket
              l_xtkomv           = l_doc-xtkomv
              l_xekkn            = l_doc-xekkn
              l_xekek            = l_doc-xekek
              l_xkomk            = xkomk
            EXCEPTIONS
              formatting_error   = 1
              internal_error     = 2
              send_error         = 3
              user_canceled      = 4
              OTHERS             = 5.
        ELSE.
          CALL FUNCTION 'ME_PRINT_PO'
            EXPORTING
              ix_nast        = l_nast
              ix_druvo       = l_druvo
              doc            = l_doc
              ix_screen      = ent_screen
              ix_from_memory = l_from_memory
              ix_toa_dara    = toa_dara
              ix_arc_params  = arc_params
              ix_fonam       = tnapr-fonam                      "HW 214570
            IMPORTING
              ex_retco       = ent_retco.
        ENDIF.
      ELSE.
        CALL FUNCTION 'ME_PRINT_PO'
          EXPORTING
            ix_nast        = l_nast
            ix_druvo       = l_druvo
            doc            = l_doc
            ix_screen      = ent_screen
            ix_from_memory = l_from_memory
            ix_toa_dara    = toa_dara
            ix_arc_params  = arc_params
            ix_fonam       = tnapr-fonam                        "HW 214570
          IMPORTING
            ex_retco       = ent_retco.
      ENDIF.
    endform.
    While calling the smartform modify the fm interface to your needs.
    This will solve your problem.
    Regards
    Karthik D

  • Activation problem of smartform after modification

    hi all,
    when i am creating a smartform and checking and activating it all process is working well for the first time.But after activating once if i am doing any modification and again saving it,the check is successfull but the <b>activation step of</b> the form lead to hang the system(the sandclock).....
    this problem  i have faced first time...i have done the modification in smart forms in past again and again wen i was in bangalore but  this problem never came...can anybody help me out in this......

    Hi,
    There is a posibility of form not being generated if the form is very big or system is very slow.
    If the form takes more time to generate and if the session expires the form won't be generated in foreground.
    So, try to generate the from in the backgound. Run and Submit the program SF_BATCH_GENERATE giving the form name.
    Regards,
    Satish.

  • Can we make modification to the smartform generated FM?

    Hello Friends,
    Can we make modification to the smartform auto generated FM?
    If yes, please let me know the procedure.
    Thanks,
    Shreekant

    if u modify your SF it will automatically modify that FM.
    what is the need of modifying the FM
    <b>Reward If USEFUL</b>

  • Smartforms-invoice modification

    hi,
    kindly help me that, one zinvoice is there is smartforms, i have to change the font size as well as more changes of the particular invoice, let me know how to do the changes. In smartforms i am not familier, help me out pls.
    thanks,
    sujatha

    hi ,
    steps:-
    1)use txn smartforms ,create a style
    2)in that style create paragraph formate , character formate
    3)go to smartform , and than corresponding window
    4) go to output option & put name of created style
    5)go to general attributes and use ur Paragarph formate & character formate
    regards
    Gaurav Khare

  • Modification in smartforms

    i hav to modify a smart form invoice........I hav to print some other data so wat r the changes we required from the smart form & from the coding portion........reply me soon it urgent.

    Hi Ankit,
    One you have to change the form from the transaction as mentioned SMARTFORMS. change it as per your needs however if you change the interface of the smartform i.e. if you add any parameter variable or table to be passed to the form then you have to call the newly generated function module in the driver program. Or just add the new parameter you have added the smartform in the driver program appropriately.
    Hope this gives you an idea on how to proceed.
    <b>Always reward points to useful suggestions.</b>
    regards,
    Vikas

  • Smartforms - difference in auto-generated FM name in different systems

    Hi,
    The situation is:
    I have created a smartform in our Dev application server and tested it to achieve the view I needed. The Dev system generates FM with automatic name /1BCDWB/SF00000005. I have successfuly transported it to our test system and checked with data. After some short time I found an error in smartform and made a fix in a Dev. system. When trying to test it I found that the system modifies the FM name to /1BCDWB/SF00000006. This leads to modification in my source code, from where I call this FM with actual parameters (not test).
    The problem occures when I transported both the smartform and report from where I call it to the test system again. I obtained a shortdump with message like:
    '...FM /1BCDWB/SF00000006 does not exist...'
    After short investigation I have found, that in our Test system this smartform still generates *** and corresponds to *** the FM with name /1BCDWB/SF00000005.
    Next, I'm unable to transport FuGr /1BCDWB/SF00000006 from Dev. to Test because it does not have Dev.Class assosiated and asks for Licence Key (furthermore, I'm not sure this should be done in this way).
    Now in our Dev system FM named /1BCDWB/SF00000005 corresponds to another smartform (made by me more than year ago).
    And, what is pitty, If I try to release a transport with report which calls FM named /1BCDWB/SF00000005 from Dev, I have about 17 extended program errors (during extended program check) saying that 'there is no such FM'...
    For me this is missing of some consistency. What should I do to get consistency between our systems back? (means to have corresponding smartform relation to the same FM name in all the systems)
    Any help whould be highly appreciated.
    Many thanks in advance.
    Regards,
    Ivaylo Mutafchiev
    SAP BC Consumtant

    Hi Ivaylo
    Smartforms Name are system dependant !
    They are dynamically generated.
    You have to use :
    data : function_name type rs38l_fnam.
      call function 'SSF_FUNCTION_MODULE_NAME'
        exporting
          formname           = 'ZFORM_NAME' "Smartform name
          direct_call        = 'X'
        importing
          fm_name            = function_name
        exceptions
          no_form            = 1
          no_function_module = 2
          others             = 3.
      if sy-subrc <> 0.
      erreur.
      endif.
    and then, you call your smartform with :
    call function function_name
          exporting
      ARCHIVE_INDEX              =
      ARCHIVE_INDEX_TAB          =
      ARCHIVE_PARAMETERS         =
          control_parameters         = st_ssfctrlop
      MAIL_APPL_OBJ              =
      MAIL_RECIPIENT             =
      MAIL_SENDER                =
          output_options             = st_ssfcompop
          user_settings              = ' '
    Good luck,
    Regards,
    Erwan.
    Message was edited by: Erwan LE BRUN

  • Smartforms error

    Hi experts
    i did a print prg for sending the pdf attachment by smartforms.
    but it's getting dumpped,this is my code
    plz help me,its urgent.
    i checked even SDN Forums also.i made some changes,
    even though i don't get the output.
    it shows not matching the I_OBJBIN in "SO_NEW_DOCUMENT_ATT_SEND_API1" function module.
    REPORT  ZCS_SF6.
    Internal Table declarations
    DATA: i_otf TYPE itcoo OCCURS 0 WITH HEADER LINE,
          i_tline TYPE TABLE OF tline WITH HEADER LINE,                i_receivers TYPE TABLE OF somlreci1 WITH HEADER LINE,        i_record LIKE solisti1 OCCURS 0 WITH HEADER LINE,     
    Objects to send mail.
          i_objpack LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE,  
          i_objtxt LIKE solisti1 OCCURS 0 WITH HEADER LINE,
          i_objbin LIKE solisti1 OCCURS 0 WITH HEADER LINE,
          i_reclist LIKE somlreci1 OCCURS 0 WITH HEADER LINE,
    Work Area declarations
          w_objhead TYPE soli_tab,     
          w_ctrlop TYPE ssfctrlop,
          w_compop TYPE ssfcompop,
          w_return TYPE ssfcrescl,     
          w_doc_chng typE sodocchgi1,  
          w_data TYPE sodocchgi1,
          w_buffer TYPE string,       
    Variables declarations
          v_form_name TYPE rs38l_fnam,
          v_len_in LIKE sood-objlen,   
          v_len_out LIKE sood-objlen,  
          v_len_outn TYPE i,
          v_lines_txt TYPE i,
          v_lines_bin TYPE i.
    call function 'SSF_FUNCTION_MODULE_NAME'
    exporting
      formname = 'ZCS_FORM6'
    importing
      fm_name = v_form_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.
    w_ctrlop-getotf = 'X'.
    w_ctrlop-no_dialog = 'X'.
    w_compop-tdnoprev = 'X'.
    CALL FUNCTION v_form_name
    EXPORTING
      ARCHIVE_INDEX              =
      ARCHIVE_INDEX_TAB          =
      ARCHIVE_PARAMETERS         =
       CONTROL_PARAMETERS         = W_CTRLOP
      MAIL_APPL_OBJ              =
      MAIL_RECIPIENT             =
      MAIL_SENDER                =
       OUTPUT_OPTIONS             = W_COMPOP
       USER_SETTINGS              = 'X'
    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.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    i_otf[] = w_return-otfdata[].
    CALL FUNCTION 'CONVERT_OTF'
    EXPORTING
      format = 'PDF'              
      max_linewidth = 132         
    LINES-TDLINE
    IMPORTING
      bin_filesize = v_len_in     
    TABLES
      otf = i_otf                 
      lines = i_tline             
    EXCEPTIONS
      err_max_linewidth = 1
      err_format = 2
      err_conv_not_possible = 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.
    Convert PDF from 132 to 255.
    LOOP AT i_tline.
    Replacing space by ~
    TRANSLATE i_tline USING '~'.
    CONCATENATE w_buffer i_tline INTO w_buffer.
    ENDLOOP.
    Replacing ~ by space
    TRANSLATE w_buffer USING '~'.
    DO.
    i_record = w_buffer.
    Appending 255 characters as a record
    APPEND i_record.
    SHIFT w_buffer LEFT BY 255 PLACES.
    IF w_buffer IS INITIAL.
    EXIT.
    ENDIF.
    ENDDO.
    Attachment
    Refresh: i_reclist,
    i_objtxt,
    i_objbin,
    i_objpack.
    clear w_objhead.
    Object with PDF.
    i_objbin[] = i_record[].
    *******DESCRIBE TABLE i_objbin LINES v_lines_bin.
    Object with main text of the mail.
    i_objtxt = 'Find attached the output of the smart form.'.
    APPEND i_objtxt.
    *i_objtxt = 'Regards,'.
    *APPEND i_objtxt.
    *i_objtxt = 'Chandu'.
    *APPEND i_objtxt.
    DESCRIBE TABLE i_objtxt LINES v_lines_txt.
    read table i_objtxt index v_lines_txt.
    Document information.
    w_doc_chng-obj_name = 'Smartform'.         
    w_doc_chng-expiry_dat = sy-datum + 10.     
    w_doc_chng-obj_descr = 'Smart form output'.
    w_doc_chng-sensitivty = 'F'.               
    w_doc_chng-doc_size = v_lines_txt * 255.   
    Pack to main body as RAW.
    CLEAR i_objpack-transf_bin.         
    i_objpack-head_start = 1.           
    i_objpack-head_num = 0.             
    i_objpack-body_start = 1.           
    i_objpack-body_num = v_lines_txt.   
    i_objpack-doc_type = 'RAW'.   
    APPEND i_objpack.
    Packing as PDF.
    i_objpack-transf_bin = 'X'.
    i_objpack-head_start = 1.
    i_objpack-head_num = 1.
    i_objpack-body_start = 1.
    describe table i_objbin lines v_lines_bin.
    read table i_objbin index v_lines_bin.
    i_objpack-doc_size = v_lines_bin * 255.    
    i_objpack-body_num = v_lines_bin.          
    i_objpack-doc_type = 'PDF'.                
    i_objpack-obj_name = 'Smartform'.          
    i_objpack-obj_descr = 'sf output'
    APPEND i_objpack.
    Document information.
    CLEAR i_reclist.
    e-mail receivers.
    i_reclist-receiver = '[email protected]'. 
    *i_reclist-express = 'X'.    "Send express
    i_reclist-rec_type = 'U'.                             
    APPEND i_reclist.
    Sending mail.
    CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
    EXPORTING
      document_data = w_doc_chng 
      put_in_outbox = 'X'        
    TABLES
      packing_list = i_objpack   
      object_header = w_objhead  
      contents_hex = i_objbin    
      contents_txt = i_objtxt    
      receivers = i_reclist      
    EXCEPTIONS
      too_many_receivers = 1
      document_not_sent = 2
      document_type_not_exist = 3
      operation_no_authorization = 4
      parameter_error = 5
      x_error = 6
      enqueue_error = 7
      OTHERS = 8.
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    points wl be rewarded,if it is useful
    thanks in advance.

    HI,
      Here is the complete program for you.. I have done the same requirment..
                 P R O G R A M     D E C L A R A T I O N                 *
    PROGRAM ID            : ZF_QUERY_BANK
    AUTHOR                : Mahesh Raganmoni
    OWNER(Process Team)   :
    CREATE DATE           : 03/04/2004
    R/3 RELEASE VERSION   : 4.72
    BASED-ON PROGRAM      : none
    ADS                   : BP14.B&CF.301
    DESCRIPTION           : This program calles the Bank Query Smartform
                            and sends this smartforms as an email to the
                            bank
    MODIFICATION LOG CONTROL (Most recent on top):
    DATE             AUTHOR              CTS REQ     DESCRIPTION
    *09/13/2004    Mahesh Raganmoni        DR1K901766  Original Version    *
                          T   A   B   L   E   S                          *
    TABLES : BUT021, "BP: Address usages
             BUT020, "BP: Addresses
             T001,   "Company Codes
             DFKKZP, "Payment lot: Data for payment
             BUT000, "BP: General data I
             ADR3,   "Fax Numbers (Business Address Services)
             BNKA,   "Bank master record
             T012.   "House Banks
                            Internal Tables                       *
    *Address Details of Business Partner
    DATA :IT_ADDRESS LIKE STANDARD TABLE OF BUS020_EXT WITH HEADER LINE.
    *Return Table
    DATA :  IT_RETURN LIKE STANDARD TABLE OF BAPIRET2.
    PDF Data to hold the data to be sent as an attachment
    DATA : IT_PDF_NUC_DATA TYPE STANDARD TABLE OF SOLI.
    Converted data from OTF
    DATA : IT_PDF_TABLE TYPE RCL_BAG_TLINE.
    Data Declaration for Sendig Email
    DATA: IT_OBJPACK    LIKE SOPCKLSTI1 OCCURS  1 WITH HEADER LINE,
          IT_OBJHEAD    LIKE SOLISTI1   OCCURS  1 WITH HEADER LINE,
          IT_OBJTXT     LIKE SOLISTI1   OCCURS 10 WITH HEADER LINE,
          IT_OBJBIN     LIKE SOLISTI1   OCCURS 10 WITH HEADER LINE,
          IT_OBJHEX     LIKE SOLIX      OCCURS 10 WITH HEADER LINE,
          IT_RECLIST    LIKE SOMLRECI1  OCCURS  1 WITH HEADER LINE,
          IT_LISTOBJECT LIKE ABAPLIST   OCCURS  1 WITH HEADER LINE.
                             Structures                            *
    DATA :WA_BUS000 TYPE BUS000_EXT,         "Business Partner Details
          WA_ADDRESS TYPE BAPIADDR3,         "Collector Address
          WA_OUTPUT_OPTIONS TYPE SSFCOMPOP,
          WA_CONTROL_PARAMETERS TYPE SSFCTRLOP,
          WA_OUTPUT_DATA TYPE SSFCRESCL,
          WA_HEADER TYPE ZFCOLL_HEADER,  "Smartform Header Info
          WA_DFKKZP TYPE DFKKZP,
          WA_DOCDATA    LIKE SODOCCHGI1.
                             Variables                             *
    DATA : W_FORMNAME TYPE TDSFNAME,             "Smartform Name
           W_NAME_ORG TYPE CHAR35,               "Business Partner Name
           W_ADDRNUMBER LIKE BUT021-ADDRNUMBER,  "Address Number of BP
           W_ADDRESS1 TYPE CHAR35,               "Address Line 1
           W_ADDRESS2 TYPE CHAR35,               "Address Line 2
           W_ADDRESS3 TYPE CHAR35,               "Address Line 3
           W_GE_NAME TYPE CHAR35,                "GE Contact Name
           W_GE_PHONE TYPE CHAR35,               "GE Contact Phone
           W_GE_PHONE1 TYPE CHAR35,               "GE Contact Phone
           W_GE_PHONE_EX TYPE CHAR10,               "GE Contact Phone
           W_GE_EMAIL TYPE CHAR35,               "GE Contact Email
           W_CLIENT_NAME TYPE CHAR30,            "Client Name
           W_GE_FAX TYPE CHAR35,                 "GE Fax No
           W_GE_FAX1 TYPE CHAR35,                "GE Fax No
           W_CLIENT_FAX TYPE CHAR35,             "Client's Fax No
           W_PDF_LEN TYPE I,                     "Length of PDF file
           W_ERR_MESG(120) TYPE C,               "Error Message
           W_ORG1R LIKE DFKKCR-ORG1R,            "Company Code
           W_REFERENCE LIKE DFKKCR-REFERENCE,    "Payment Reference
           W_FNAME TYPE RS38L_FNAM,              "Smartform Function Module
                                                 "     Name
           W_SFNAME TYPE TDSFNAME,   " Smart Form Name
           W_BANKN TYPE CHAR18,   "Bank Account Number
           W_BETRZ TYPE CHAR15,   " Credit AMount
           W_WAERS TYPE CHAR5,    " Credit Currency
           W_VALUT TYPE DFKKZP-VALUT.   " Value Date
    VARIABLES FOR EMAIL
    DATA: W_TAB_LINES  TYPE I,
          W_DOC_SIZE   TYPE I,
          W_ATT_TYPE   LIKE SOODK-OBJTP,
          W_DATFM TYPE XUDATFM.
    VARIABLES FOR DATE
    DATA: W_DAY(2) TYPE C,
          W_MONTH(2) TYPE C,
          W_YEAR(4) TYPE C,
          W_DATE(10) TYPE C.
                             Constants                            *
    DATA : C_SELECTED TYPE C VALUE 'X', "Constant for Checked
           C_COMMA(2) TYPE C VALUE ', ',"Constant for  Comma
           C_HYPHEN TYPE C VALUE '-'.   "Constant for Hypen
                      Selection Screen                            *
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
    PARAMETERS: P_KEYZ1 TYPE RFKZ0-KEYZ1 OBLIGATORY, "Payment Lot
                P_POSZA TYPE DFKKZP-POSZA OBLIGATORY. "Item Number
    SELECTION-SCREEN END OF BLOCK b1.
    SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-002.
    PARAMETERS: P_REMIT TYPE C AS CHECKBOX DEFAULT 'X', " Remitter Form
                P_GENRL TYPE C AS CHECKBOX USER-COMMAND RG1, " General Form
                P_TEXT TYPE AD_SMTPADR  MODIF ID SC1. " Free Text
    SELECTION-SCREEN END OF BLOCK b2.
    SELECTION-SCREEN BEGIN OF BLOCK b3 WITH FRAME TITLE text-003.
    PARAMETERS:P_MAIL TYPE C AS CHECKBOX USER-COMMAND RG2, "Send Email
              P_MAILID TYPE AD_SMTPADR MODIF ID SC2.
    SELECTION-SCREEN END OF BLOCK b3.
                     Initialization                               *
    WA_OUTPUT_OPTIONS-XDFCMODE = 'X'.
    WA_OUTPUT_OPTIONS-XDF =  SPACE.
    WA_OUTPUT_OPTIONS-XSFCMODE = 'X'.
    WA_OUTPUT_OPTIONS-XDF = SPACE.
              At Selection Screen Output                          *
    AT SELECTION-SCREEN OUTPUT.
      LOOP AT SCREEN.
        IF SCREEN-GROUP1 = 'SC1'.
          IF P_GENRL = C_SELECTED.
            SCREEN-INPUT = 1.
          ELSE.
            CLEAR P_TEXT.
            SCREEN-INPUT = 0.
          ENDIF.
        ENDIF.
        IF SCREEN-GROUP1 = 'SC2'.
          IF P_MAIL = C_SELECTED.
            SCREEN-INPUT = 1.
          ELSE.
            CLEAR P_MAILID.
            SCREEN-INPUT = 0.
          ENDIF.
        ENDIF.
        MODIFY SCREEN.
      ENDLOOP.
    AT SELECTION-SCREEN.
      IF P_REMIT NE C_SELECTED AND P_GENRL NE C_SELECTED.
        MESSAGE E004 WITH TEXT-004.
      ENDIF.
                      Start of selection                          *
    START-OF-SELECTION.
      IF P_GENRL EQ C_SELECTED.
        IF P_TEXT IS INITIAL.
          MESSAGE I004 WITH TEXT-023.
          STOP.
        ENDIF.
      ENDIF.
      IF P_MAIL EQ C_SELECTED.
        IF P_MAILID IS INITIAL.
          MESSAGE I004 WITH TEXT-005.
          STOP.
        ENDIF.
      ENDIF.
    **Getting Payment Lot and Payment Lot number
      PERFORM GET_PAYMENT_DETAILS.
      IF NOT WA_DFKKZP IS INITIAL.
    Getting the Bank  Details
        PERFORM GET_BANK_DETAILS.
    **Getting the  Ge Contact Details
        PERFORM GET_GE_CONTACT_DETAILS .
    Populating the Structure fields to pass to smartform
        PERFORM FILL_EXPORT_STRUCTURES.
        CLEAR W_FNAME.
    Getting the Function Module name for the Smartform
        IF  P_REMIT EQ C_SELECTED AND P_GENRL NE C_SELECTED.
          W_SFNAME = 'ZF_REMITTER_FORM'.
          PERFORM GET_FORMNAME .
        ELSEIF P_REMIT NE C_SELECTED AND P_GENRL EQ C_SELECTED.
          W_SFNAME = 'ZF_GENERAL_FORM'.
          PERFORM GET_FORMNAME .
        ELSEIF P_REMIT EQ C_SELECTED AND P_GENRL EQ C_SELECTED.
          W_SFNAME = 'ZF_QUERY_BANK_FORM'.
          PERFORM GET_FORMNAME .
        ENDIF.
        IF NOT W_FNAME IS INITIAL.
          PERFORM CALL_FORM.
          IF P_MAIL EQ 'X'.
            IF NOT P_MAILID IS INITIAL.
              PERFORM SET_PARAMETERS.
              PERFORM DEVICE_TYPE.
              PERFORM CALL_FORM.
              PERFORM CONVERT_TO_PDF.
              PERFORM CONVERT_PDF_TO_BINARY.
              PERFORM SEND_MAIL_NO_DISPLAY.
            ENDIF.
          ENDIF.
        ENDIF.
      ENDIF.
    *&      Form  GET_FORMNAME
         Fetch the Function module name for the Smartform
    FORM GET_FORMNAME .
      CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
        EXPORTING
          formname           = W_SFNAME
        IMPORTING
          FM_NAME            = W_FNAME
        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.
    ENDFORM.                    " GET_FORMNAME
    *&      Form  CALL_FORM
    To Call the Smartform
    FORM CALL_FORM .
      SHIFT W_BETRZ LEFT DELETING LEADING SPACE.
      CALL FUNCTION W_FNAME
        EXPORTING
          CONTROL_PARAMETERS = WA_CONTROL_PARAMETERS
          OUTPUT_OPTIONS     = WA_OUTPUT_OPTIONS
          USER_SETTINGS      = 'X'
          S_HEADER           = WA_HEADER
          V_ACNO             = W_BANKN
          V_AMOUNT           = W_BETRZ
          V_CURR             = W_WAERS
          V_DATE             = W_VALUT
          V_TEXT             = P_TEXT
        IMPORTING
          JOB_OUTPUT_INFO    = WA_OUTPUT_DATA
        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.
    ENDFORM.                    " CALL_FORM
    *&      Form  FILL_EXPORT_STRUCTURES
    Populate the structure to send to the smartform as input
    FORM FILL_EXPORT_STRUCTURES .
      WA_HEADER-BANKA = BNKA-BANKA.
      WA_HEADER-ADDR_1  = BNKA-STRAS.
      WA_HEADER-ADDR_2 = BNKA-ORT01.
      WA_HEADER-ADDR_3 = BNKA-PROVZ.
      WA_HEADER-ZZSRCBPNM = T012-NAME1.
      SHIFT WA_HEADER-ZZSRCBPNM LEFT DELETING LEADING SPACE.
      WA_HEADER-FAX_NUMBER = W_CLIENT_FAX.
      WA_HEADER-BUTXT = T001-BUTXT.
      WA_HEADER-NAME1 = W_GE_NAME.
      WA_HEADER-TEL_NUMBER = W_GE_PHONE.
      WA_HEADER-TEL_EXTENS = W_GE_PHONE_EX.
      WA_HEADER-SMTP_ADDR = W_GE_EMAIL.
      WA_HEADER-GE_FAX_NUMBER = W_GE_FAX.
    ENDFORM.                    " FILL_EXPORT_STRUCTURES
    *&      FORM  CONVERT_TO_PDF
    Convert the final doucment (OTF FORMAT) into pdf format
    FORM CONVERT_TO_PDF .
      CALL FUNCTION 'CONVERT_OTF'
        EXPORTING
          FORMAT                = 'PDF'
        IMPORTING
          BIN_FILESIZE          = W_PDF_LEN
        TABLES
          OTF                   = WA_OUTPUT_DATA-OTFDATA
          LINES                 = IT_PDF_TABLE
        EXCEPTIONS
          ERR_MAX_LINEWIDTH     = 1
          ERR_FORMAT            = 2
          ERR_CONV_NOT_POSSIBLE = 3
          ERR_BAD_OTF           = 4
          OTHERS                = 5.
    ENDFORM.                    " CONVERT_TO_PDF
    *&      FORM  SET_PARAMETERS
    Set control parameters to get the output format (OTF) from smart form*
    FORM SET_PARAMETERS .
      WA_CONTROL_PARAMETERS-NO_DIALOG = 'X'.
      WA_CONTROL_PARAMETERS-GETOTF    = 'X'.
      WA_CONTROL_PARAMETERS-LANGU = SY-LANGU.
    ENDFORM.                    " SET_PARAMETERS
    *&      FORM  DEVICE_TYPE
    Get the Device type
    FORM DEVICE_TYPE .
      CALL FUNCTION 'SSF_GET_DEVICE_TYPE'
        EXPORTING
          I_LANGUAGE             = WA_CONTROL_PARAMETERS-LANGU
        IMPORTING
          E_DEVTYPE              = WA_OUTPUT_OPTIONS-TDPRINTER
        EXCEPTIONS
          NO_LANGUAGE            = 1
          LANGUAGE_NOT_INSTALLED = 2
          NO_DEVTYPE_FOUND       = 3
          SYSTEM_ERROR           = 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.
    ENDFORM.                    " DEVICE_TYPE
    *&      FORM  CONVERT_PDF_TO_BINARY
    To convert PDF file to Binary format
    FORM CONVERT_PDF_TO_BINARY .
      CALL FUNCTION 'QCE1_CONVERT'
        TABLES
          T_SOURCE_TAB         = IT_PDF_TABLE
          T_TARGET_TAB         = IT_PDF_NUC_DATA
        EXCEPTIONS
          CONVERT_NOT_POSSIBLE = 1
          OTHERS               = 2.
      IF SY-SUBRC <> 0.
      MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    ENDFORM.                    " CONVERT_PDF_TO_BINARY
    *&      FORM  SEND_MAIL_NO_DISPLAY
    To send a email
    FORM SEND_MAIL_NO_DISPLAY .
      DATA: L_SLINE(255) TYPE C,
            L_INDEX TYPE SY-TABIX.
      IT_OBJBIN[] =  IT_PDF_NUC_DATA[].
      Title and Description of the mail
      WA_DOCDATA-OBJ_DESCR = TEXT-012.
    Mail Body content
      PERFORM MAIL_BODY.
      DESCRIBE TABLE IT_OBJTXT LINES W_TAB_LINES.
      READ     TABLE IT_OBJTXT INDEX W_TAB_LINES INTO L_SLINE.
      L_INDEX = W_TAB_LINES + 1.
      WA_DOCDATA-DOC_SIZE = ( W_TAB_LINES ) * 255 + STRLEN( L_SLINE ).
      WA_DOCDATA-OBJ_EXPDAT = '29991231'.
      WA_DOCDATA-SENSITIVTY = 'O'.
      WA_DOCDATA-OBJ_PRIO =  '5'.
      WA_DOCDATA-EXPIRY_DAT = '29991231'.
      WA_DOCDATA-PROC_TYPE = 'R'.
      CLEAR  IT_OBJPACK-TRANSF_BIN .
      IT_OBJPACK-HEAD_START = 0.
      IT_OBJPACK-HEAD_NUM   = 0.
      IT_OBJPACK-BODY_START = 1.
      IT_OBJPACK-BODY_NUM   = W_TAB_LINES.
      IT_OBJPACK-DOC_TYPE   = 'RAW'.
      IT_OBJPACK-OBJ_DESCR  = TEXT-013.
      APPEND IT_OBJPACK.
    Create message attachment
      W_ATT_TYPE = 'PDF'.
      DESCRIBE TABLE IT_OBJBIN LINES W_TAB_LINES.
      READ     TABLE IT_OBJBIN INDEX W_TAB_LINES.
      L_INDEX = W_TAB_LINES + 1.
      IT_OBJPACK-DOC_SIZE = ( W_TAB_LINES ) * 255 .
      IT_OBJPACK-TRANSF_BIN = 'X'.
      IT_OBJPACK-HEAD_START = 0.
      IT_OBJPACK-HEAD_NUM   = 0.
      IT_OBJPACK-BODY_START = 1.
      IT_OBJPACK-BODY_NUM   = W_TAB_LINES.
      IT_OBJPACK-DOC_TYPE   = W_ATT_TYPE.
      IT_OBJPACK-OBJ_DESCR  = TEXT-013.
      APPEND IT_OBJPACK.
    Create receiver list
      IT_RECLIST-RECEIVER = P_MAILID.  "<-- CHANGE ADDRESS
      IT_RECLIST-REC_TYPE = 'U'.
      IT_RECLIST-EXPRESS = 'X'.
      APPEND IT_RECLIST.
    Send Email
      CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
        EXPORTING
          DOCUMENT_DATA              = WA_DOCDATA
          PUT_IN_OUTBOX              = 'X'
          COMMIT_WORK                = 'X'     "USED FROM REL.6.10
        TABLES
          PACKING_LIST               = IT_OBJPACK
          CONTENTS_BIN               = IT_OBJBIN
          CONTENTS_TXT               = IT_OBJTXT
          RECEIVERS                  = IT_RECLIST
        EXCEPTIONS
          TOO_MANY_RECEIVERS         = 1
          DOCUMENT_NOT_SENT          = 2
          DOCUMENT_TYPE_NOT_EXIST    = 3
          OPERATION_NO_AUTHORIZATION = 4
          PARAMETER_ERROR            = 5
          X_ERROR                    = 6
          ENQUEUE_ERROR              = 7
          OTHERS                     = 8.
      IF SY-SUBRC <> 0.
        MESSAGE ID 'SO' TYPE 'S' NUMBER '023'
                WITH WA_DOCDATA-OBJ_NAME.
      ELSE.
        SUBMIT RSCONN01 WITH MODE = 'INT' AND RETURN.
        SET SCREEN 0.
      ENDIF.
    ENDFORM.                    " SEND_MAIL_NO_DISPLAY
    *&      Form  GET_PAYMENT_DETAILS
    Get the Payment Lot and Payment Number
    FORM GET_PAYMENT_DETAILS .
    Get the Payment Lot and Payment Number
      SELECT SINGLE BETRZ
                    BVRKO
                    BUKRS
                    WAERS
                    VALUT
                    BANKS
                    BANKL
                    BANKN
                    FROM  DFKKZP
                    INTO (WA_DFKKZP-BETRZ,WA_DFKKZP-BVRKO,
                      WA_DFKKZP-BUKRS,WA_DFKKZP-WAERS,WA_DFKKZP-VALUT,
                      WA_DFKKZP-BANKS,WA_DFKKZP-BANKL,WA_DFKKZP-BANKN)
                    WHERE KEYZ1 = P_KEYZ1
                    AND   POSZA = P_POSZA.
      IF SY-SUBRC NE  0.
        MESSAGE I004 WITH TEXT-100.
        EXIT.
      ELSE.
        W_ORG1R = WA_DFKKZP-BUKRS.
        W_BETRZ = WA_DFKKZP-BETRZ.
        W_BANKN = WA_DFKKZP-BANKN.
        W_WAERS = WA_DFKKZP-WAERS.
        W_VALUT = WA_DFKKZP-VALUT.
      ENDIF.
    ENDFORM.                    " GET_PAYMENT_DETAILS
    *&      Form  GET_BANK_DETAILS
    To Retrive the Bank Details
    FORM GET_BANK_DETAILS .
    *Get the Bank Address Details
      SELECT SINGLE BANKA
                    STRAS
                    ORT01
                    PROVZ
                    FROM BNKA
                    INTO (BNKA-BANKA,BNKA-STRAS,BNKA-ORT01,BNKA-PROVZ)
                    WHERE BANKS = WA_DFKKZP-BANKS
                    AND BANKL = WA_DFKKZP-BANKL.
      IF SY-SUBRC NE 0.
       MESSAGE I004 WITH TEXT-101.
       EXIT.
      ENDIF.
    GET The Bank Contact Name.
      SELECT SINGLE NAME1
                    FROM T012
                    INTO T012-NAME1
                   WHERE BANKS = WA_DFKKZP-BANKS
                   AND   BANKL = WA_DFKKZP-BANKL.
      IF SY-SUBRC NE 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      IF NOT W_ORG1R IS INITIAL.
    Get the GE Legal Entity Name
        SELECT SINGLE  BUTXT FROM T001
               INTO T001-BUTXT
               WHERE BUKRS = W_ORG1R.
        IF SY-SUBRC NE  0.
           MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
          *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        ENDIF.
      ENDIF.
    ENDFORM.                    " GET_BANK_DETAILS
    *&      Form  GET_COLLECTOR_DETAILS
    To get the Collector Address Details
    FORM GET_GE_CONTACT_DETAILS .
    *Getting the Collector details
      CALL FUNCTION 'BAPI_USER_GET_DETAIL'
        EXPORTING
          USERNAME = SY-UNAME
        IMPORTING
          ADDRESS  = WA_ADDRESS
        TABLES
          RETURN   = IT_RETURN.
      IF NOT WA_ADDRESS IS INITIAL.
        CONCATENATE WA_ADDRESS-FIRSTNAME0(18) WA_ADDRESS-LASTNAME0(17)
                    INTO W_GE_NAME SEPARATED BY SPACE.
        W_GE_PHONE = WA_ADDRESS-TEL1_NUMBR.
        W_GE_PHONE_EX = WA_ADDRESS-TEL1_EXT.
        W_GE_EMAIL = WA_ADDRESS-E_MAIL.
        IF NOT WA_ADDRESS-FAX_EXTENS IS INITIAL.
          CONCATENATE WA_ADDRESS-FAX_NUMBER C_HYPHEN WA_ADDRESS-FAX_EXTENS
                       INTO W_GE_FAX.
        ELSE.
          W_GE_FAX = WA_ADDRESS-FAX_NUMBER.
        ENDIF.
      ENDIF.
    ENDFORM.                    " GET_GE_CONTACT_DETAILS
    *&      Form  MAIL_BODY
    To Build the email body
    FORM MAIL_BODY .
      PERFORM  GET_USER_DATE_FORMAT.
      W_YEAR = W_VALUT+0(4).
      W_MONTH = W_VALUT+4(2).
      W_DAY = W_VALUT+6(2).
      PERFORM GET_DATE.
      IF P_REMIT EQ 'X' .
        CONCATENATE TEXT-020 WA_HEADER-ZZSRCBPNM ',' INTO IT_OBJTXT-LINE
                                SEPARATED BY SPACE.
        APPEND IT_OBJTXT.
        CONCATENATE SPACE SPACE SPACE INTO IT_OBJTXT-LINE.
        APPEND IT_OBJTXT.
        CONCATENATE TEXT-021 WA_HEADER-BUTXT  ',' TEXT-022
        INTO IT_OBJTXT-LINE SEPARATED BY SPACE.
        APPEND IT_OBJTXT.
        CONCATENATE SPACE SPACE SPACE INTO IT_OBJTXT-LINE.
        APPEND IT_OBJTXT.
        SHIFT W_BETRZ LEFT DELETING LEADING SPACE.
        CONCATENATE TEXT-024 W_DATE
        TEXT-025  W_BETRZ W_WAERS TEXT-026
        INTO IT_OBJTXT-LINE SEPARATED BY SPACE.
        APPEND IT_OBJTXT.
        CONCATENATE SPACE SPACE SPACE INTO IT_OBJTXT-LINE.
        APPEND IT_OBJTXT.
        IT_OBJTXT-LINE = TEXT-027.
        APPEND IT_OBJTXT.
        CONCATENATE SPACE SPACE SPACE INTO IT_OBJTXT-LINE.
        APPEND IT_OBJTXT.
        IT_OBJTXT-LINE = WA_HEADER-NAME1.
        APPEND IT_OBJTXT.
        CONCATENATE SPACE SPACE SPACE INTO IT_OBJTXT-LINE.
        APPEND IT_OBJTXT.
        CONCATENATE  TEXT-028 WA_HEADER-BUTXT INTO
        IT_OBJTXT-LINE SEPARATED BY SPACE.
        APPEND IT_OBJTXT.
        IT_OBJTXT-LINE = TEXT-029.
        APPEND IT_OBJTXT.
        CONCATENATE TEXT-030 W_GE_FAX INTO IT_OBJTXT-LINE
                           SEPARATED BY SPACE.
        APPEND IT_OBJTXT.
        CONCATENATE TEXT-031 W_GE_PHONE TEXT-035 W_GE_PHONE_EX INTO
        IT_OBJTXT-LINE SEPARATED BY SPACE.
        APPEND IT_OBJTXT.
        CONCATENATE  TEXT-032 WA_HEADER-SMTP_ADDR INTO
        IT_OBJTXT-LINE SEPARATED BY SPACE.
        APPEND IT_OBJTXT.
        CONCATENATE SPACE SPACE SPACE INTO IT_OBJTXT-LINE.
        APPEND IT_OBJTXT.
        CONCATENATE  TEXT-033 WA_HEADER-BUTXT INTO
        IT_OBJTXT-LINE SEPARATED BY SPACE.
        APPEND IT_OBJTXT.
      ELSEIF P_GENRL EQ 'X'.
        CLEAR IT_OBJTXT.
        REFRESH IT_OBJTXT.
        CONCATENATE TEXT-020 WA_HEADER-ZZSRCBPNM ',' INTO IT_OBJTXT-LINE
                                SEPARATED BY SPACE.
        APPEND IT_OBJTXT.
        CONCATENATE SPACE SPACE SPACE INTO IT_OBJTXT-LINE.
        APPEND IT_OBJTXT.
        CONCATENATE TEXT-021 WA_HEADER-BUTXT '.'
        INTO IT_OBJTXT-LINE SEPARATED BY SPACE.
        APPEND IT_OBJTXT.
        CONCATENATE SPACE SPACE SPACE INTO IT_OBJTXT-LINE.
        APPEND IT_OBJTXT.
        CONCATENATE TEXT-034 P_TEXT '.'
        INTO IT_OBJTXT-LINE SEPARATED BY SPACE.
        APPEND IT_OBJTXT.
        IT_OBJTXT-LINE = TEXT-027.
        APPEND IT_OBJTXT.
        CONCATENATE SPACE SPACE SPACE INTO IT_OBJTXT-LINE.
        APPEND IT_OBJTXT.
        IT_OBJTXT-LINE = WA_HEADER-NAME1.
        APPEND IT_OBJTXT.
        CONCATENATE SPACE SPACE SPACE INTO IT_OBJTXT-LINE.
        APPEND IT_OBJTXT.
        CONCATENATE  TEXT-028 WA_HEADER-BUTXT INTO
        IT_OBJTXT-LINE SEPARATED BY SPACE.
        APPEND IT_OBJTXT.
        IT_OBJTXT-LINE = TEXT-029.
        APPEND IT_OBJTXT.
        CONCATENATE TEXT-030 W_GE_FAX INTO IT_OBJTXT-LINE
                           SEPARATED BY SPACE.
        APPEND IT_OBJTXT.
        CONCATENATE TEXT-031 W_GE_PHONE TEXT-035 W_GE_PHONE_EX INTO
        IT_OBJTXT-LINE SEPARATED BY SPACE.
        APPEND IT_OBJTXT.
        CONCATENATE  TEXT-032 WA_HEADER-SMTP_ADDR INTO
        IT_OBJTXT-LINE SEPARATED BY SPACE.
        APPEND IT_OBJTXT.
      ELSEIF ( P_REMIT EQ 'X' AND P_GENRL EQ 'X' ).
        CONCATENATE TEXT-020 WA_HEADER-ZZSRCBPNM ',' INTO IT_OBJTXT-LINE
                                 SEPARATED BY SPACE.
        APPEND IT_OBJTXT.
        CONCATENATE SPACE SPACE SPACE INTO IT_OBJTXT-LINE.
        APPEND IT_OBJTXT.
        CONCATENATE TEXT-021 WA_HEADER-BUTXT  ',' TEXT-022
        INTO IT_OBJTXT-LINE SEPARATED BY SPACE.
        APPEND IT_OBJTXT.
        CONCATENATE SPACE SPACE SPACE INTO IT_OBJTXT-LINE.
        APPEND IT_OBJTXT.
        SHIFT W_BETRZ LEFT DELETING LEADING SPACE.
        CONCATENATE TEXT-024 W_DATE TEXT-025  W_BETRZ W_WAERS TEXT-026
        INTO IT_OBJTXT-LINE SEPARATED BY SPACE.
        APPEND IT_OBJTXT.
        CONCATENATE SPACE SPACE SPACE INTO IT_OBJTXT-LINE.
        APPEND IT_OBJTXT.
        IT_OBJTXT-LINE = TEXT-027.
        APPEND IT_OBJTXT.
        CONCATENATE SPACE SPACE SPACE INTO IT_OBJTXT-LINE.
        APPEND IT_OBJTXT.
        IT_OBJTXT-LINE = WA_HEADER-NAME1.
        APPEND IT_OBJTXT.
        CONCATENATE SPACE SPACE SPACE INTO IT_OBJTXT-LINE.
        APPEND IT_OBJTXT.
        CONCATENATE  TEXT-028 WA_HEADER-BUTXT INTO
        IT_OBJTXT-LINE SEPARATED BY SPACE.
        APPEND IT_OBJTXT.
        IT_OBJTXT-LINE = TEXT-029.
        APPEND IT_OBJTXT.
        CONCATENATE TEXT-030 W_GE_FAX INTO IT_OBJTXT-LINE
                           SEPARATED BY SPACE.
        APPEND IT_OBJTXT.
        CONCATENATE TEXT-031 W_GE_PHONE TEXT-035 W_GE_PHONE_EX INTO
        IT_OBJTXT-LINE SEPARATED BY SPACE.
        APPEND IT_OBJTXT.
        CONCATENATE  TEXT-032 WA_HEADER-SMTP_ADDR INTO
        IT_OBJTXT-LINE SEPARATED BY SPACE.
        APPEND IT_OBJTXT.
        CONCATENATE SPACE SPACE SPACE INTO IT_OBJTXT-LINE.
        APPEND IT_OBJTXT.
        CONCATENATE  TEXT-033 WA_HEADER-BUTXT INTO
        IT_OBJTXT-LINE SEPARATED BY SPACE.
        APPEND IT_OBJTXT.
      ENDIF.
    ENDFORM.                    " MAIL_BODY
    *&      Form  get_user_date_format
    to get the User Date Format from USR01 table
    FORM GET_USER_DATE_FORMAT.
      CLEAR W_DATFM.
      SELECT SINGLE DATFM INTO W_DATFM
                          FROM USR01
                          WHERE BNAME = SY-UNAME.
    ENDFORM.                    " get_user_date_format
    *&      Form  GET_DATE
          Get the date in the user format
    FORM GET_DATE .
      CLEAR W_DATE.
      CASE W_DATFM.
        WHEN '1'.
          CONCATENATE W_DAY '.' W_MONTH '.' W_YEAR INTO W_DATE.
        WHEN '2'.
          CONCATENATE W_MONTH '/' W_DAY '/' W_YEAR INTO W_DATE.
        WHEN '3'.
          CONCATENATE W_MONTH '-' W_DAY '-' W_YEAR INTO W_DATE.
        WHEN '4'.
          CONCATENATE W_YEAR '.' W_MONTH '.' W_DAY INTO W_DATE.
        WHEN '5'.
          CONCATENATE W_YEAR '/' W_MONTH '/' W_DAY INTO W_DATE.
        WHEN '6'.
          CONCATENATE W_YEAR '-' W_MONTH '-' W_DAY INTO W_DATE.
      ENDCASE.
    ENDFORM.                    " GET_DATE
    Thanks
    Mahesh

  • Smartform -Network printer format Issue

    Hi,
    I can print fine using my YPCC default printer.
    But When i do through network printer FORMAT is getting Disturbed( Values are printing in next line).How can we handle this? Do we need to do some driver program modifications?
    Here are the parameters in Driver program
    CALL FUNCTION fm_name
          EXPORTING
            archive_index        = toa_dara
            archive_index_tab    = arc_ind_tab
            archive_parameters   = arc_params
            control_parameters   = ls_control_param
            mail_appl_obj        = ls_recipient
            mail_recipient       = ls_recipient
            mail_sender          = ls_sender
            output_options       = ls_composer_param
            user_settings        = space
            wa_itab              = wa_header
          IMPORTING
            document_output_info = document_output_info
            job_output_info      = job_output_info
            job_output_options   = job_output_options
          TABLES
            wa_dep               = item_itab
          EXCEPTIONS
            formatting_error     = 1
            internal_error       = 2
            send_error           = 3
            user_canceled        = 4.
        IF sy-subrc <> 0.
          WRITE: / 'ERROR in passing vars to the smartforms '.
        ENDIF.
        ls_composer_param-tdnewid = space.
        ls_control_param-no_dialog = 'X'.

    YOu need to modify the smartform not the driver program to print all lines the way you want by changing font size, reducing line length...etc..etc..
    It's printing fine on the default PC printer, because, it uses windows printer driver to render the output, where as SAP network printer uses SAP printer driver to generate the printer commands, there's always difference in the output between the two drivers.
    Regards
    Sridhar

  • How to display the data in row wise in smartform

    Hi,
        I have to make a modification a smartform of poprinting and i want to display the row wise . At present it is displaying the  
        column wise. Actually there is a text which i want to display the data row wise.
        It is possible to display the data in row wise of the text .
    Edited by: nav009 on Oct 8, 2009 10:39 AM

    Hello ,
    I  assume that your requiremen is related to smartform.the below is the solution i suggest.
    As per my understanding of your requirement ,It's clear that as of now there is some description field which is also getting displayed along with other PO fields.
    However you would like to display the description field in a new line since the length of this field is longer than other fields as a result the data is getting scattered .
    Therefore one better option could be: since the whole data from PO would be in a loop you can display all other fields in one line type of the table as per the intial requirement and you display the description line alone in a new line type wth the desired length so that data would not be scattered and no data loss would happen.
    I assume you are aware of creating of line types for table.
    Thanks
    M.Naveen.

  • VL02N Error: Output could not be issued with smartforms

    Hi All,
    Currently I am doing some customization on existing delivery note smartforms LE_SHP_DELNOTE on ECC 6.0.
    I have copied it from the above smartforms and name it as ZLE_SHP_DELNOTE. Did most of the modification according to the user's format requirement.
    Manage to do the necessary settings in NACE to point to the new smartforms and also were able to print preview the report either in the standard LE_SHP_DELNOTE or the customize ZLE_SHP_DELNOTE.
    But as I add more coding into ZLE_SHP_DELNOTE, the print preview starts to give me the "Output could not be issued" error.
    If I were to revert back to the original LE_SHP_DELNOTE in NACE, it still works fine.
    I have checked most of the issue in the forum regarding the table size or include text, but I have make sure that the table size does not exceed the window size and also i have check the checkbox that prevent any error if include text does not exist.
    Hope to get help.
    Thanks
    David

    Hi Murali,
    Thanks a lot. It is due to the address that is not populating.
    Currently I am reading the address from VBAK by using the following statements:
    SELECT  SINGLE bukrs_vf
    FROM    vbak
    INTO    lf_bukrs
    WHERE   vkorg = is_dlv_delnote-hd_org-salesorg
    AND     vbeln = is_dlv_delnote-hd_ref-order_numb.
    SELECT  SINGLE adrnr
    FROM    t001
    INTO    gf_bukrs_adrnr
    WHERE   bukrs = lf_bukrs.
    gf_bukrs_adrnr is the address value.
    Currently I have 2 versions of my customised smartforms. One that works and one that does not work. Both has the address node.
    One funny thing is that the value from is_dlv_delnote-hd_ref-order_numb is not populating for the one that does not work.
    But I thought is_dlv_delnote is an interface passed on to the smartforms regardless of any changes that you made in the smartforms.
    Do you have any idea why is this so?
    Thanks
    David

  • VF03 smartform: Output could not be issued

    Hi All,
    Ive created a custom invoice print program and associated smartform.
    These two run perfectly together when standing alone.
    However Ive created a custom  output type to call this program from VF03.
    This output type appears in the "Issue Output To "options in VF03.
    But it returns the message "Output could not be issued" when trying to print.
    In debug mode the Print Program and smartform execute perfectly when calling from VF03 in the same way, but the output fails to appear.
    In the Header -Output section inside the status of the output type is "Not Processed".
    Any ideas guys??

    Hi
    It seems that the Output determination is not taking place correctly
    the link between the Output type and Program and smartform is not established peoperly
    You have to assign this in SPRO  for the billing documents
    And most of the times it won't work we assign our custom program to the custom output type
    it is better to use the std output type and the Std program(you copy the std and can change it but the same copied ZPeogram to be attached) and Copied/modified smartform.
    check this.
    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.
    Output Determiantion :
    You can use output control to automate either messages or subsequent processing of partner-specific messages"
    This means, it provides a method for you to perform subsequent processing once a document is saved in the system. This subsequent processing is normally to print the document, but can also include activities such as:
    - Faxing the document
    - Emailing the document
    - Sending an idoc of the document
    - Sending an EDI message for the document (via an Idoc)
    - and so on.
    In general, it uses the condition technique to determine what, if any, output is to be produced. The condition technique works by selecting key fields from the document (document type, plant, etc.) and matching them to master data records you have previously set up. If there is a match, then output is produced.
    You can use transaction NACE for the output determination settings for all applications.
    1. When you start transaction NACE, a list of all represented applications appears.
    2. From this initial screen, you can access all the individual processing screens for output determination from the EDIT menu.
    3. Select the relevant application. This transaction does not have a menu path in customizing.
    Refer the following links.
    http://help.sap.com/saphelp_crm40/helpdata/en/b3/58bf39f7568648e10000000a11402f/content.htm
    http://help.sap.com/saphelp_erp2004/helpdata/en/c8/19878343b111d1896f0000e8322d00/frameset.htm
    http://help.sap.com/saphelp_erp2004/helpdata/en/c0/4e4746497d11d385ee0000e81ddea0/content.htm
    <b>Reward points for useful Answers</b>
    Regards
    Anji

  • Output could not be issued message whlie handling smartforms.

    while executing the smartform i am getting Output could not be issued message and i am getting no display.
    My functinal consultant had created new output type for VF03 tcode ( a copy of existing one), and i copied the same program and smartforms with slight modifications.
    now while executing the output type through VF03 I am getting the abouve message.
    and while checking there is no data in JOB_OUTPUT_INFO internal table of the smartform.
    what will be the reason? and how to correct this.
    <b>this is an urgent task.</b>

    Hi,
    This might be mostly becoz of due to data not getting passed to the Smartform.
    First ensure that, you get the data in the internal table of the Driver program and then check the same in the SM...
    So please check and let me know if the problem persists.
    Thanks,
    Vishnu.

Maybe you are looking for