Why again funtion modules in ABAP OO ?

if you look at the code inside
cl_gui_frontend_services->gui_upload they use gui_upload function.
there is no difference.
internally the class also uses GUI_UPLOAD ..........
there is conflict like data consistancy problem with function module ..
why again sap is using funtion modules in class method ...
Instead sap can develope method purely by coding in method  know ?
Can any body explain what are the advantages and disadvantages ?

Hi,
I think the FM can be used by only one way, with the same calls way( depending for parameters ) and always with the same behavior.   
But if you extends the class you can inherits the class's components and insert new attributes.
This is one of the benefits of the OO.
Each SAP's release, many FM are being modified to OO.
Regards,
Marcelo Ramos

Similar Messages

  • How to Update  crmd_customer_h TABLE Using CRMV_EVENT Through Funtion Module

    Hi
    How we can update customer_h table using the CRMV_EVENT Where i implemented logic below in the Funtion Module.
    data:     lt_doc_flow          TYPE crmt_doc_flow_wrkt,
              lw_cust_h_com        TYPE crmt_customer_h_com,
              lw_input_field_names TYPE crmt_input_field_names,
              lt_input_field_names TYPE crmt_input_field_names_tab,
              lt_objects_to_save TYPE crmt_object_guid_tab,
              lw_guid TYPE CRMT_OBJECT_GUID.
    DATA : lv_process_type TYPE crmt_process_type.
    data: wa_doc_flow type CRMT_DOC_FLOW_WRK.
    data: wa_customer_h type crmd_customer_h.
    *  Function module for retriving the Process type.
      CALL FUNCTION 'CRM_ORDERADM_H_READ_OW'
        EXPORTING
          iv_orderadm_h_guid     = iv_header_guid
        IMPORTING
          ev_process_type        = lv_process_type
        EXCEPTIONS
          admin_header_not_found = 1
          OTHERS                 = 2.
    if lv_process_type eq 'ZG01'.
    CALL FUNCTION 'CRM_DOC_FLOW_READ_OB'
    EXPORTING
       IV_HEADER_GUID                 = iv_header_guid
    IMPORTING
       ET_DOC_FLOW_WRK                = lt_doc_flow.
    read table lt_doc_flow with key objtype_a = 'BUS2000116' INTO wa_doc_flow. "gc_object_type-service.
                if sy-subrc eq 0.                    "set flag for service order
                lw_cust_h_com-ref_guid       =  wa_doc_flow-objkey_a.
                lw_cust_h_com-ZZTRAIL_FLAG   = 'X'.
                 lw_cust_h_com-mode           = 'A'.
                lw_cust_h_com-ref_handle     = '0000000001'.
                lw_guid = wa_doc_flow-objkey_a.
                INSERT lw_guid INTO TABLE lt_objects_to_save.
         endif.
                  lw_input_field_names-fieldname = 'REF_GUID'.
                lw_input_field_names-fieldname = 'ZZTRAIL_FLAG'.
              lw_input_field_names-changeable = ' '.
               INSERT lw_input_field_names INTO TABLE lt_input_field_names.
    Maintain Customer H
             CALL FUNCTION 'CRM_CUSTOMER_H_MAINTAIN_OW'
                  EXPORTING
                    is_customer_h_com    = lw_cust_h_com
                  CHANGING
                    ct_input_field_names = lt_input_field_names
                  EXCEPTIONS
                    header_change_error  = 1
                    header_create_error  = 2
                   error_occurred       = 3.
    ENDIF.
    *endif.
    *Clearing local variables
      clear: lv_process_type,
             lw_cust_h_com,
             lw_input_field_names.
    *Free internal tables
      free: lt_doc_flow,
            lt_input_field_names.

    Hi Faisal
    I think your not clear with what i am saying anyhow i will again explain you my requirement
    As per my requirement
    1)in the service order search report i need to add a field called "Has trail order with No Follow up" with values "Yes" & "Blank"
    For above Field i added  using the structure CRMST_QUERY_SRVO_BTIL and through configuration i am able to display the field in webui as per (Attachement Pic 1)
    2)When i  search with search criteria as  "Has trail order with No Follow up" with  "Yes"
    Then in result list i need to show the service order those having follow up as trail orders(sales order) only.if for  next document trail order  having any follow up then those service orders dont want to show in result list.
    For above requirement i implemented F.M using CRMV_EVENT & I configured for BUS2000115 And BEFORE_SAVE The Order
    The FM Will get trigger when i save the service order and for that service order if create any follow up and try to save the trail order then This FM Will trigger and in this i am doing validations.
    3)Add one AET Trail Flag field is added under CUSTOMER_H Table.
    4)in the FM I am validating for if the trail order having the preceding document as service order then i need to make flag as "X" For that service order in customer_h
    if suppose when i delete trail order from the service order then that flag must need to be "unset" from the CUSTOMER_H.
    Why bcoz we are doing above process is do show records in result list based on Flag values
    these flag checks are validating in the BADI Which we implemented for search logic.
    Please refer below Login for my requirement:-
    Proposal to have a custom “flag” field (background at table level,
         crmd_customer_h) linked to service order which gets flagged whenever at
         least one Trial order is created and saved from the Service Order.
    The flag value should be cleared when all the trial orders created and
    saved as follow up transactions are deleted from the system.
    Similarly for Trial Orders will use the same custom “flag” field
         which gets activated when at least one follow up is created and saved from Trial Order.
    The flag value should be cleared when all the follow up transactions from
    the Trial Order are deleted from the system.
    When the above search criteria “Has Trial order with no follow up”
         “is” “Yes” is applied then the logic derives all the service
         orders which satisfy additional search criteria applied in the search and
         for these Service orders checks if the custom flag field is checked to
         derive all Service orders which have Trial order. The custom flag values
         values are derived from crmd_customer_h table in CRM.
    4 )Further for all the Trial Orders determined in Step 3
    check if the Trial Order has a follow up by checking if the custom flag field
    is checked. The custom flag values are derived from crmd_customer_h table in
    CRM.
    5) If step 4 is not met populate the preceding Service
    Orders in the Result list

  • Function module in abap hr

    Hi friends
    i am new to abap.....i was given a funtion module to work on.. here i  am sending the req...can any one plz tell how to write code for the following:
    This is recivel of IBG bank account number. only 2 banks hsbc(Bank code = 7232)
    lenght 4 and ocbc(bank code = 7339)lenght 3.
    Importing parameters criteria:
    Field Name      Data element    datatype  type   description
    IM_Bankkey       bankl          char(15)    import  bank key
    IM_bankactno     bankn          char(18)    import   bank acc no
    Exporting Parameters:
    Field Name      Data element    datatype  type   description
    ex_ibgbankacct   n/a             char(16)  epxort return parameter
    e_errormsg       n/a             char(20)  export return parameter
    Now the logic:
    Extract bank code from im_bankkey
    extract 4 characters of im_bankkey into im_bankcd and process the following step
    if ocbc bank(bank code = 7339) and hsbc bank (Bank code = 7232)
    then truncate the 1st 2nd 3rd digits of im_bankacctno
    ex_ibgbankacct = truncated im_bankacctno.
    else
    ex_ibgbankacct = im_bankactno
    end if(end of chk for bank code)
    ex_ibgbankact = extract from 1st to 16 character of ex_ibgbankacct.
    plz help me to write the code????

    Hi Purnima,
    Try the code like below.
    FUNCTION ztest440.
    ""Local Interface:
    *"  IMPORTING
    *"     REFERENCE(IM_BANKKEY) TYPE  BANKL
    *"     REFERENCE(IM_BANKACTNO) TYPE  BANKN
    *"  EXPORTING
    *"     REFERENCE(EX_IBGBANKACCT) TYPE  CHAR16
    *"     REFERENCE(E_ERRORMSG) TYPE  CHAR20
      DATA : im_bankcd TYPE char4.
      im_bankcd = im_bankkey+0(4).
      IF im_bankcd EQ '7339' OR
         im_bankcd EQ '7232'.
        ex_ibgbankacct = im_bankactno+3(15).
      ELSE.
        ex_ibgbankacct = im_bankactno+0(16).
      ENDIF.
      ENDFUNCTION.
    Hope this will resolve your problem.
    Reward if it is helpfull..

  • 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 upload Excel file in BI using function module in abap program

    How to upload Excel file in BI using function module in abap program?

    Hi Anuj,
    To upload the file , you can try a standard program "RSEPSFTP" .
    while you execute the program , a selection screen appears in which the inputs should be give as
    RFC destination - The target server name
    FTP command- PUT
    local file - your file name
    local directory - path of your local file
    remote file - your target file name
    remote directory - where it has to be stored
    Hope this is useful for you
    Thanks & regards
    Anju

  • Variable size item formulla key funtion module,

    I am developing user interface for manual reservation (cutsom development). User wants to calculate quantity of material if he enters size1, size2 and size3. Also he wants that a formula key option to be provided so that he can mention conversion formula. Is there any standard function module for variable size formulla funtion module.
    I want to use same logic of variable size item formulla of bom in the above custom template.
    Please suggest.

    Hi
    The function module EVAL_FORMULA and FORMULA_EVALUATION may help you as they all export calculated values as output. Please go to SE37 to click the button 'Function module documentation' to see more information.
    Or go to SE80 to check the function group CALC to see more function.
    Best Regards
    Leon.

  • Using a function module in ABAP Query

    Hi All,
    I want to use a function module in ABAp query in the Record Processing Section.
    In the report program we click on Pattern button to inser the function module so that all the Importing and exporting parameter automatically appears.
    Similarly is there any particular method of inserting a function module in ABAp Query.
    Regards
    Manipal Parkala

    When you are doing the infoset for the query (SQ02) you can add coding by clicking the coding tab. You can chose in wich event you want your coding and there is Pattern Button for  you to easy use.
    If you don't want to put the code in the infoset just in the query then is not posible.
    Nevertheless, I higly descourage the use of coding in queryies. If you need to insert some coding make an ALV its easier, clearer and much easier to mantain.
    Hope it helps.

  • Is there any module in ABAP which requires almost zero percent of coding?

    Hi all,
    i just wanted to know if there is any module in ABAP which has zero percent of coding apart from functional modules like SD MM etc?
    Regards
    Sanjeev

    ABAP is a programming language.
    If you say reporting, bdc, sapscript, module pool, smartforms and ask if they need coding, the answer is yes. They require ABAP programming language for its coding.
    Everything in SAP done not require coding. For a person working in SAP-BW there is substantially low necessity for ABAP codes. However it requires ABAP knowledge when working with Exits in BW.
    SAP-XI mostly requires creating scenarios creating IDOCs, BDOCs and handling XML. This also has very little ABAP.
    Reward points if helpful.

  • Funtion Module in accounting document

    Hi All,
    Can someone tell what function module is called while creating the accounting document and what are its important import and export parameters?
    Regards
    Vijay

    Hi Vijay,
    The most important funtion module responsible to creating accounting documentt is RV_ACCOUNTING_DOCUMENT_CREATE . Below are its important import and export parameters:
    Import parameters
    CASH_SALE_ACCOUNT : contains the cash clearing account, if this is not to be posted to the customer 
    CPD_ADRESS: must be filled if you are posting to a one-time customer        
    DOCUMENT_OLD : contains the $000000x number of the billing document, as VBRK-VBELN already has the final value, XVBRP and so on still contain $000000x
    INVOICE_HEADER : Contains the billing header VBRK
    I_COMP : Control parameter, if only CO is to be posted            
    I_COMP_CHECK :   Control parameter if only CO is to be posted (check run)
    CHECK : Controlling for error messages (issue immediately or in log)            
    MODE : Change mode ( A = old, B = new)           
    MODE_TYPES  : Scope of change (1=rebate/2=VPRS)
    Differences can occur due to the update of cost price conditions or rebate conditions in billing documents that have already been posted. These two fields (MODE and MODE_TYPES) are required to enable the posting of those differences to CO-PA.
    RRREL: If this field is set, the billing document contains revenue recognition items             
    BOKRE  : If this field is set, the billing document is rebate-relevant
    These  two fields (RRREL and BOKRE) are required for the new cancellation function as of Release 4.6A. This is because the new cancellation procedure cannot be implemented for revenue recognition or rebate relevant billing documents.           
    Export parameters
    O_VBRK_RFBSK: This is set if an error has occured in account determination ( characteristic B)
    O_KONV_CHANGED: This is set if XKOMV is changed in account determination
    Regards
    Roop

  • How to use this function module on abap hr GET_PDSNR_RANGE

    how to use this function module on abap hr GET_PDSNR_RANGE
    thankx.

    PASS INETRNAL TABLE WITH SOME DATA TO TABELLE FOR GENERATING PDSNR SEQUENCE

  • Standard funtion module to fetch IDOC in xml format

    Hi Experts
    I am not from ABAP background, am working in SAP PI. I have a queay regarding standard function modules in ABAP.
    I am wrote a java code to fetch IDOC by making a call to the ABAP standard functions. (passing an idoc number and fetching the idoc)
    The IDOC that i am receiving is in Flat format, but I want to fetch the IDOC in XML format.
    Is there any Standard fucntion module to fetch the IDOC in xml format?
    regards,
    Osman Abdul Aziz Jabri

    hai ,
                      in SE37 tcode
                      Check with IDOCTOXML u get FM 's
                                                 use sutable ur requirement.
    Moderator message: please do not use SMS speak in these forums.
    Edited by: Thomas Zloch on Jan 5, 2011 6:03 PM

  • How to create function module in abap for VirtualProvider in bi

    how to create function module in abap for VirtualProvider in bi ???????????????
    can any one help me with simple example ?????????????????
    Moderator message : Duplicate post locked. Read forum rules before posting.
    Edited by: Vinod Kumar on Jun 15, 2011 4:40 PM

    Hi ,
    Thanks for replies about my question??.
    If i am using the exit in my char relation ship how can i debugg that exit???
    if i am using BPS0 how to do it???If i am using BPS_WB how to do it??
    Case1.Variable (type Exit) I known how to do debugg this one in BPS0 but i'm not sure in BPS_WB??
    Case2:Char Relation Ship(Type Exit) how to do in BPS0 and BPS_WB??.
    Thanks.

  • Inbound funtion module to process PORDCH02 IDOC

    Hi,
    I am getting a inbound purchase order PORDCH02 IDOC and i need to change the purchse order based on the idoc value , pls let me know the standard inbound purchase order funtion module attached to inbound process code.
    Thanks
    Ravi

    Hi,
    The message type and basic idoc type for the processing of purchase orders:
    PORDCH                 PORDCH01                -- For change
    PORDCR1               PORDCR101              -- For Create
    Regards,
    Ginu Litta Raj

  • Funtion Module to convet Date's month from numeric to words ???

    Hi guys,
    I have a requirement such that:-
    For Date:- 06.07.2007 (DD.MM.YYYY)
    i want it to display as 06-July-2007
    Is there any funtion module to do that.
    Regards
    Rahul

    Hi,
    Please use code as under :
    data : date(10),
            text1(26),
            num1(10),
            test_day(15),
            o_date(20),
            idate type sy-datum.
    data : Day(2), month(2), Year(4).
    data : ODay(2), Omonth(2), OYear(4).
    data : Ltext Type T247-LTX.
    date = '06.07.2007'.
    day = date+0(2).
    month = date+3(2).
    year = date+6(4).
    concatenate year month day into idate.
    CALL FUNCTION 'HR_IN_GET_DATE_COMPONENTS'
      EXPORTING
        idate                               = idate
    IMPORTING
       DAY                                 = oday
       MONTH                               = omonth
       YEAR                                = oyear
       LTEXT                               = ltext.
    concatenate oday '-' ltext '-' oyear into o_date.
    write : O_date.
    Reward points, if helpful,
    Sandeep Kaushik

  • Advantages of 'HR_INFOTYPE_OPERATION' Function Module In ABAP-HR

    HI Experts,
    What are the Advantages of 'HR_INFOTYPE_OPERATION' Function Module In ABAP-HR rather than BDC Both methods?
    Thanks in Advance.
    Naveen

    Hi
    The function module  'HR_INFOTYPE_OPERATION' can be used to update,insert,modify,delete and change in the same function module.
    Codings are also very simple there by calling this FM in case of conversion program.
    Performance is also good when compared to session method.
    Speedy performance in conversion programming.
    The sample codings is given.
    CALL FUNCTION 'HR_INFOTYPE_OPERATION'    
         EXPORTING                           
              INFTY          = '0009'        
              NUMBER         = EMPLOYEENUMBER
              SUBTYPE        = SUBTYPE       
              OBJECTID       = OBJECTID      
              LOCKINDICATOR  = LOCKINDICATOR 
              VALIDITYEND    = VALIDITYEND   
              VALIDITYBEGIN  = VALIDITYBEGIN 
              RECORDNUMBER   = RECORDNUMBER  
              RECORD         = P0009         
              <b>OPERATION      = CHANGE </b>       
              NOCOMMIT       = NOCOMMIT     
    There by changing the operation field into "INSS","MOD","DEL" alone we can do conversion program easily.
    Then if no commit ='X' then it does't get updated in database so that it will be easy for us to check whther the fields get updated properly in database.
    If no commit = ' ' then the possible fields get updated in database.
    Thanks,
    Sakthi.
    *Rewards if usefull*

Maybe you are looking for