Function Parameters in Smartform?

HI all,
In this code how can we get the parameters...import ,export an tables in the function module FM_NAME?
TABLES: MKPF.
DATA: FM_NAME TYPE RS38L_FNAM.
DATA: BEGIN OF INT_MKPF OCCURS 0.
INCLUDE STRUCTURE MKPF.
DATA: END OF INT_MKPF.
SELECT-OPTIONS S_MBLNR FOR MKPF-MBLNR MEMORY ID 001.
SELECT * FROM MKPF WHERE MBLNR IN S_MBLNR.
MOVE-CORRESPONDING MKPF TO INT_MKPF.
APPEND INT_MKPF.
ENDSELECT.
At the end of your program.
Passing data to SMARTFORMS
call function 'SSF_FUNCTION_MODULE_NAME'
exporting
formname = 'ZTEST'
VARIANT = ' '
DIRECT_CALL = ' '
IMPORTING
FM_NAME = FM_NAME
EXCEPTIONS
NO_FORM = 1
NO_FUNCTION_MODULE = 2
OTHERS = 3.
if sy-subrc 0.
WRITE: / 'ERROR 1'.
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'
IMPORTING
DOCUMENT_OUTPUT_INFO =
JOB_OUTPUT_INFO =
JOB_OUTPUT_OPTIONS =
TABLES
GS_MKPF = INT_MKPF
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.
Sachin.
Edited by: Alvaro Tejada Galindo on Apr 22, 2008 10:28 AM

hi ,
       the smart form will generate the function module and no need to bother about that and it  will  specify all the import and export and tables ..
for craeting the smart forms check this site and it will show u step-b-step ...
http://www.****************/Tutorials/Smartforms/SFMain.htm
regards,
venkat.

Similar Messages

  • Parameters of Smartform

    Dear Experts,
    I know default parameters of Smartform are stored in STXFSTDPAR base table. Custom parameters are stored where?

    Dear Max,
    I got a function module 'FB_GET_INTERFACE', which returns all parameters used in a Smartform. Please check out the code placed in the site: http://wiki.sdn.sap.com/wiki/display/Snippets/PDFfilegenerationfromSmartform.
    Thank you.
    Sukanta Manna

  • How do I code relative links as function parameters within Templates?

    I am a newcomer looking for best practices for a "How Do I?" properly code relative links as function parameters within an Adobe template (DWT) which accomodates page creation at 2 different level of folders. Dreamweaver doesn't appear to handle auto-correction of relative links as function parameters as far as I can see.  It's not clear to me what the best practice I should be following.  While this is not exactly a SPRY question, I am hoping that someone using the Spry.Data.XMLDataSet had already found the best practice to use.
    My Site
    -- Multiple pages at this level    and the parameter needs to be "_includes/UnitSideNavigation.xml"
    SubFolder
    -- Other pages at this level.       and the parameter needs to be "../_includes/UnitSideNavigation.xml"
    And this is the particular code snippet within a non edtable template area I would like to work for 2 levels of pages created from the template.
    <script type="text/javascript">
    var dsItems1 = new Spry.Data.XMLDataSet("_includes/UnitSideNavigation.xml", "/links/firstlevel");
    var dslinks = new Spry.Data.NestedXMLDataSet(dsItems1, "secondlevels/secondlevel");
    </script>
    My environment is Windows/Vista using latest CS4 dreamweaver.
    Any pointers appreciated. This is learn time for me. Hope I have made myself clear. Andy

    I use serverside includes instead of DWT for exactly that reason. Not only that, if you change anything within the template you must re-upload all of the files affected by the change; only the modified include file needs to be uploaded.

  • Why "OCIAQListen" function parameters are commented in ociap.h file

    Why "OCIAQListen" function parameters are commented in ociap.h file
    Oracle help document says that the OCIAQListen function takes the
    following 7 parameters...
    OCISvcCtx *svchp
    OCIError *errhp
    OCIAQAgent **agent_list
    ub4 num_agents
    sb4 wait
    OCIAQAgent **agent
    ub4 flags
    But the params are commented in the header file.

    Hi Isabelle:
       Please refer to SAP Note 1388857 - Error: "Cannot open file <<path to pcache area and file name>>. Please check its path and permissions." - Data Services XI 3.2 (12.2)
    Regards,
    Francisco Milán.

  • HOW TO CALL FUNCTION MODULE INSIDE SMARTFORM

    PLEASE ANYONE TELL ME, ABOUT  HOW TO CALL FUNCTION MODULE INSIDE SMARTFORM. IT IS VERY URGENT!!!!!!!!!1

    Hi,
      Under Global Definitions, we have 'Form Routines' tab. Under this tab, u can have a dynamic subroutine call. With in FORM and ENDFORM, you can call the Function Module.With in the Program Lines editor, u can define the subroutine........PERFORM. 
    If helpful, reward points.
    Rgds,
    CK

  • Passing function parameters in a non-sequential fashon

    Consider the function below:
    function personal(Name:String,age:int,city:String):void
       trace(Name+" is "+age+ " years old and lives in "+city+ ".")
    The parameters can only(???) be passed in the order they are declared in the function as shown below.
    personal("John",40,"London"0)
    If the order is changed as: personal("London",John", 40), there will obviously be a type related error (position 2 parameter is an integer).
    Is there a way of passing function parameters as: personal(city="London",Name=John",age= 40)?
    That way one does not have to worry about the 'order' in which the parameters are passed.

    Micheal, I love such ELEGENCE.
    One more question, before I 'attempt' to go to bed!
    Below is code extracted from my main class definition.
    Notice how I 'populate' the artist object  before I pass it on as a parameter to my saveRecord function.
    It is rather clamsy, I think. Is there a better way of doing it?
    import ARTISTS
    var artist:ARTISTS = new ARTISTS;
    artist.ARTISTID = 123678;
    artist.FIRSTNAME = "Gordon";
    artist.LASTNAME = "Brown";
    artist.ADDRESS= "13 Darwin Street";
    artist.CITY= "London"
    saveRecord(artist);
    saveRecord(params:ARTISTS){
         //Some code here

  • Question about function parameters

    Looking at a piece of code.
    A function is defined with 3 parameters.  None of the parameters are "default" parameters.
    Call to the function only passes 2 paramters.  ie myfunc(parm1,parm2).  Have read the docs regarding
    function parameters.  Not sure how this is working (which it is).   Am I missing something ?
    I am new to flex so it could be I am missing a fundamental concept of flex.
    thanks.

    Thanks but its not defaulted.
    Here is the call
    mystuff.call(buildstuff, parms);
    here is the definition:
    public class mystuff{
      public function call (remote1:string,  remote2:Function, parms:Object):void{
        remote1 = "prefix." + remote1;
        different.call(remote1, new Responder(remote2, this.onFault),parms);
    public function onFault(fault:String):void{
      Alert.show(fault, "Error:", mxcontrols.Alert.OK);
    thanks.

  • Pass procedure/function parameters via URL

    how to pass procedure or function parameters via URL? External link processes payment, and returns some data. I have an example procedure that forms correct URL like:
    http://www.website.lt:7777/apex/f?p=109:6:1512552728675996::::P23_LOGIN_ID:UTREEP7Q84FHG
    but the other procedure returns with URL (and its wrong):
    http://www.website.lt:7777/apex/nora.pay_cancel?token=EC-76F379209K155914F
    the source of pay_cancel procedure:
    create or replace procedure pay_cancel
    (token in varchar2)
    as
    begin
    owa_util.redirect_url('f?p='||'109'||':'||'5'); --some test page
    end pay_cancel;
    whats wrong with the return variable?

    Sorry, permission problems, everything is OK with +<schema>.<procedure>?<variable>=<value>+ syntax.
    Execute sql: grant execute on pay_cancel to public;

  • How to automatically load function parameters when editing c/c++ DLL call?

    I built a DLL in CVI and is used in TestStand, I want this DLL to have the ability to automatically load function parameters after specifying Module pathname and function name in "Edit C/C++ DLL Call" dialog? How can I do it?

    Staring with CVI 7.1 and TestStand 3.1 you do not need a type library for TestStand to load parameters automatically. Just make sure you declare your exported functions with the __declspec(dllexport) modifier as in the following code:
    __declspec(dllexport) void fun(void)

  • Function parameters & Class changes

    Some things that are missing in the Flash Builder IDE, that ARE in the Flex 3 SDK w/ Eclipse.
    Changes to classes are not updates within the package until restart, instead of on save and/or Refresh.
    Function parameters only show (... parameters) instead of the actual parameters.

    Java has no possibility to define default values in functions.
    However you could write your own checking, if null is passed.
    if (var == null) { var = "somevalue"; }Other possibility to use variable number of arguments:
    public void function(Object ... objects)but the implementation should deal with the actual parameters. For this later see: http://java.sun.com/j2se/1.5.0/docs/guide/language/varargs.html

  • How to use parameters in smartform genrated  function module

    i executed smartform one functional module is genrated  '/1BCDWB/SF00000002'
    now the problem is that  i want to send  output of this smartform through email
    now how to use ' MAIL_RECIPIENT   '      and  ' MAIL_SENDER   ' to send smartform output through email .
    please check following module which generated by smartform.
    plz suggest me  .
    CALL FUNCTION '/1BCDWB/SF00000002'
    EXPORTING
      ARCHIVE_INDEX              =
      ARCHIVE_INDEX_TAB          =
      ARCHIVE_PARAMETERS         =
      CONTROL_PARAMETERS         =
      MAIL_APPL_OBJ              =
      MAIL_RECIPIENT             =
      MAIL_SENDER                =
      OUTPUT_OPTIONS             =
      USER_SETTINGS              = 'X'
    IMPORTING
      DOCUMENT_OUTPUT_INFO       =
      JOB_OUTPUT_INFO            =
      JOB_OUTPUT_OPTIONS         =
      TABLES
        ITAB_PA0001                =   ITAB_PA0001
    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.

    Hi
    You can do it while passing these parameters in the CONTROL_PARAMETERS.
    data: ls_CONTROL_PARAMETERS type SSFCTRLOP.
    ls_CONTROL_PARAMETERS-DEVICE  = 'LOCL'.
    ls_CONTROL_PARAMETERS-NO_DIALOG = 'X'.
    ls_CONTROL_PARAMETERS-PREVIEW = ' '.
    Pass this ls_CONTROL_PARAMETERS to the importing parameter of the FM .
         CALL FUNCTION LF_FM_NAME
               EXPORTING
                          CONTROL_PARAMETERS   = LS_CONTROL_PARAM
    In addition to this, you might also want to set the print immediately field on the same structure to 'X'.
    Generally you leave the device field empty, the user master record default printer will be used

  • Printing options in parameters of function module of smartforms

    HI experts,
    i hav a loop inside driver program where for every loop it calls smartform and the printing is continuous. But can any one help me how to control this by not displaying LPD. So that directly i can see the preview after all loop passes
    Advanced
    thanks
    Krish

    Hi,
    In this I suggest you to capture the data in the OTF format adn append the details after every LOOP pass and finally after ENDLOOP. Now use this OTF data to display the details in PDF where you have option to save the details and Print the form details.
    Pass the below variable as 'X' in the control parameters of the Smartform.
    ssfctrlop-getotf = 'X'.
    Now capture the OTF data return from the Smartform Function Module in the Importing Parameter "job_output_info" as shown below.
    data : wa_otf          TYPE ssfcrescl,
              it_otf type standard table of ssfcrescl with header  line.
    *ssfctrlop-getotf* = 'X'.
    Loop you Internal_table.
    *--Call the Smartform Function Module for Displaying the Details
        CALL FUNCTION lv_fname
          EXPORTING
            control_parameters = wa_ssfctrlop
            output_options     = wa_ssfcompop
            user_settings      = k_space1
            wa_output          = p_details
          IMPORTING
            job_output_info    = wa_otf
          EXCEPTIONS
            formatting_error   = 1
            internal_error     = 2
            send_error         = 3
            user_canceled      = 4
            OTHERS             = 5.
    append wa_otf to it_otf.
    Endloop.
    *--To display the Smartform the PDF format where thr Printing the Form
    *--can be done
          CALL FUNCTION 'HR_IT_DISPLAY_WITH_PDF'
            TABLES
              otf_table = it_otf-otfdata.

  • Function Module in SmartForm

    Hellow experts,
    Here i have one Function Module like ZSAMPLE1.
    I want to display it output in SmartForm.
    What should I do for this. Pls help me.
    with regards
    babu

    Hi look this code it will use ful to u
    report  zpsr3m_invoice_coversheet  no standard page heading
                                          message-id zps.
    tables: proj,
            prps,
            vbrk,
            vbrp,
            bseg,
            likp,
            pa0105,
            pa0002,
            t001,
            adrc,
            konv,
            tvzbt.
    -{ Type Definitions } -
    types: begin of typ_prps,
             pspnr  like  prps-pspnr,
           end of typ_prps,
           begin of typ_aufnr,
             aufnr  like  afko-aufnr,
           end of typ_aufnr,
           begin of typ_vbeln,
             vbeln  like  vbrk-vbeln,
           end of typ_vbeln,
           begin of typ_konv,
             knumv  like  konv-knumv,
             kposn  like  konv-kposn,
             kwert  like  konv-kwert,
           end of typ_konv.
    -{ Internal Tables } -
    data: gt_invitems like standard table of zpss_rrbinv_items
                      with header line,
          gt_pspnr     type standard table of typ_prps
                      with header line,
          gt_aufnr    type standard table of typ_aufnr
                      with header line,
          gt_vbeln    type standard table of typ_vbeln
                      with header line,
          gt_konv     type standard table of typ_konv
                      with header line.
    data: gt_mess_att like solisti1 occurs 0 with header line.
    -{ Work Areas } -
    data: gst_invheader like zpss_rrbinv_header,
          begin of gwa_bseg,
            bukrs like bseg-bukrs,
            belnr like bseg-belnr,
            gjahr like bseg-gjahr,
            txdat like bseg-txdat,
            filkd like bseg-filkd,
          end of   gwa_bseg.
    data: gst_control_parameters type ssfctrlop,
          gst_output_options     type ssfcompop,
          gt_job_output_info     type ssfcrescl,
          gt_output_options      type ssfcresop.
    constants: gc_formname type tdsfname value 'ZPS_INVOICE_COVERSHEET1',
             gc_usrty    like pa0105-usrty value '0001'.
    data: gv_fm_name  type rs38l_fnam,
          gv_pernr    like pa0105-pernr,
          gv_uname    like sy-uname.
    ranges: gr_pspnr for prps-pspnr,
            gr_aufnr for afko-aufnr.
    -{ Selection - Screen } -
    selection-screen begin of block blk1 with frame title text-001.
    parameters: gp_pspid like proj-pspid memory id psp,
                gp_vbeln like vbrk-vbeln.
    selection-screen end of block blk1.
    selection-screen begin of block blk2 with frame title text-002.
    parameters: gp_layut type tdsfname , "LIKE vbrp-arktx ,     "DEVK933900
               gp_logo  like rstxt-tdname default 'RRB_KBR_COLOR' .
    selection-screen end of block blk2.
    selection-screen begin of block blk3 with frame title text-009.
    parameters: gp_norm radiobutton group r1 default 'X',
                gp_pdf  radiobutton group r1 .
    selection-screen end of block blk3.
    -{AT SELECTION-SCREEN } -
    at selection-screen on gp_pspid.
      if gp_pspid is not initial.
        perform f_validate_project.
    ELSE.
       MESSAGE E000 WITH
       'Enter any Project definition...'(006).
      endif.
    at selection-screen on gp_vbeln.
      if gp_vbeln is not initial.
        perform f_validate_billing_doc.
      else.
        message e000 with
        'Enter Invoice Number.....'(005).
      endif.
    at selection-screen output.
      gp_pspid = gp_pspid.
    at selection-screen on value-request for gp_logo.
      perform f_get_logo changing gp_logo.
    at selection-screen on value-request for gp_vbeln.
      perform f_get_invoice changing gp_vbeln.
    -{ START-OF-SELECTION } -
    start-of-selection.
    Get the other data for the form.
      perform f_get_other_invoice_details.
    Call the SMART FORM to print the invoice.
      perform f_print_invoice_covsheet.
    *&      Form  F_GET_LOGO
          To get the Invoice LOGO to print in the SMART FORMS
         <--EV_LOGO  text
    form f_get_logo  changing ev_logo.
      ev_logo = 'RRB_KBR_COLOR'.
    endform.                    " F_GET_LOGO
    *&      Form  F_VALIDATE_PROJECT
          To validate the project definition entered
    form f_validate_project .
      select single *
        from proj
       where pspid = gp_pspid.
      if sy-subrc ne 0.
        message e000 with
        'Project definition not found..........'(003).
      endif.
    endform.                    " F_VALIDATE_PROJECT
    *&      Form  f_validate_billing_doc
          To validate the Billing document
    form f_validate_billing_doc .
    Get all the project elements
      perform f_get_project_data.
      if gp_pspid is not initial.
        if gr_pspnr[] is not initial or
           gr_aufnr[] is not initial.
    Check the billing document is from the current project only.
          select mvgr1 mvgr2 mvgr3 mvgr4 mvgr5 matnr arktx vbeln posnr netwr
          vrkme
            into table gt_invitems
            from vbrp
           where vbeln eq gp_vbeln
             and ( ps_psp_pnr in gr_pspnr or
                   aufnr      in gr_aufnr ).
          if sy-subrc eq 0.
            select single vbeln bstnk_vf zterm stceg
                          bukrs waerk belnr gjahr
                          ernam knumv kunrg fkdat
              into (gst_invheader-vbeln,
                    gst_invheader-bstnk_vf,
                    gst_invheader-zterm,
                    gst_invheader-stceg,
                    gwa_bseg-bukrs,
                    gst_invheader-waerk,
                    gwa_bseg-belnr,
                    gwa_bseg-gjahr,
                    vbrk-ernam,
                    vbrk-knumv,
                    gst_invheader-kunrg,
                    vbrk-fkdat)
               from vbrk
              where vbeln = gp_vbeln.
          else.
            message e037 with gp_pspid.
    Invoice does not belong to any WBS/Netowrk of the project:
          endif.
        endif.
      else.
        select single vbeln bstnk_vf zterm stceg
                      bukrs waerk belnr gjahr
                      ernam knumv kunrg fkdat
          into (gst_invheader-vbeln,
                gst_invheader-bstnk_vf,
                gst_invheader-zterm,
                gst_invheader-stceg,
                gwa_bseg-bukrs,
                gst_invheader-waerk,
                gwa_bseg-belnr,
                gwa_bseg-gjahr,
                vbrk-ernam,
                vbrk-knumv,
                gst_invheader-kunrg,
                vbrk-fkdat)
           from vbrk
          where vbeln = gp_vbeln.
      endif.
    endform.                    " f_validate_billing_doc
    *&      Form  f_get_project_data
          text
    form f_get_project_data .
      clear: gt_pspnr, gt_pspnr[],
             gt_aufnr, gt_aufnr[],
             gr_pspnr, gr_pspnr[],
             gr_aufnr, gr_aufnr[].
    Get the project
      if gp_pspid is initial.
        get parameter id 'PSP' field gp_pspid.
      endif.
      check gp_pspid is not initial.
      select single *
        from proj
       where pspid = gp_pspid.
    First get all the wbs elements of the project
      select pspnr
        into table gt_pspnr
        from prps
       where psphi = proj-pspnr.
      if sy-subrc eq 0.
        loop at gt_pspnr.
          gr_pspnr-sign = 'I'.
          gr_pspnr-option = 'EQ'.
          gr_pspnr-low    = gt_pspnr-pspnr.
          append gr_pspnr.
        endloop.
      endif.
    Get all the networks.
      select distinct aufnr
        into table gt_aufnr
        from caufv
       where pronr eq proj-pspnr.
      if sy-subrc eq 0.
        loop at gt_aufnr.
          gr_aufnr-sign   = 'I'.
          gr_aufnr-option = 'EQ'.
          gr_aufnr-low    = gt_aufnr-aufnr.
          append gr_aufnr.
        endloop.
      endif.
    endform.                    " f_get_project_data
    *&      Form  f_get_invoice
          text
         <--EV_VBELN  text
    form f_get_invoice  changing ev_vbeln.
      data: lv_fieldname like help_info-fieldname,
            lv_tabname   like help_info-tabname,
            lv_value     like help_info-fldvalue,
            lv_index     like sy-tabix.
      data: lt_fields like help_value occurs 0 with header line,
            lt_dynpread like dynpread occurs 0 with header line.
      lt_dynpread-fieldname = 'GP_PSPID'.
      append lt_dynpread.
    Read the screen input first.
      call function 'DYNP_VALUES_READ'
        exporting
          dyname               = sy-repid
          dynumb               = sy-dynnr
        tables
          dynpfields           = lt_dynpread
        exceptions
          invalid_abapworkarea = 1
          invalid_dynprofield  = 2
          invalid_dynproname   = 3
          invalid_dynpronummer = 4
          invalid_request      = 5
          no_fielddescription  = 6
          invalid_parameter    = 7
          undefind_error       = 8
          double_conversion    = 9
          stepl_not_found      = 10
          others               = 11.
      if sy-subrc <> 0.
        message id sy-msgid type sy-msgty number sy-msgno
                with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      else.
        read table lt_dynpread with key fieldname = 'GP_PSPID'.
        if sy-subrc eq 0.
          gp_pspid = lt_dynpread-fieldvalue.
        endif.
      endif.
      if gp_pspid is not initial.
    Get the project data first
        perform f_get_project_data.
    Get the invoice list now.
        if gr_pspnr[] is not initial.
          select distinct vbeln
            into table gt_vbeln
            from vbrp
           where ps_psp_pnr in gr_pspnr.
        endif.
        if gr_aufnr[] is not initial.
          select distinct vbeln
            appending table gt_vbeln
            from vbrp
           where aufnr      in gr_aufnr .
        endif.
      else.
        select vbeln
          into table gt_vbeln
          from vbrk.
      endif.
      if gt_vbeln[] is not initial.
        lt_fields-tabname     = lv_tabname   = 'VBRK'.
        lt_fields-fieldname   = lv_fieldname = 'VBELN'.
        lt_fields-selectflag  = 'X'.
        append lt_fields.
        call function 'HELP_VALUES_GET_NO_DD_NAME'
          exporting
            cucol                        = '5'
            curow                        = '5'
            selectfield                  = lv_fieldname
            titel                        = text-008 "'Select Any Value'
          importing
            ind                          = lv_index
            select_value                 = lv_value
          tables
            fields                       = lt_fields
            full_table                   = gt_vbeln
          exceptions
            full_table_empty             = 1
            no_tablestructure_given      = 2
            no_tablefields_in_dictionary = 3
            more_then_one_selectfield    = 4
            no_selectfield               = 5
            others                       = 6.
        if sy-subrc <> 0.
          message s000 with
          'No Invoices found for the project definition..'(007).
        else.
          clear gt_vbeln.
          read table gt_vbeln index lv_index.
          ev_vbeln = gt_vbeln-vbeln.
        endif.
      else.
        message s000 with
          'No Invoices found for the project definition..'(007).
      endif.
    endform.                    " f_get_invoice
    *&      Form  F_PRINT_INVOICE_COVSHEET
          text
    form f_print_invoice_covsheet .
    Call the function module to get the name of the
    function module name which will be generated dynamically for
    the layout
      call function 'SSF_FUNCTION_MODULE_NAME'
        exporting
         formname           = gc_formname
           formname          = gp_layut
        importing
          fm_name            = gv_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.
    Set up the output options for the smart form
      clear gst_output_options.
    GST_OUTPUT_OPTIONS-tddest   = sy-pdest.
      gst_output_options-tddest   = 'FWIN'.             "Frontend printer
      gst_output_options-tdnewid  = sy-prnew.
      gst_output_options-tdimmed  = 'X'.
      gst_output_options-tddelete = sy-prrel.
      clear gst_control_parameters.
    Setup to generate OTF internal table
      gst_control_parameters-no_dialog = 'X'.
      gst_control_parameters-getotf    = 'X'.
      gst_control_parameters-preview   = 'X'.       "Deactivate preview!
      if gp_norm is not initial.
    Call the original function module.
        call function gv_fm_name
          exporting
            inv_header       = gst_invheader
          tables
            inv_data         = gt_invitems
          exceptions
            formatting_error = 1
            internal_error   = 2
            send_error       = 3
            user_canceled    = 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.
      else.
    Call the original function module.
        call function gv_fm_name
          exporting
            control_parameters = gst_control_parameters
            output_options     = gst_output_options
            inv_header         = gst_invheader
          importing
            job_output_info    = gt_job_output_info
            job_output_options = gt_output_options
          tables
            inv_data           = gt_invitems
          exceptions
            formatting_error   = 1
            internal_error     = 2
            send_error         = 3
            user_canceled      = 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.
    Display PDF Preview Screen
        perform pdf_preview     using    gt_job_output_info-otfdata.
      endif.
    endform.                    " F_PRINT_INVOICE_COVSHEET
    *&      Form  f_get_other_invoice_details
          text
    form f_get_other_invoice_details .
      data: lv_index     like sy-tabix,
            lwa_invitems like gt_invitems.
      data: lt_invitems  like gt_invitems occurs 0 with header line,
            lt_invitems1 like gt_invitems occurs 0 with header line.
    Get the prepared by person name.
      if gst_invheader-ernam is not initial.
        select single pernr
          into pa0105-pernr
          from pa0105
         where usrty = gc_usrty
           and usrid = gst_invheader-ernam.
        select nachn vorna
          up to 1 rows
          into (pa0002-nachn, pa0002-vorna)
          from pa0002
         where pernr = pa0105-pernr.
        endselect.
        condense: pa0002-nachn, pa0002-vorna.
        concatenate  pa0002-nachn          pa0002-vorna
               into  gst_invheader-ernam
       separated by  space.
      endif.
    Get logo
      move gp_logo to gst_invheader-logo.
    Write the date as required.
      if vbrk-fkdat is not initial and
         vbrk-fkdat ne '00000000'.
        perform f_write_date changing gst_invheader-txdat.
      endif.
    Get the description for Payment terms
      select single *
        from tvzbt
       where spras eq sy-langu
         and zterm eq gst_invheader-zterm.
      if sy-subrc eq 0.
        condense: tvzbt-vtext, gst_invheader-zterm.
        concatenate gst_invheader-zterm '-' tvzbt-vtext
               into gst_invheader-zterm.
      endif.
    Get the billing address.
      select adrnr
        up to 1 rows
        into gst_invheader-adrnr
        from vbpa
       where vbeln = gst_invheader-vbeln
         and parvw = 'RE'.
      endselect.
      if sy-subrc ne 0.
        message i000 with
        'Billing Party address of Customer is not maintained..'(009).
        stop.
      endif.
    Get the company code address (Registered Address).
      select single adrnr
        into t001-adrnr
        from t001
       where bukrs = gwa_bseg-bukrs.
      if sy-subrc eq 0.
        select name1 street city1 post_code1
               region country
               up to 1 rows
          into (adrc-name1, adrc-street, adrc-city1, adrc-post_code1,
                adrc-region, adrc-country)
          from adrc
         where addrnumber = t001-adrnr
           and date_from le sy-datum.
        endselect.
        if sy-subrc eq 0.
          condense: adrc-name1, adrc-street, adrc-city1,
                    adrc-post_code1, adrc-region, adrc-country.
          concatenate adrc-name1 ',  ' adrc-street
                 into gst_invheader-zzregoff_line1.
          concatenate adrc-city1 ',  '  adrc-region ',  '
                      adrc-country ' ' adrc-post_code1
                 into gst_invheader-zzregoff_line2.
        endif.
      endif.
      gv_uname = vbrk-ernam.
    Get the Prepared by Person name.
      call function 'CRIF_GET_EMPLOYEE_FOR_USER'       "just like this
        exporting
          user_name               = gv_uname
          begindate               = sy-datum
          enddate                 = sy-datum
        importing
          employeenumber          = gv_pernr
        exceptions
          no_employeenumber_found = 1
          subtype_not_available   = 2
          others                  = 3.
      if sy-subrc eq 0.
        select single *
          from pa0002
         where pernr = gv_pernr
          and begda le sy-datum
          and endda ge sy-datum.
        concatenate pa0002-vorna pa0002-nachn into
                    gst_invheader-ernam separated by space.
      endif.
    Get the  Invoice items
      if gt_invitems[] is initial.
        select mvgr1 mvgr2 mvgr3 mvgr4 mvgr5 matnr arktx vbeln posnr netwr
          into table gt_invitems
          from vbrp
         where vbeln eq gp_vbeln.
        if sy-subrc eq 0.
          sort gt_invitems by mvgr1 mvgr2 mvgr3 mvgr4 mvgr5 arktx matnr.
        endif.
      endif.
    Get the VAT on the billing items through condition
    type 'MWST'.
      if gt_invitems[] is not initial.
        select knumv kposn kwert
          into table gt_konv
          from konv
          for all entries in gt_invitems
         where knumv = vbrk-knumv
           and kposn = gt_invitems-posnr
           and kschl = 'MWST'.
        if sy-subrc eq 0.
    Now loop through the condition value table and modify the invoice item
    table.
          sort gt_konv by knumv kposn.
          loop at gt_invitems.
            lv_index = sy-tabix.
            read table gt_konv with key knumv = vbrk-knumv
                                        kposn = gt_invitems-posnr
                                        binary search.
            if sy-subrc eq 0.
              gt_invitems-kwert = gt_konv-kwert.
              modify gt_invitems index lv_index transporting kwert.
            endif.
            lt_invitems = gt_invitems.
            at end of arktx.
              sum.
              move: gt_invitems-netwr to lt_invitems-netwr,
                    gt_invitems-kwert to lt_invitems-kwert.
              collect lt_invitems.
            endat.
          endloop.
    Take the summarized table for display in the output.
          clear gt_invitems[].
          gt_invitems[] = lt_invitems[].
          clear lt_invitems[].
          free lt_invitems[].
        else.
          loop at gt_invitems.
            lt_invitems = gt_invitems.
            clear: lt_invitems-vbeln, lt_invitems-posnr.
            at end of arktx.
              sum.
              move: gt_invitems-netwr to lt_invitems-netwr,
                    gt_invitems-kwert to lt_invitems-kwert.
              collect lt_invitems.
            endat.
          endloop.
    Take the summarized table for display in the output.
          clear gt_invitems[].
          gt_invitems[] = lt_invitems[].
          clear lt_invitems[].
          free lt_invitems[].
        endif.
    sort the table.
        lt_invitems1[] = gt_invitems[].
        delete lt_invitems1 where mvgr1 ne space or
                                  mvgr2 ne space or
                                  mvgr3 ne space or
                                  mvgr4 ne space or
                                  mvgr5 ne space.
        delete gt_invitems where mvgr1 = space and
                                 mvgr2 = space and
                                 mvgr3 = space and
                                 mvgr4 = space and
                                 mvgr5 = space.
        sort gt_invitems by mvgr1 mvgr2 mvgr3 mvgr4 mvgr5.
    Now, construct the output table with mat grp descriptions
        loop at gt_invitems.
          lwa_invitems = gt_invitems.
          clear: lt_invitems-arktx,
                 lt_invitems-netwr,
                 lt_invitems-kwert.
    Material group 1
          at new mvgr1.
            if lwa_invitems-mvgr1 is not initial.
              select single bezei from tvm1t into lt_invitems-arktx
               where spras = sy-langu
                 and mvgr1 = lwa_invitems-mvgr1.
              append lt_invitems.
            endif.
          endat.
    Material group 2
          clear: lt_invitems-arktx,
                 lt_invitems-netwr,
                 lt_invitems-kwert.
          at end of mvgr2.
            if lwa_invitems-mvgr2 is not initial.
              select single bezei from tvm2t into lt_invitems-arktx
               where spras = sy-langu
                 and mvgr2 = lwa_invitems-mvgr2.
              if lt_invitems-mvgr3 is initial and
                 lt_invitems-mvgr4 is initial and
                 lt_invitems-mvgr5 is initial.
                sum.
                move: gt_invitems-netwr to lt_invitems-netwr,
                      gt_invitems-kwert to lt_invitems-kwert.
              endif.
              concatenate '->' lt_invitems-arktx into lt_invitems-arktx.
              append lt_invitems.
            endif.
          endat.
    Material group 3
          clear: lt_invitems-arktx,
                 lt_invitems-netwr,
                 lt_invitems-kwert.
          at end of mvgr3.
            if lwa_invitems-mvgr3 is not initial.
              select single bezei from tvm3t into lt_invitems-arktx
               where spras = sy-langu
                 and mvgr3 = lwa_invitems-mvgr3.
              if lt_invitems-mvgr4 is initial and
                 lt_invitems-mvgr5 is initial.
                sum.
                move: gt_invitems-netwr to lt_invitems-netwr,
                      gt_invitems-kwert to lt_invitems-kwert.
              endif.
              concatenate '-->' lt_invitems-arktx into lt_invitems-arktx.
              append lt_invitems.
            endif.
          endat.
    Material group 4
          clear: lt_invitems-arktx,
                 lt_invitems-netwr,
                 lt_invitems-kwert.
          at end of mvgr4.
            if lwa_invitems-mvgr4 is not initial.
              select single bezei from tvm4t into lt_invitems-arktx
               where spras = sy-langu
                 and mvgr4 = lwa_invitems-mvgr4.
              if lt_invitems-mvgr5 is initial.
                sum.
                move: gt_invitems-netwr to lt_invitems-netwr,
                      gt_invitems-kwert to lt_invitems-kwert.
              endif.
              concatenate '--->' lt_invitems-arktx into lt_invitems-arktx.
              append lt_invitems.
            endif.
          endat.
    Material group 5
          clear: lt_invitems-arktx,
                 lt_invitems-netwr,
                 lt_invitems-kwert.
          at end of mvgr5.
            if lwa_invitems-mvgr5 is not initial.
              select single bezei from tvm5t into lt_invitems-arktx
               where spras = sy-langu
                 and mvgr5 = lwa_invitems-mvgr5.
              sum.
              move: gt_invitems-netwr to lt_invitems-netwr,
                    gt_invitems-kwert to lt_invitems-kwert.
              concatenate '---->' lt_invitems-arktx into lt_invitems-arktx.
              append lt_invitems.
            endif.
          endat.
    Material group 1
          at end of mvgr1.
            if lwa_invitems-mvgr1 is not initial.
              select single bezei from tvm1t into lt_invitems-arktx
               where spras = sy-langu
                 and mvgr1 = lwa_invitems-mvgr1.
              concatenate 'Total ' lt_invitems-arktx into lt_invitems-arktx
                               separated by space.
              if lt_invitems-mvgr2 is initial and
                 lt_invitems-mvgr3 is initial and
                 lt_invitems-mvgr4 is initial and
                 lt_invitems-mvgr5 is initial.
                sum.
                move: gt_invitems-netwr to lt_invitems-netwr,
                      gt_invitems-kwert to lt_invitems-kwert.
              endif.
              append lt_invitems.
            endif.
          endat.
        endloop.
    Now keep all the records with non material groups.
        sort lt_invitems1 by arktx.
        loop at lt_invitems1.
          lwa_invitems = lt_invitems1.
          at end of arktx.
            lt_invitems = lwa_invitems.
            sum.
            move: lt_invitems1-netwr to lt_invitems-netwr,
                  lt_invitems1-kwert to lt_invitems-kwert.
            append lt_invitems.
          endat.
        endloop.
      endif.
    Take the summarized table for display in the output.
    if gp_layut <> 'ZPS_INVOICE_COVERSHEET3'.
      clear gt_invitems[].
      gt_invitems[] = lt_invitems[].
      clear lt_invitems[].
      free lt_invitems[].
    endif.
    endform.                    " f_get_other_invoice_details
    Form:  pdf_preview
    Desc:  Preview PDF Debit/Credit memo
    form pdf_preview  using      iv_otfdata    type tsfotf.
    PREVIEW PDF Credit Memo
      call function 'SSFCOMP_PDF_PREVIEW'
        exporting
          i_otf                    = iv_otfdata
        exceptions
          convert_otf_to_pdf_error = 1
          cntl_error               = 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.                    "pdf_preview
    *&      Form  f_write_date
          To write the date in format
         <--CV_date  date
    form f_write_date  changing cv_date.
      data: lv_date like sy-datum.
      lv_date = vbrk-fkdat.
      clear cv_date.
      case lv_date+4(2).
        when '01'.
          write '-Jan-' to cv_date.
        when '02'.
          write '-Feb-' to cv_date.
        when '03'.
          write '-Mar-' to cv_date.
        when '04'.
          write '-Apr-' to cv_date.
        when '05'.
          write '-May-' to cv_date.
        when '06'.
          write '-Jun-' to cv_date.
        when '07'.
          write '-Jul-' to cv_date.
        when '08'.
          write '-Aug-' to cv_date.
        when '09'.
          write '-Sep-' to cv_date.
        when '10'.
          write '-Oct-' to cv_date.
        when '11'.
          write '-Nov-' to cv_date.
        when '12'.
          write '-Dec-' to cv_date.
      endcase.
      condense cv_date.
      concatenate lv_date6(2) cv_date lv_date0(4)
             into cv_date.
    endform.                    " f_write_date
    thanks
    suresh

  • Symaltaneous use of select-option and parameters in smartforms .

    hello Abaper,
    I am design a smartforms . we have given some input. when we use only parameters it works properly. as same when we use select-option only its works .
       But when i use both parameter and select option at that time error generate .
      Actually call function is not works .
    So please give me proper idea how to solve this problem .
    Regards
    kamal kishore

    Hi ,
    Still problem is not solved.
    i want to call following fields but function modules show run time error. IF separately i call only parameter its run properly.
    in the same way if i call only select option is runs properly.
    please suggest me how can i call both the things.
    PARAMETERS: P_BUKRS   TYPE BSEG-BUKRS        OBLIGATORY,
                P_GJAHR   TYPE BSEG-GJAHR        OBLIGATORY.
    parameters: P_SECCO type  SECCODE-SECCODE   OBLIGATORY.
    *SELECT-OPTIONS :  P_SECCO FOR  SECCODE-SECCODE   OBLIGATORY.
    PARAMETERS: P_QSCOD   TYPE J_1IEWTNUMGR-QSCOD OBLIGATORY.
    SELECT-OPTIONS: P_BUDAT FOR BKPF-BUDAT        OBLIGATORY,
                P_BLART   FOR BKPF-BLART,
                P_J_HLN   FOR J_1IEWTCHLN-J_1IEXTCHLN,
                P_J_HDT   FOR J_1IEWTCHLN-J_1IEXTCHDT OBLIGATORY,
                P_LIFNR   FOR LFB1-LIFNR.
    regards
    kamal
    Edited by: kamal_kishore_sah on Apr 12, 2011 7:44 AM

  • Reg .. functions used in smartforms

    Hye Friends,
    Im not getting y we use the functions SSF_OPEN AND SSF_CLOSE in smartforms.
    what is the basic defn of both and for what purpose they are used in.
    Many thanks
    Sunny

    Hi
    go through this:
    How to create a New smartfrom, it is having step by step procedure
    http://sap.niraj.tripod.com/id67.html
    Here is the procedure
    1. Create a new smartforms
    Transaction code SMARTFORMS
    Create new smartforms call ZSMART
    2. Define looping process for internal table
    Pages and windows
    First Page -> Header Window (Cursor at First Page then click Edit -> Node -> Create)
    Here, you can specify your title and page numbering
    &SFSY-PAGE& (Page 1) of &SFSY-FORMPAGES(Z4.0)& (Total Page)
    Main windows -> TABLE -> DATA
    In the Loop section, tick Internal table and fill in
    ITAB1 (table in ABAP SMARTFORM calling function) INTO ITAB2
    3. Define table in smartforms
    Global settings :
    Form interface
    Variable name Type assignment Reference type
    ITAB1 TYPE Table Structure
    Global definitions
    Variable name Type assignment Reference type
    ITAB2 TYPE Table Structure
    4. To display the data in the form
    Make used of the Table Painter and declare the Line Type in Tabstrips Table
    e.g. HD_GEN for printing header details,
    IT_GEN for printing data details.
    You have to specify the Line Type in your Text elements in the Tabstrips Output options.
    Tick the New Line and specify the Line Type for outputting the data.
    Declare your output fields in Text elements
    Tabstrips - Output Options
    For different fonts use this Style : IDWTCERTSTYLE
    For Quantity or Amout you can used this variable &GS_ITAB-AMOUNT(12.2)&
    5. Calling SMARTFORMS from your ABAP program
    REPORT ZSMARTFORM.
    Calling SMARTFORMS from your ABAP program.
    Collecting all the table data in your program, and pass once to SMARTFORMS
    SMARTFORMS
    Declare your table type in :-
    Global Settings -> Form Interface
    Global Definintions -> Global Data
    Main Window -> Table -> DATA
    Written by : SAP Hints and Tips on Configuration and ABAP/4 Programming
    http://sapr3.tripod.com
    TABLES: MKPF.
    DATA: FM_NAME TYPE RS38L_FNAM.
    DATA: BEGIN OF INT_MKPF OCCURS 0.
    INCLUDE STRUCTURE MKPF.
    DATA: END OF INT_MKPF.
    SELECT-OPTIONS S_MBLNR FOR MKPF-MBLNR MEMORY ID 001.
    SELECT * FROM MKPF WHERE MBLNR IN S_MBLNR.
    MOVE-CORRESPONDING MKPF TO INT_MKPF.
    APPEND INT_MKPF.
    ENDSELECT.
    At the end of your program.
    Passing data to SMARTFORMS
    call function 'SSF_FUNCTION_MODULE_NAME'
    exporting
    formname = 'ZSMARTFORM'
    VARIANT = ' '
    DIRECT_CALL = ' '
    IMPORTING
    FM_NAME = FM_NAME
    EXCEPTIONS
    NO_FORM = 1
    NO_FUNCTION_MODULE = 2
    OTHERS = 3.
    if sy-subrc <> 0.
    WRITE: / 'ERROR 1'.
    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'
    IMPORTING
    DOCUMENT_OUTPUT_INFO =
    JOB_OUTPUT_INFO =
    JOB_OUTPUT_OPTIONS =
    TABLES
    GS_MKPF = INT_MKPF
    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.
    for Smartforms material
    http://www.sap-basis-abap.com/sapsf001.htm
    http://www.sap-press.com/downloads/h955_preview.pdf
    http://www.ossincorp.com/Black_Box/Black_Box_2.htm
    http://www.sap-img.com/smartforms/sap-smart-forms.htm
    http://www.sap-img.com/smartforms/smartform-tutorial.htm
    http://www.sapgenie.com/abap/smartforms.htm
    How to trace smartform
    http://help.sap.com/saphelp_47x200/helpdata/en/49/c3d8a4a05b11d5b6ef006094192fe3/frameset.htm
    http://www.help.sap.com/bp_presmartformsv1500/DOCU/OVIEW_EN.PDF
    http://www.sap-img.com/smartforms/smart-006.htm
    http://www.sap-img.com/smartforms/smartforms-faq-part-two.htm
    Re: Need FAQ's
    check most imp link
    http://www.sapbrain.com/ARTICLES/TECHNICAL/SMARTFORMS/smartforms.html
    step by step good ex link is....
    http://smoschid.tripod.com/How_to_do_things_in_SAP/How_To_Build_SMARTFORMS/How_To_Build_SMARTFORMS.html
    Reward points if useful
    Regards
    Anji

Maybe you are looking for