How to create the funtion module with step by step

friends can u help me regarding how to create the function module very urgent,
regards
bhavani

To create a function module, you first need to create a Function Group which will keep all the function module of same functionality.
To create a Function Group, go to SE80->Click on Workbench-Edit Object->Function Group Tab->Enter Function Group name-> Click Create.
To create a Function Module:
Go to T.Code SE37->Enter the Function name->Enter Function Group name n Short Des.-> Here you need to define Import, Export parameters with the condition. Also you can write your code in source code tab.
check this link
Converting seconds values
check the FM code. if you don't have this FM code, create it in SE37 and make use of it.
FM MONI_TIME_CONVERT
FUNCTION MONI_TIME_CONVERT.
""Lokale Schnittstelle:
*" IMPORTING
*" REFERENCE(LD_DURATION) TYPE SY-TABIX
*" EXPORTING
*" REFERENCE(LT_OUTPUT_DURATION) TYPE SWL_PM_CVH-DURATION
DATA: LD_HOUR(4) TYPE N. "
DATA: LD_MIN(4) TYPE N. "
DATA: LD_SEC(4) TYPE N. "
DATA: LD_VALUE2(2) TYPE N.
DATA: LD_VALUE3(3) TYPE N.
DATA: LD_VALUE4(4) TYPE N.
DATA: SAVE_DURATION LIKE SY-TABIX.
data: ld_minus(1).
SAVE_DURATION = LD_DURATION.
if ld_duration < 0.
save_duration = save_duration * ( -1 ).
ld_minus = true.
endif.
CLEAR LT_OUTPUT_DURATION.
IF SAVE_DURATION NE 0.
LD_HOUR = SAVE_DURATION DIV 3600.
save_duration = save_duration - ld_hour * 3600.
LD_MIN = SAVE_DURATION DIV 60.
save_duration = save_duration - ld_min * 60.
LD_SEC = SAVE_DURATION.
IF LD_HOUR LE 100.
LD_VALUE2 = LD_HOUR.
WRITE LD_VALUE2 TO LT_OUTPUT_DURATION+3(2).
ELSEIF LD_HOUR LE 1000.
LD_VALUE3 = LD_HOUR.
WRITE LD_VALUE3 TO LT_OUTPUT_DURATION+2(3).
ELSE.
LD_VALUE4 = LD_HOUR.
WRITE LD_VALUE4 TO LT_OUTPUT_DURATION(4).
ENDIF.
WRITE ':' TO LT_OUTPUT_DURATION+5.
LD_VALUE2 = LD_MIN.
WRITE LD_VALUE2 TO LT_OUTPUT_DURATION+6(2).
WRITE ':' TO LT_OUTPUT_DURATION+8.
LD_VALUE2 = LD_SEC.
WRITE LD_VALUE2 TO LT_OUTPUT_DURATION+9(2).
LT_OUTPUT_DURATION = LT_OUTPUT_DURATION+1.
if ld_minus = true.
write '-' to lt_output_duration+1(1).
endif.
ELSE.
job running or aborted
ENDIF.
ENDFUNCTION.
Eg:2
Use the following procedure to create a function module
1.From the ABAP/4 Development Workbench screen, press the Function Library button on the Application toolbar.
2.Type the name of your function module in the Function Module field. The name must begin with Y_ or Z_.
3.Press the Create button. The Function Module Create: Administration screen is shown
4.Type the name of a function group in the Function Group field. The function group name must be four characters long and must begin with Y or Z.
5.Type an S in the Application field. This field is used to indicate which function area uses the function module. Our functionality is not used by any functional area, it is simply an example, so any choice will do. (S indicates that the function module contains functionality needed by Basis.)
6.Type a description of the function module in the Short Text field. The contents of this field are seen when displaying a list of function modules.
Press the Save button on the Application toolbar.
7.If the function group does not already exist, a pop-up informs you of that fact and asks you if you want to create it. Press the Yes button to create the function group. The Create Function Group dialog box appears. Type a description in the Short Text field and press the Save button. The Create Object Catalog Entry screen appears. Press the Local Object button. You are returned to the Function Module Change: Administration screen.
8.Press the Source Code button on the Application toolbar. The Function Module Edit screen is displayed.
9.Type the source code for your function module. Do not change the system-generated comment lines under any circumstances! Your function module might fail to operate if you do.
10.Press the Save button on the Application toolbar. The message Program xxxxx saved appears in the status bar at the bottom of the window.
11.Press the Back button on the Application toolbar. You are returned to the Function Library Initial screen.
12.If you want to define import or export parameters, select the Import/Export Parameter Interface radio button. Press the Change pushbutton. You are shown the Import/Export Parameters screen (refer to Figure 19.6). Type the names of your parameters in the first column and enter any other desired characteristics for each parameter. When you are finished, press the Save button and then the Back button.
13.Finally, to activate your function module, press the Activate button on the Application toolbar of the Function Library Initial Screen.
http://www.erpgenie.com/abap/bapi/example.htm

Similar Messages

  • How to create a funtion module as i need.

    How to create a funtion module, that which should  retrive mutiple data with out using data structure.
    i.e..using internal table i need to get only some data.
    Example:
                1)  Using MARC table, i need to get fields only with data  (werks, matnr, mmsta, pstat).
    i.e importing : werks.
         exporting: werks,
                        matnr,
                        mmsta,
                         pstat.
                2) Also i need coding to get data by without using internal table with the only fields i want.

    Hi,
    You can only create function modules and function groups using the Function Builder in the ABAP Workbench. For further information, refer to Creating New Function Modules. This section uses an example to illustrate how a function module is created from the point of view of ABAP programming.
    <u><b>Function Groups and Function Modules:</b></u>
    Firstly, we create a new function group DEMO_SPFLI to hold the function module. Then, we can create the new function module.
    <u><b>Parameter Interface:</b></u>
    You can specify the types of interface parameters in function modules in the
    same way as the parameter interfaces of subroutines. Since function
    modules can be used anywhere in the system, their interfaces can only contain
    references to data types that are declared systemwide. These are the elementary
    ABAP data types, the systemwide generic types, such as ANY TABLE, and types
    defined in the ABAP Dictionary. You cannot use LIKE to refer to data types
    declared in the main program.
    <u><b>Exceptions:</b></u>
    Our function module needs an exception that it can trigger if there are no entries
    in table SPFLI that meet the selection criterion. The exception NOT_FOUND
    serves this function.
    <u><b>Source Code:</b></u>
    Having defined the parameter interface and exceptions, we can now write the
    source code of our function module. To do this, choose Source code in the
    Function Builder. This opens the ABAP Editor for the include program
    L<fgrp>U<xx> (see Function Groups). This is the include that will
    hold the program code for the function module;
    <i><u><b>Data in Function Modules</b></u></i>
    You can use the TYPES and DATA statements to create local data types and
    objects. The interface parameters also behave like local data objects. In
    addition, you can access all of the global data of the main program. This data is
    defined in the include program L<fgrp>TOP. To open this include, choose Goto
      Global data. The global data behaves like the instance attributes of a class.
    The first time you call a function module in a particular function group, the data is
    loaded into memory. It can then be accessed and changed by all of the function
    modules in the group. The system retains the values until the next time a function
    module is called.
    <u><b>Calling Subroutines</b></u>
    You use subroutines for local modularization. Function modules can
    also use this technique. The function module that they call are defined in the
    corresponding main program.
    If you only want to call a subroutine from a single function module, it is best to
    define them in the same include program as the function module itself, directly
    after the ENDFUNCTION statement. These subroutines can be called from all
    function modules in the function group, but for clarity, they should only be called
    from the function module that precedes them.
    If you want to define a subroutine that will be called from several different function
    modules, you can define a special include program for it with the name
    L<fgrp>F<xx>.
    <b><u><i>Raising Exceptions</i></u></b>
    There are two ABAP statements for raising exceptions. They can only be used in
    function modules:
    RAISE <except>.
    and
    MESSAGE..... RAISING <except>.
    The effect of these statements depends on whether the calling program handles
    the exception or not. If the name <except> of the exception or OTHERS occurs
    in the EXCEPTIONS addition of the CALL FUNCTION statement, the exception is
    handled by the calling program.
    If the calling program does not handle the exception
      The RAISE statement terminates the program and switches to debugging mode.
      The MESSAGE ..... RAISING statement display the specified message. How the
    processing continues depends on the message type.
    If the calling program handles the exception, both statements return control to the
    program. No values are transferred. The MESSAGE ..... RAISING statement
    does not display a message. Instead, it fills the system fields SY-MSGID, SYMSGTY,
    SY-MSGNO, and SY-MSGV1 to SY-MSGV4.
    Source Code of READ_SPFLI_INTO_TABLE
    The entire source code of READ_SPFLI_INTO_TABLE looks like this:
    FUNCTION READ_SPFLI_INTO_TABLE.
    ""Local interface:
    *" IMPORTING
    *" VALUE(ID) LIKE SPFLI-CARRID DEFAULT 'LH '
    *" EXPORTING
    *" VALUE(ITAB) TYPE SPFLI_TAB
    *" EXCEPTIONS
    *" NOT_FOUND
    SELECT * FROM SPFLI INTO TABLE ITAB WHERE CARRID = ID.
    IF SY-SUBRC NE 0.
    MESSAGE E007(AT) RAISING NOT_FOUND.
    ENDIF.
    ENDFUNCTION.
    The function module reads all of the data from the database table SPFLI where
    the key field CARRID is equal to the import parameter ID and places the entries
    that it finds into the internal table SPFLI_TAB. If it cannot find any entries, the
    exception NOT_FOUND is triggered using MESSAGE...RAISING. Otherwise, the
    table is passed to the caller as an exporting parameter.
    Regards,
    Bhaskar

  • How to Create the Function Module Exit

    Hi,
      How to Create the Function Module Exit. Please tell me the step by step procedure.

    Hi,
    Check this link for how to create the function module exit..
    http://sap.niraj.tripod.com/id62.html
    Thanks
    naren

  • SAP Cloud SDK : How to create the Note Field with Char 1000 length

    Hi Experts,
    I have a requirement to create Note type fields in the standard business object. and that note field should be 1000 char length.
    Also I need to check whether that Note field we can add under the standard report or not with report enhancement?
    1) How to make a Note type field using SDK with length 1000 char? Is it possible? If yes How ?
    2) If using SDK Note type field possible then how to display that field in report ?
    Many Thanks,
    Mithun

    Hi Frank and Horst,
    I have followed the steps you have mentioned in the post.
    1) Create Business Object Extension.
    2) Add the Custom Field with Type " LANGUAGEINDEPENDENT_EXTENDED_Text".
    3) Enhance the Screen and Add into the Header section of the COD_TI screen.
    I have successfully entered the unrestricted character into that field.
    But I want to add that custom field into the Standard Data Source or Standard Report.
    1) Is it possible to add custom field under the Standard Data Source or Report Using SDK?
    2) Is it Possible to display the 1000 character length on the Report field?
    3) Is it possible to display the created extension field under the report / data source using SDK?
    Many Thanks,
    Mithun

  • How to create the new row with existing values

    Hi all,
    first of all i create a row,
    i opened that in edit mode,
    suppose i want to edit any one of the value in that recordd,
    that time compulsory create a new row with those valuess.
    how can i create a new row with those valuess.

    Hi Anusha,
    This code correct for your requirement, only thing is you are not able to modify it as per your requirement.
    What you have to do is:
    1. Copy queried row into into new row, change primary key values(but don't commit your changes here).
    2. Now you have two rows in your VO(OLD as well as New)
    3. Make any changes if you want using User Interface.
    4. At the save button first compare OLD and NEW row, if any value is differing then commit the chnages(it will insert new row in corresponding database table), if no changes are there I mean to say OLD value and NEW rows are same then rollback(it will remove copied row from VO and no row will be inserted in database.)
    While comparing rows please note that Primary keys will not be same so don't compare Primary keys while comparing rows.
    I hope it will help you.
    Regards,
    Reetesh Sharma

  • How to create the deployment descriptor with the sun application server

    I have packaged my .war and ejb-jar files. I go to autodeploy and it says i need a deployment descriptor?

    this is actually an example .ear file that i am trying to run. When i create the client with the deploytool that comes with suns application server i get
    C:\appclient>appclient -client swe645-appClient.jar
    Caught an unexpected exception!
    javax.naming.NameNotFoundException: EditEmpBean not found
            at com.sun.enterprise.naming.TransientContext.doLookup(TransientContext.
    java:185)
            at com.sun.enterprise.naming.TransientContext.lookup(TransientContext.ja
    va:157)
            at com.sun.enterprise.naming.SerialContextProviderImpl.lookup(SerialCont
    extProviderImpl.java:101)
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
    java:39)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
    sorImpl.java:25)
            at java.lang.reflect.Method.invoke(Method.java:324)
            at com.sun.corba.ee.impl.presentation.rmi.ReflectiveTie._invoke(Reflecti
    veTie.java:123)
            at com.sun.corba.ee.impl.protocol.CorbaServerRequestDispatcherImpl.dispa
    tchToServant(CorbaServerRequestDispatcherImpl.java:648)
            at com.sun.corba.ee.impl.protocol.CorbaServerRequestDispatcherImpl.dispa
    tch(CorbaServerRequestDispatcherImpl.java:192)
            at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequest
    Request(CorbaMessageMediatorImpl.java:1709)
            at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequest
    (CorbaMessageMediatorImpl.java:1569)
            at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleInput(C
    orbaMessageMediatorImpl.java:951)
            at com.sun.corba.ee.impl.protocol.giopmsgheaders.RequestMessage_1_2.call
    back(RequestMessage_1_2.java:181)
            at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequest
    (CorbaMessageMediatorImpl.java:721)
            at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.dispatc
    h(SocketOrChannelConnectionImpl.java:473)
            at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.doWork(
    SocketOrChannelConnectionImpl.java:1262)
            at com.sun.corba.ee.impl.orbutil.threadpool.ThreadPoolImpl$WorkerThread.
    run(ThreadPoolImpl.java:409)

  • How to create the composite control with textinput,button and grid.

    I have created the application having two Textinput  and three button and a DataGrid.
    1. on click of first button next to "select a value" , a DataGrid will be open.
    and i am using all the functionality of DataGrid.
    2. now by using all of these control i have required to create single composite control.
    plz help me how to create this composite control.

    Right click the graph and select Create>Property Node. On the diagram, find the property node, right click it and first select Change All to Write. Right click again and if you select Properties, you will see a list of all the available properties for the graph. The properties you want are XScale.Minimum, XScale.Maximum, XScale.Increment, YScale.Minimum, YScaleMaximum, and YScale.Increment. You can grow the single property node to have as many properties that you want. Once you have all the properties created, create front panel controls and wire them to the property node. See the attached picture.
    Attachments:
    graph_properties.jpg ‏16 KB

  • How to load the nvidia module with options?

    Hello!
    I'm testing around to find the perfect configuration for my nvdia agp card.
    The gentoo wiki told me to active FastWrites and SBA. These are options for the nvidia module, but I don't in which config file the options must written. In Gentoo:
    File: /etc/module.d/nvidia
    The String "options NVdriver NVreg_EnableAGPSBA=1 NVreg_EnableAGPFW=1"
    But in arch there isn't a directory "module.d"
    Thanks for help
    Best regards,
    Flasher

    Use /etc/modprobe.conf.
    man modprobe.conf
    Last edited by lucke (2007-12-16 15:25:30)

  • How to create the Frame object with API in 6i?

    do i create an item using d2fitmcr_Create, and then set the type or style to frame? or is it a graphics item that i have to create using a different function? ive tried various combinations with no luck.
    ive looked at the frame object in the GUI, and cant figure out how to duplicate it using the API (the frame object is the thin line box with a label used to groups items visually on a form)
    thanks!
    [email protected]

    Frame is a type of graphic d2fgracr_Create() (d2fgra.h) then set the type as required using d2fgras_graphics_typ():
    Definition of Graphics types is in d2fdef.h
    ** Graphics Type (D2FP_GRAPHICS_TYP)
    ** [BPT]
    #define D2FC_GRTY_ARC              0                                 /* Arc */
    #define D2FC_GRTY_IMAGE            1                               /* Image */
    #define D2FC_GRTY_LINE             2                                /* Line */
    #define D2FC_GRTY_POLY             3                             /* Polygon */
    #define D2FC_GRTY_RECT             4                           /* Rectangle */
    #define D2FC_GRTY_RREC             5                   /* Rounded Rectangle */
    #define D2FC_GRTY_TEXT             6                                /* Text */
    #define D2FC_GRTY_GROUP            7                               /* Group */
    #define D2FC_GRTY_FRAME            8                               /* Frame */All the various properties for setting up the associated block etc (if required) can be set through macros in d2fgra.h

  • How to create the Contribution region with Native document

    HI,
    I have the below scenario to have the Contribution region in my custom page.
    1) I am displaying all Campaign records in primary page.
    2) When I click on each Campaign record, this will take me to secondary page to display the Editable Contribution region assigned with Native document.
    My requirement :
    3) I have 4 more Contribution Regions which will have to relate to the same above said Campaign in secondary page. To achieve this, I have only one contribution region with multiple elements within that region in my secondary page.
    Please let me know how I can add different native documents to 4 different Contribution Regions. Now if I add different document to the region, same document will be assigned to the each region having different elements. Also if I add multiple regions in secondary page, primary page will only point to first region available in that secondary page.
    Please let me know how I can add 4 different native documents to 4 different Contribution Regions available in secondary page. It would be great if any one give idea as soon as possible.
    Thanks in advance.
    Anyone did not come across this type of scenario?
    Thanks,
    Ramesh
    Edited by: Ramesh_Est on Aug 10, 2010 9:35 PM

    The secondary page is used to display a specified content item. One content item, specified on demand. Only one. Period.
    If you want to assign multiple content items to multiple regions, well you're talking about primary pages.

  • How to create a material master with referrence to exsisting material maste

    hi experts
    how to create the material master with reference to an existing material master ?
    please explain in steps
    regards
    jai

    Dear,
    It is very simple.
    Enter  MM01 t-code.
    Enter your existing material code in field of reference material code.
    If your material number range is external number range then enter number of material otherwise direct enter industry sector and material type.
    After enter basic detail system ask you plant/storage location detail and view detail.
    Select reference plant and storage location in left sight of diglog and enter plant and storage location in right sight of diglog screen for which you want to maintain material master.
    Then click on all view, If you want to change some detail change it.
    Due to reference material all detail is come from reference material.
    Then click on save.
    NOTE: - You can create new material with reference of old material but it is prerequest material type should be same of both material old and new.
    Regards,
    Mahesh Wagh

  • How to create a Sales order with ref to Contract using Function Module

    How to create a Sales order with ref to Contract using Function Module BAPI_SALESDOCU_CREATEFROMDATA ?

    We have a unique situation where we like change the sold-to customer of the sales order
    once order has been created. These orders have been created using either by function module
    BAPI_SALESDOCUMENT_COPY or using BDC (VA01, Copy with reference).
    These two processes work abosolutely fine except someone might have change the sold-to
    customer of the ship-to customer of the original sales order. If this the case then the new
    sales order will be created with the old sold-to and with not the new sold-to.
    We tried using BAPI_SALESDOCUMENT_CHANGE and commit afterwards. We checked
    the returned parameteres of the BAPIs and they are all successful but sold-to remains the
    same old one.
    Any help would be much more appreciated.

  • How to creat the Varient for 1099MISC With Holding Tax

    How to create the Variant for 1099MISC With Holding Tax ?

    HI,
    please follow the below steps to create variant at report.
    tcode se38
    report RFIDYYWT
    pass all the parameters
    press save icon
    give variant name
    retrive the variant in report
    tcode se38
    report name RFIDYYWT
    press : shift + F5
    or get varinat icon.
    I hope above will resolve your issue.
    Regards
    Madhu M

  • How to create the select option for the Plant in screen (Module pool)

    HI,
    I am developing one module pool program and I have below requirement,
    currently plant is acting like PARAMETER and the now it should be changed to select option.
    how to create the select option in the screen
    Thanks and regarding,
    Malla
    Moderator message - Cross post locked
    Edited by: Rob Burbank on Dec 16, 2009 1:41 PM

    Steps to get SELECT-OPTIONS in module pool programs.
    1.Start one dialog program with SAPMZ_001.
    Place the below code in the TOP include of the dialog program.
    TABLES marc.
    SELECTION-SCREEN BEGIN OF SCREEN 3200 AS SUBSCREEN.
    SELECT-OPTIONS: werks FOR marc-werks.
    SELECTION-SCREEN END OF SCREEN 3200. 
    2 .Create one screen 3000.
    Go to Layout of the screen and Define subscreen area on the screen and Name it as l_subscreen.
    Place the below code in the Flow logic of the screen.
    PROCESS BEFORE OUTPUT.
      CALL SUBSCREEN l_subscreen INCLUDING 'SAPMZ_001' '3200'.
    PROCESS AFTER INPUT.
      CALL SUBSCREEN l_subscreen.
    Activate all.
    Create Transaction code for the dialog program .
    Execute the transaction code. You will see the select-option for werks how we see on Selection-screen.

  • Step by step process for how to  creating the Admin wizards through NWDS

    Hi
    I have requirement of creating the wizards.
    i have seen the help of the sap site in the followin url.
    http://help.sap.com/saphelp_nw70/helpdata/en/42/930817a5051d6be10000000a1553f6/frameset.htm
    This link has not explained how to create the wizard project in NWDS.
    It has explained that
    Each wizard contains a wizard component, whose Java class extends AbstractWizard. This class is descended from AbstractPortalComponent, making the wizard a standard iView that can be displayed in the portal administration pages.
    AbstractWizard requires you to implement one method, setupWizard(), which is passed an IConfigurableWizard object. In this method, the wizard does the following:
    My basic question or like
    Which component need to be choose in nwds to create the wizards?
    In document it has given that , The class need to be extend the AbstractWizard class. so do I need to create the plain java class or AbstractPortalComponent.
    The steps which are given is really confusing.
    Can anybody have step by step creating of wizard develpment and deployment is available?
    Pelase help me to finish my task.
    I saw in the sap help document , the following .jar file is essential for developing the wizards ,How to download or get the following jar file
    1.     com.sap.portal.admin.wizardframework_api.jar
    Regards
    Vijay

    There are a couple of methods for using more than one iPod on a single computer. Have a look at the article linked below. Method one is to have two Mac or Windows user accounts which by definition would give you two completely separate libraries. Method two as Chris has already described above is to set your preferences so each iPod is updated with only certain playlists within one library. Have a look anyway and see what you think and go for whichever you feel suits your needs best: How To Use Multiple iPods with One Computer

Maybe you are looking for