Create Function module on d fly

Hi,
  is there any possibility to create a Function module on the fly? if so pls let me know about the APIs.
Best regards, Girish

Hi
Yes, sometime you have to create our own custom Fun modules
see the doc it is useful to create the fun modules
Function Modules;
Check this matter.
Function Modules are Global ABAP programs created by SAP for reusable purpose.they have IMPORT,EXPORT and TABLE parameters, and EXCEPTIONS to through when error occurs.
You can create them from TCode SE37.
Go through the following doc:
Function modules are cross-program, reusable procedures that are organized into function groups, and whose functions are implemented between the statements FUNCTION and ENDFUNCTION. Function modules and their interfaces are created in the Function Builder.
Function Module Interfaces
The parameter interface of a function module is defined in the Function Builder. It includes the definition of interface parameters and the specification of exceptions that can be triggered by a function module. The Function Builder automatically generates comment lines below the FUNCTION statement in the source code of the function module, which represent the interface of the function module with the following syntax:
Syntax
... [IMPORTING parameters]
[EXPORTING parameters]
[CHANGING parameters]
[TABLES table_parameters]
[{RAISING|EXCEPTIONS} exc1 exc2 ...]
The syntax and semantics of IMPORTING, EXPORTING, CHANGING, RAISING, and EXCEPTIONS mainly correspond to the definition of method interfaces with [CLASS-]METHODS. The additional option of defining table parameters using TABLES is obsolete.
Interface parameters
The interface parameters are defined on the relevant tab pages in the Function Builder.
IMPORTING parameters are input parameters. When the function module is called, a suitable actual parameter must be specified for every non-optional input parameter. The content of the actual parameter is passed to the input parameter when the call is made. The content of an input parameter for which 'pass by reference' is defined cannot be changed in the function module.
EXPORTING parameters are output parameters. When the function module is called, a suitable actual parameter can be specified for every output parameter. The content of an output parameter that is defined for 'pass by value' is transferred to the actual parameter if the function module is completed without errors. An output parameter that is defined for pass by reference is not initialized when the function module is called.
CHANGING parameters are input and output parameters. When the function module is called, a suitable actual parameter must be specified for every non-optional input or output parameter. When the function module is called, the content of the actual parameter is passed to the input/output parameter, and when the function module is completed, the content of the input/output parameter is passed to the actual parameter.
TABLES parameters are table parameters. Table parameters are obsolete CHANGING parameters that are typed as standard tables with a header line. If an internal table without a header line or a table body is passed as an actual parameter to a formal parameter of this type, an empty local header line is generated in the function module. If an internal table with a header line is used as an actual parameter, both the table body and the header line are passed to the function module. Pass by value is not possible in formal parameters defined using TABLES. Formal parameters defined with TABLES can be replaced by formal parameters defined with CHANGING. A local work area can be created for the internal table in the function module by using the addition LIKE LINE OF itab of the DATA statement.
Exceptions
The exception of a function module are defined on the Exceptions tab page in the Function Builder. Here you can select exception classes to define whether class-based exceptions are declared or non-class-based exception are defined. Class-based exceptions are represented in the above syntax by RAISING, and non-class-based exceptions are represented by EXCEPTIONS.
The addition RAISING is used to declare class-based exceptions that can be propagated from the function module to the caller. Exceptions in the categories CX_STATIC_CHECK and CX_DYNAMIC_CHECK must be explicitly declared, otherwise a propagation can lead to an interface violation. A violation of the interface leads to the treatable exception CX_SY_NO_HANDLER. Exceptions of the category CX_NO_CHECK are implicitly always declared. The declaration of exceptions of the category CX_STATIC_CHECK is statically checked in the syntax check. For exceptions of the category CX_DYNAMIC_CHECK, the check is not performed until runtime. In a function module in which class-based exceptions are declared with the RAISING addition, the statement CATCH SYSTEM-EXCEPTIONS cannot be used. Instead, the relevant treatable exceptions should be handled in a TRY control structure.
The addition EXCEPTIONS is used to define a list of non-class-based exceptions that can be triggered in the function module using the statements RAISE or MESSAGE RAISING. Exceptions defined in this way - as with formal parameters - are bound to the function module and cannot be propagated. If an exception of this type is triggered in a function module, and no return value has been assigned to it with the homonymous addition EXCEPTIONS of the CALL FUNCTION statement when the call was made, this leads to a runtime error.
Note
For new developments after release 6.10, SAP recommends that you work with class-based exceptions that are independent of the function module.
RFC is a technology which is used to access a functions (Modules) from
the remote systems.
If a function module is set as remote enabled which can be access from
the remote system via RFC.Eg: U can access the Remote enabled function modules in ur VB,Webdynpro,Java,Visual composer program.
A function module can be set as remote enabled by SE37->Go to ur FM->click the option Button "remote enabled".
But Normal function modules can not accessd from the remote system.
Good Example for RFC enabled function module is : BAPI(Business Application Programming Interface)
Note: All BAPIs are Remote enabled but not all remote enabled function modules are BAPI.
CALLING A FUNCTION MODULE:
1)In U ABAP Editor --> Click "Patter" ---> Selection Option Button "Call Function"
--> Write the Corresponding FM name --> Hit Enter
2)The appropriate import ,export Parameters will be displayed in ur editor
3)Pass the Values Here.
Also check these links.
http://www.geocities.com/victorav15/sapr3/abapfun.html
Check this link:
http://help.sap.com/saphelp_erp2004/helpdata/en/9f/db988735c111d1829f0000e829fbfe/content.htm
http://help.sap.com/saphelp_nw2004s/helpdata/en/ef/d94b78ebf811d295b100a0c94260a5/frameset.htm
http://help.sap.com/saphelp_nw2004s/helpdata/en/43/41341147041806e10000000a1553f6/frameset.htm
Check this link:
http://help.sap.com/saphelp_erp2004/helpdata/en/9f/db988735c111d1829f0000e829fbfe/content.htm
http://help.sap.com/saphelp_nw2004s/helpdata/en/ef/d94b78ebf811d295b100a0c94260a5/frameset.htm
http://help.sap.com/saphelp_nw2004s/helpdata/en/43/41341147041806e10000000a1553f6/frameset.htm
See the following links:
http://help.sap.com/saphelp_erp2005vp/helpdata/en/9f/db970e35c111d1829f0000e829fbfe/frameset.htm
http://help.sap.com/saphelp_erp2005vp/helpdata/en/9f/db970e35c111d1829f0000e829fbfe/frameset.htm
http://help.sap.com/saphelp_erp2005vp/helpdata/en/9f/db970e35c111d1829f0000e829fbfe/frameset.htm
http://help.sap.com/saphelp_erp2005vp/helpdata/en/9f/db970e35c111d1829f0000e829fbfe/frameset.htm
http://help.sap.com/saphelp_erp2005vp/helpdata/en/9f/db970e35c111d1829f0000e829fbfe/frameset.htm
http://help.sap.com/saphelp_nw04/helpdata/en/26/64f623fa8911d386e70000e82011b8/content.htm
<b>Reward points for useful Answers</b>
Regards
Anji

Similar Messages

  • Doubt in  export, import and table para when creating Function Module

    Dear fellow ABAPers,
    I have a doubt in defining export, import and table parameter while creating a function module.
    I am calling a function module inside a user exit. Now in the user exit the SAP fills an internal table called i_lfa1 with all the data user has eneterd.
    Now I want to pass this whole internal table to function module and the perform some checks on the values of internal table.
    After that function module fills an error structure with values depending on some check.
    1)
    How do I pass this internal table to function module ? 
    When I am creating function module in se37 where do I define this iternal table type ? Is it in Import or Table parameter during function module creation?
    2)
    Where do I define error structure type (which is returned by function module to main program)? Is it in Export or table parameter during function module creation?
    Please clear my doubt..
    Relevant points will be awarded.
    Regards,
    Tushar.

    Hi Tushar,
    1. How do I pass this internal table to function module ?
       I assume u are creating your own Y/Z FM.
       Pass it thru TABLES parameter.
    2. When I am creating function module in se37 where do I define this iternal table type
       Define this in TABLES interface.
       What Type ?
       THE SAME TYPE WHICH HAS BEEN DEFINED
        WHILE PASSING IN THE USER-EXIT FUNCTION MODULE.
       IF U SEE THE FM OF THE USER-EXIT,
       U WILL COME TO KNOW.
    3.
    Where do I define error structure type (which is returned by function module to main program)? Is it in Export or table parameter during function module creation?
    Define it in TABLES interace. (not in export, import)
      (Since what u are going to return is an internal table)
      U can take for eg. BDCMSGCOLL.
      OR u can create your own Y/Z structure
    for the same purpose.
      (or u can use the structure type T100)
    I hope it helps.
    Regards,
    Amit M.

  • How to create function module for getting customer name

    Hi Experts,
                   How to create function module?  when in import parameter kunnr values to be passed it must give name1 details according to the customer number...
    how to write the logic in source code....
    Regards,
    Thiru. R

    1. First of all create function group.
    2. Create function module using this function group.
    3. If only one kunnr is needed at a time, create import parameter for it. But if many kunnr to be entered at a time,use table.
    4. Fetch name1 for each kunnr from KNA1 table.
    "->> if many kunnr
    if not t_kunnr[] is initial.
    select kunnr as kunnr name1 as name1
    into table t_kunnr_name1
    from kna1
    for all entried in table t_kunnr
    where kunnr = t_kunnr-kunnr.
    endif.       
    sort t_kunnr_name1 by kunnr name1.
    delete adjacent duplicates from t_kunnr_name1 comparing kunnr name1.
    table t_kunnr_name1 will contain kunnr and its name1.
    I hope logic is clear for you now.
    Regards,
    Aparna

  • How to create function module in real time

    hi experts,
    can somebody explain a real time requiremwnt , to create a function module.
    its very urgent.
    i want elaborately.
    regards,
    subhasis.

    hi,
    In real time
    1. as per my knowledge we create function modules to Inbound IDOC /outbound processing..
    2.Interface between a program..
      Example we need to take some data from a report say materials and plant and process some bapi and return logfiles to the report we can use FM here too.
    To create a function module
    First you need to create a function group (function group holds a number of function modules relevant)
    SE37>goto>function groups-->create group ..click this create group..
    Now in the pop up enter the function groupname Eg: ZW_FG1 plus short text and saveit
    Now again goto SE37--> enter new Function module name eg:ZW_FM1
    and press F5.
    Now again a popup you need to enter
    function group name : ZW_FG1
    and short test and save it..
    Now the Function module is created under the Function group ZW_FG1.
    write your export import table parameters and you source code.
    rewards if useful
    regards,
    nazeer
    Message was edited by:
            nazeer shaik

  • 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.

  • How to create function module step by step

    hi experts,
    i am new to ABAP.
    can anybody tell me the step by step process on how to create a function module for adding two numbers without using editor screen.
    ex: 2+3=5.

    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.
    Function Groups and Function Modules:
    Firstly, we create a new function group DEMO_SPFLI to hold the function module. Then, we can create the new function module.
    Parameter Interface:
    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.
    Exceptions:
    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.
    Source Code:
    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;
    Data in Function Modules
    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.
    Calling Subroutines
    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>.
    Raising Exceptions
    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,
    Chandru

  • How to delete Thr created functional module dynamically

    Hi All,
    How to delete Thr created functional module dynamically
    Regards,
    Lisa
    Message was edited by:
            Lisa Roy

    Hi,
    You can use the function module RS_FUNCTION_DELETE to do that.
    Make sure you are not deleting any standard FM's.
    Example
          call function 'RS_FUNCTION_DELETE'
               exporting
                    funcname          = 'ZFM_NAME" " Function modue name
                    suppress_popups   = 'X' " TO suppress any pop-ups that come when you delete
               exceptions
                    error_message     = 1
                    cancelled         = 2
                    function_released = 3
                    others            = 4.
    Regards,
    Sesh

  • Creating function modules with step by step

    Hi,
       plz provide me the material for creating function modules with step by step.

    Hi Nagaraju,
    Step 1.
    GO to transaction SE80.In the drop box list select function group enter your Z Function group name.Press enter it will ask for creating the function group.Create your function group.
    OR
    In SE37 transaction,in the menu bar Goto - > Function Group - > Create Group.Your Function Group will be created.
    Step 2.
    Go to transaction SE37.Enter your Z Function module name,your recently created function group name and the description.Press Enter.Now your FM is created.
    Step 3.
    Enter Export,Import parameters.In the source code tab write the code what you want to write.If any exception write in the exception tab.
    Method 2)
    First u have to create Function Group.
    1.se37->Goto->Function Group--->Create.
    2.Create FM.
    3.maintain import /export parameters and tables , exceptions.
    4.based on the ur requirement u have to bulid ur logic in Source Code by using there Import parameters and u can pass the results by using Export or table.
    5.u can raise error by using exception.
    Reward if useful.
    Thanks
    Aneesh.

  • Creating function modules

    Hi Friends,
    Is it true to say that creating function modules in BPS is easier than the normal way of creating it in BW / R3 where you have to link it to the function group and all the usual steps?
    Hope you can clarify. Thanks.
    Michael

    Hi Michael,
    pressing F1 when you define an EXIT Funtion on the field "Function Module" BPS will show you a Performance Assistant window that explains the guide line to define Importing and Exporting parameters to be defined in you FM. You will see that these are different from the ones requested when implementing a BPS Variable replaced by Used Exit.
    Hope it helps
    GFV

  • What is the best way, while creating Function Module based extractor

    Hi Friends,
    I am Sreekanth.
    I have created a Functio Module based Extractor,
    To fetch data from COPA tables.
    In this extracton 3 tables are getting involved.
    1) CE3OP01 2) CE4OP01 and 3) CE1OP01.
    Logic required is as follow:
    1) get data from CE3OP01 and for all entries of this data set,
    get data from CE4OP01 and CE1OP01 and finally send the data set to BW after few manupulations.
    I have implemented the whole logic and its working fine in DEVELOPMENT box where data volume is less.
    But the same code is timing out in Quality Box, due to huge volues of data.
    Below I am copying the code that i am using . Any body can suggest me how to proceed further so that my code works with huge volumes of data.
    Now I am getting the time out error while selection data from CE3IOP01 table itself.
    FUNCTION /ds1/c_bw_zds_copa_recon.
    ""Local interface:
    *"  IMPORTING
    *"     VALUE(I_REQUNR) TYPE  SRSC_S_IF_SIMPLE-REQUNR
    *"     VALUE(I_DSOURCE) TYPE  SRSC_S_IF_SIMPLE-DSOURCE OPTIONAL
    *"     VALUE(I_MAXSIZE) TYPE  SRSC_S_IF_SIMPLE-MAXSIZE OPTIONAL
    *"     VALUE(I_INITFLAG) TYPE  SRSC_S_IF_SIMPLE-INITFLAG OPTIONAL
    *"     VALUE(I_READ_ONLY) TYPE  SRSC_S_IF_SIMPLE-READONLY OPTIONAL
    *"  TABLES
    *"      I_T_SELECT TYPE  SRSC_S_IF_SIMPLE-T_SELECT OPTIONAL
    *"      I_T_FIELDS TYPE  SRSC_S_IF_SIMPLE-T_FIELDS OPTIONAL
    *"      E_T_DATA STRUCTURE  /DS1/FI_COPA_RECN OPTIONAL
    *"  EXCEPTIONS
    *"      NO_MORE_DATA
    *"      ERROR_PASSED_TO_MESS_HANDLER
                            PROGRAM INFORMATION                          *
    RIEF ID.......: N/A                                                  *
    PROGRAM.......: /DS1/C_BW_ZDS_COPA_RECON               
    PROGRAM FUNCTION: This Function Module Extracts Cost Center, Company *
    Code, and all Amount fields form CE3OP01 table and  sectaktbo       "
    *     Current profitability segment (CO-PA)                          *
         paobjnr     "     Profitability Segment Number (CO-PA)       *
         pasubnr     "     Profitability segment changes (CO-PA)      *
         bukrs            "     Company Code
         kndnr       "     Customer from CE4Op01 table.               *
    Segrigate one record from CE3Op01 into 93 based on Value fields.    *
    PROGRAM TYPE..Function Module                                        *
    DEV. CLASS..../DS1/MI_01                                             *
    LOGICAL DB.... N/A                                                   *
                   Conventions used in the Program                       *
    *     global variables      --> g_*                                    *
    *     local variables       --> l_*                                    *
    *     constants             --> c_*                                    *
    *     internal tables       --> t_*                                    *
    *     structures            --> x_*                                    *
    *     parameters            --> p_*                                    *
    *     select-options        --> s_*                                    *
    *     ranges                --> r_*                                    *
    *     workarea          --> w_*                                    *
    *     field symbol            --> fs_*                                   *
    Declaration for Interface: Selection criteria
      STATICS: s_s_if TYPE srsc_s_if_simple,
    Maximum number of lines for DB table
      ls_s_if TYPE srsc_s_if_simple, "Static Structure
    counter
              ls_counter_datapakid LIKE sy-tabix,"Static Counter
    cursor
              ls_cursor TYPE cursor,"Static Cursor.
              ls_cursor1 TYPE cursor."Static Cursor.
    *CONSTANTS
      CONSTANTS:  lc_datasource TYPE char14 VALUE 'ZDS_COPA_RECON',
                                                 " Data Source Name
                  lc_msgtype TYPE char1 VALUE 'E',  "message type
                  lc_msgcls  TYPE char2 VALUE 'R3', "message class
                  lc_msgnum  TYPE char3 VALUE '009',"Message Number.
                  lc_001 TYPE char3 VALUE '001',
                  lc_b0 TYPE char2 VALUE 'B0',
                  lc_10 TYPE char2 VALUE '10',
                  lc_01 TYPE char2 VALUE '01',
                  lc_02 TYPE char2 VALUE '02',
                  lc_1 TYPE sy-tabix VALUE 1.
    *Data Declaration.
      DATA: lt_ce3op01  TYPE STANDARD TABLE OF x_ce3op01,
            " Internal table for ce3op01
            lt_ce3op02  TYPE STANDARD TABLE OF x_ce3op01,
            lt_ce4op01  TYPE STANDARD TABLE OF x_ce4op01,
            " Internal table for ce4op01
            lw_ce3op01  TYPE x_ce3op01,
            " Work area for ce3op01
            lw_ce3op02  TYPE x_ce3op01,                         "MOD-002
            lw_ce4op01  TYPE x_ce4op01,
            " Work area for ce4op01
            lw_e_t_data TYPE /ds1/fi_copa_recn,
      " Work area for /ds1/fi_copa_recn.
    *CE1op01
      lt_ce1op01 TYPE STANDARD TABLE OF x_ce1op01,"Internaltable
      lw_ce1op01 TYPE x_ce1op01,"Work area for CE1op01.
    **CE1op01
      lt_fldlist TYPE STANDARD TABLE OF lx_fldlist, "fields list
      lw_fldlist TYPE lx_fldlist,"  FIELDS list work area
      lt_flnmval TYPE STANDARD TABLE OF lx_flnmval,"table for splitting
      lw_flnmval TYPE lx_flnmval,"work area for spilitting
      l_index TYPE i VALUE 1, "to keep track of index.
      l_len   TYPE i,
      l_s_no_recs   TYPE sy-tabix VALUE 99,
      l_s_loop_from        TYPE sy-tabix,     "from "MOD-002
      l_s_loop_to          TYPE sy-tabix,                       "to"MOD-002
      l_norecs             TYPE sy-tabix,                       "MOD-002
      l_count              TYPE sy-tabix.                       "MOD-002
    *Field Symbols.
      FIELD-SYMBOLS:
         <fs_flnmval> TYPE lx_flnmval."Field symbol for fild values
    Selection Ranges
      RANGES:  lr_bukrs      FOR ce4op01-bukrs, " Range for company code
      lr_versi      FOR ce3op01-versi," Range for version
      lr_paledger   FOR ce3op01-paledger,"Range for paledger
      lr_vrgar      FOR ce3op01-vrgar,"Range for vrgar
      lr_gjahr      FOR ce3op01-gjahr,"Range for Fiscal year
      lr_perbl      FOR ce3op01-perbl."Range for perbl
    Initialization mode (first call by SAPI) or data transfer mode
      IF i_initflag = sbiwa_c_flag_on.
    Initialization: check input parameters
                    buffer input parameters
                    prepare data selection
    Check DataSource validity
        IF ls_counter_datapakid = 0.
          CASE i_dsource.
            WHEN lc_datasource.
            WHEN OTHERS.
              IF 1 = 2. MESSAGE e009(r3). ENDIF.                "#EC *
    this is a typical log call. Please write every error message like this
              log_write lc_msgtype "'E'                  "message type
                        lc_msgcls  "'R3'                 "message class
                        lc_msgnum  "'009'                "message number
                        i_dsource   "message variable 1
                        ' '.                 "message variable 2
              RAISE error_passed_to_mess_handler.
          ENDCASE.
          APPEND LINES OF i_t_select TO s_s_if-t_select.
          APPEND LINES OF i_t_fields TO s_s_if-t_fields.
    Fill parameter buffer for data extraction calls
          ls_s_if-requnr    = i_requnr.
          ls_s_if-dsource   = i_dsource.
          ls_s_if-maxsize   = i_maxsize.
          ls_s_if-initflag  = i_initflag.
      Company Code
          LOOP AT s_s_if-t_select  INTO  i_t_select WHERE fieldnm = c_bukrs.
            MOVE: i_t_select-sign   TO lr_bukrs-sign,
                  i_t_select-option TO lr_bukrs-option,
                  i_t_select-low    TO lr_bukrs-low,
                  i_t_select-high   TO lr_bukrs-high.
            APPEND lr_bukrs.
          ENDLOOP.
    *Version (0)
    *SRSC_S_IF_SIMPLE-T_SELECT
          LOOP AT s_s_if-t_select INTO i_t_select WHERE fieldnm = c_versi.
       LOOP AT i_t_select  INTO  s_s_if-t_select WHERE fieldnm = c_versi.
            MOVE: i_t_select-sign   TO lr_versi-sign,
                  i_t_select-option TO lr_versi-option,
                  i_t_select-low    TO lr_versi-low,
                  i_t_select-high   TO lr_versi-high.
            APPEND lr_versi.
          ENDLOOP.
    *Currency Type (company code only)
         LOOP AT s_s_if-t_select INTO i_t_select WHERE fieldnm = c_paledger.
            MOVE: i_t_select-sign   TO lr_paledger-sign,
                  i_t_select-option TO lr_paledger-option.
            IF i_t_select-low = lc_b0.
              MOVE lc_01 TO lr_paledger-low.
            ELSEIF  i_t_select-low = lc_10.
              MOVE lc_02 TO lr_paledger-low.
            ENDIF.
            APPEND lr_paledger.
          ENDLOOP.
    *Record Type
          LOOP AT s_s_if-t_select INTO i_t_select WHERE fieldnm = c_vrgar.
            MOVE: i_t_select-sign   TO lr_vrgar-sign,
                  i_t_select-option TO lr_vrgar-option,
                  i_t_select-low    TO lr_vrgar-low,
                  i_t_select-high   TO lr_vrgar-high.
            APPEND lr_vrgar.
          ENDLOOP.
    *Fiscal Year
          LOOP AT s_s_if-t_select INTO i_t_select WHERE fieldnm = c_gjahr.
            MOVE: i_t_select-sign   TO lr_gjahr-sign,
                  i_t_select-option TO lr_gjahr-option,
                  i_t_select-low    TO lr_gjahr-low,
                  i_t_select-high   TO lr_gjahr-high.
            APPEND lr_gjahr.
          ENDLOOP.
    *Period Block/Year
          LOOP AT s_s_if-t_select INTO i_t_select WHERE fieldnm = c_perbl.
            MOVE: i_t_select-sign   TO lr_perbl-sign,
                  i_t_select-option TO lr_perbl-option,
                  i_t_select-low    TO lr_perbl-low,
                  i_t_select-high   TO lr_perbl-high.
            APPEND lr_perbl.
          ENDLOOP.
    *Value Field Name.
          LOOP AT s_s_if-t_select INTO i_t_select WHERE fieldnm = c_fldnm.
            MOVE:
            i_t_select-sign   TO gr_zfldnm-sign,
            i_t_select-option TO gr_zfldnm-option,
            i_t_select-low   TO gr_zfldnm-low,
            i_t_select-high   TO gr_zfldnm-high.
            APPEND gr_zfldnm.
          ENDLOOP.
    First data package -> OPEN CURSOR
          IF ls_counter_datapakid = 0.
    *Create 93 Field names in an internal table.
         MOVE 'VV010' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
         MOVE 'VV011' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
         MOVE 'VV012' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
         MOVE 'VV013' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
         MOVE 'VV014' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
         MOVE 'VV015' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
         MOVE 'VV016' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
         MOVE 'VV020' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
         MOVE 'VV021' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
         MOVE 'VV030' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
         MOVE 'VV031' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
         MOVE 'VV032' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
         MOVE 'VV033' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
         MOVE 'VV034' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
         MOVE 'VV035' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
         MOVE 'VV200' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
         MOVE 'VV201' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
         MOVE 'VV202' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
         MOVE 'VV203' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
         MOVE 'VV036' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
         MOVE 'VV037' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
         MOVE 'VV038' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
         MOVE 'VV039' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
         MOVE 'VV040' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
         MOVE 'VV041' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
         MOVE 'VV042' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
         MOVE 'VV043' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
         MOVE 'VV204' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
         MOVE 'VV205' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
         MOVE 'VV211' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
         MOVE 'VV212' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
         MOVE 'VV213' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
         MOVE 'VV222' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
         MOVE 'VV223' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
         MOVE 'VV230' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
         MOVE 'VV232' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
         MOVE 'VV233' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
         MOVE 'VV500' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
         MOVE 'VV501' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
         MOVE 'VV502' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
         MOVE 'VV503' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
         MOVE 'VV504' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
         MOVE 'VV505' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
         MOVE 'VV506' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
         MOVE 'VV507' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
         MOVE 'VV508' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
         MOVE 'VV509' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
         MOVE 'VV510' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
         MOVE 'VV511' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
         MOVE 'VV512' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
         MOVE 'VV513' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
         MOVE 'VV514' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
         MOVE 'VV515' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
         MOVE 'VV516' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
         MOVE 'VV517' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
         MOVE 'VV518' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
         MOVE 'VV519' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
         MOVE 'VV520' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
         MOVE 'VV236' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
         MOVE 'VV206' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
         MOVE 'VV051' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
         MOVE 'VV052' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
         MOVE 'VV053' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
         MOVE 'VV054' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
         MOVE 'VV055' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
         MOVE 'VV056' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
         MOVE 'VV057' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
         MOVE 'VV058' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
         MOVE 'VV059' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
         MOVE 'VV060' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
         MOVE 'VV241' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
         MOVE 'VV242' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
         MOVE 'VV243' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
         MOVE 'VV244' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
         MOVE 'VV245' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
         MOVE 'VV246' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
         MOVE 'VV247' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
         MOVE 'VV248' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
         MOVE 'VV249' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
         MOVE 'VV250' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
         MOVE 'VV521' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
         MOVE 'VV522' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
         MOVE 'VV523' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
         MOVE 'VV524' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
         MOVE 'VV525' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
         MOVE 'VV526' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
         MOVE 'VV527' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
         MOVE 'VV528' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
         MOVE 'VV529' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
         MOVE 'VV530' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
         MOVE 'VV227' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
         MOVE 'VV226' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
         MOVE 'VV224' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
            OPEN CURSOR WITH HOLD ls_cursor FOR
                 SELECT
                 paobjnr      " Profitability Segment Number (CO-PA)
                 paledger     " Currency type for an operating concern
                 vrgar        " Record Type
                 versi        " Plan version (CO-PA)
                 gjahr            " Fiscal Year
                 perbl            " Fiscal year/period block
                 pasubnr
                 vv010001     " List Price
                 vv011001     " Formula Price
                 vv012001     " Customer Price
                 vv013001     " Manual Price
                 vv014001     " Retail Pump Price
                 vv015001     " Markup
                 vv016001     " Net Proceeds Other
                 vv020001     " Excise Duty Offset
                 vv021001     " Duties & Government
                 vv030001     " Sales Discounts
                 vv031001     " Sales Surcharges
                 vv032001     " Sales Rebates
                 vv033001     " Agents Comm Paid
                 vv034001     " RBA CR Royalties
                 vv035001     " Other Revenues
                 vv200001     " Transfer PriceSupply
                 vv201001     " Prim Tran Tariff Sup
                 vv202001     " S&Handling TariffDis
                 vv203001     " Sec Trans Tariff Dis
                 vv036001     " Proceeds from Servic
                 vv037001     " Exchanges
                 vv038001     " Throughput fees
                 vv039001     " Output Tax Offset
                 vv040001     " CR comm & Oth Oil Pr
                 vv041001     " Supplier fees
                 vv042001     " RBA Fairshare Adjust
                 vv043001     " Contr Comm Paid IG
                 vv204001     " Sec Tran Tariff Supp
                 vv205001     " Comp Stock Obligatio
                 vv211001     " Prim Tran Tar Transf
                 vv212001     " S&Handling Tar Trans
                 vv213001     " Sec Trans TariffTran
                 vv222001     " DIS:S&Handl Tar OvUn
                 vv223001     " DIS:Sec Tr TarifOvUn
                 vv230001     " Transfer Price LSC
                 vv232001     " S&Handling Tar LSC
                 vv233001     " Sec Trans Tariff LSC
                 vv500001     " 3rd Party Purchases
                 vv501001     " Transf from Oth Sect
                 vv502001     " Purchases IG
                 vv503001     " Inter-Seg Transf Pur
                 vv504001     " Import Freight
                 vv505001     " Stock Variations
                 vv506001     " Other Product Cost
                 vv507001     " Pipeline Operat Exp
                 vv508001     " Primary Transp Expen
                 vv509001     " Manufacturing Expens
                 vv510001     " Supply /Process Exp
                 vv511001     " MK Processing Plants
                 vv512001     " S&Handling Expenses
                 vv513001     " Sec Transp Expenses
                 vv514001     " Point of Sale Expens
                 vv515001     " Contr Comm Rec IG
                 vv516001     " Assoc Inc Dividend
                 vv517001     " Marketing & Sell Exp
                 vv518001     " Other Rev from Dist
                 vv519001     " Other Rev Transferrd
                 vv520001     " Stock Write-Off
                 vv236001     " Oth cost Tar LSC SMP
                 vv206001     " Prim Trp tariff Dist
                 vv051001     " CR Net Turnover
                 vv052001     " Dummy Price 2
                 vv053001     " Dummy Price 3
                 vv054001     " Dummy Price 4
                 vv055001     " Dummy Price 5
                 vv056001     " Dummy Price 6
                 vv057001     " Dummy Price 7
                 vv058001     " Dummy Price 8
                 vv059001     " Dummy Price 9
                 vv060001     " Dummy Price10
                 vv241001     " DummyTariff 1
                 vv242001     " DummyTariff 2
                 vv243001     " DummyTariff 3
                 vv244001     " DummyTariff 4
                 vv245001     " DummyTariff 5
                 vv246001     " DummyTariff 6
                 vv247001     " DummyTariff 7
                 vv248001     " DummyTariff 8
                 vv249001     " DummyTariff 9
                 vv250001     " DummyTariff10
                 vv521001     " SD&A Rebates
                 vv522001     " Dummy Cost 2
                 vv523001     " Dummy Cost 3
                 vv524001     " Dummy Cost 4
                 vv525001     " Dummy Cost 5
                 vv526001     " Dummy Cost 6
                 vv527001     " Dummy Cost 7
                 vv528001     " Dummy Cost 8
                 vv529001     " Dummy Cost 9
                 vv530001     " Dummy Cost 10
                 vv227001     " Sec Tr TarifOvUn LSC
                 vv226001     " S&Handl Tar OvUn LSC
                 vv224001     " Pr Tra TariffOvU DIS
                 FROM ce3op01
                 WHERE   paledger = lc_02 AND
                 vrgar    IN lr_vrgar AND
                 versi    IN lr_versi AND
                 perbl    IN lr_perbl AND
                 gjahr    IN lr_gjahr.
          ENDIF.
    For all other cursors.
          FETCH NEXT CURSOR ls_cursor
              APPENDING TABLE lt_ce3op02
              PACKAGE SIZE ls_s_if-maxsize.
          IF sy-subrc <> 0.
            EXIT.
          ENDIF.
          SORT lt_ce3op02 BY paobjnr pasubnr paledger vrgar versi gjahr
               perbl.
          DELETE ADJACENT DUPLICATES FROM lt_ce3op02 COMPARING paobjnr.
    *Begin of MODE-002
          DESCRIBE TABLE lt_ce3op02 LINES l_norecs.
          l_s_loop_from = lc_1.
          DO.
            l_s_loop_to = l_s_loop_from + l_s_no_recs.
            LOOP AT lt_ce3op02 INTO lw_ce3op02
            FROM l_s_loop_from TO l_s_loop_to .
              APPEND lw_ce3op02 TO lt_ce3op01.
            ENDLOOP.
            SORT lt_ce3op01 BY paobjnr.
    *End of MOS-002
            SELECT
              aktbo       "     Current profitability segment (CO-PA)
              paobjnr     "     Profitability Segment Number (CO-PA)
              pasubnr     "     Profitability segment changes (CO-PA)
              kndnr       "     Customer
              artnr
              bukrs     "     Company Code
              prctr
              kokrs
           FROM ce4op01
           INTO TABLE lt_ce4op01
           FOR ALL ENTRIES IN lt_ce3op01
           WHERE paobjnr = lt_ce3op01-paobjnr AND
                 pasubnr = lt_ce3op01-pasubnr AND
                 bukrs  IN lr_bukrs.
    *CE1op01
            SELECT
            paledger
            vrgar
            versi
            perio
            paobjnr
            pasubnr
            belnr
            posnr
            rbeln
            rposn
           FROM ce1op01
           INTO TABLE lt_ce1op01
           FOR ALL ENTRIES IN lt_ce3op01
           WHERE paledger = lt_ce3op01-paledger AND
                 vrgar    = lt_ce3op01-vrgar AND
                 versi    = lt_ce3op01-versi AND
                 perio    = lt_ce3op01-perbl AND
                 paobjnr = lt_ce3op01-paobjnr AND
                 pasubnr = lt_ce3op01-pasubnr.
    **CE1op01
            LOOP AT lt_ce3op01 INTO lw_ce3op01.
              MOVE:
              lw_ce3op01-paobjnr   TO lw_flnmval-paobjnr,
             lw_ce3op01-paledger  TO lw_flnmval-paledger,
             lw_ce3op01-vrgar     TO lw_flnmval-vrgar,
                      lw_ce3op01-versi     TO lw_flnmval-versi,
                      lw_ce3op01-gjahr     TO lw_flnmval-gjahr,
                      lw_ce3op01-perbl     TO lw_flnmval-perbl.
    *appending all 93 fields as records
              MOVE lw_ce3op01-vv010001    TO lw_flnmval-zamunt.
              APPEND lw_flnmval TO lt_flnmval.
              MOVE lw_ce3op01-vv011001    TO lw_flnmval-zamunt.
              APPEND lw_flnmval TO lt_flnmval.
              MOVE lw_ce3op01-vv012001    TO lw_flnmval-zamunt.
              APPEND lw_flnmval TO lt_flnmval.
              MOVE lw_ce3op01-vv013001    TO lw_flnmval-zamunt.
              APPEND lw_flnmval TO lt_flnmval.
              MOVE lw_ce3op01-vv014001    TO lw_flnmval-zamunt.
              APPEND lw_flnmval TO lt_flnmval.
              MOVE lw_ce3op01-vv015001    TO lw_flnmval-zamunt.
              APPEND lw_flnmval TO lt_flnmval.
              MOVE lw_ce3op01-vv016001    TO lw_flnmval-zamunt.
              APPEND lw_flnmval TO lt_flnmval.
              MOVE lw_ce3op01-vv020001    TO lw_flnmval-zamunt.
              APPEND lw_flnmval TO lt_flnmval.
              MOVE lw_ce3op01-vv021001    TO lw_flnmval-zamunt.
              APPEND lw_flnmval TO lt_flnmval.
              MOVE lw_ce3op01-vv030001    TO lw_flnmval-zamunt.
              APPEND lw_flnmval TO lt_flnmval.
              MOVE lw_ce3op01-vv031001    TO lw_flnmval-zamunt.
              APPEND lw_flnmval TO lt_flnmval.
              MOVE lw_ce3op01-vv032001    TO lw_flnmval-zamunt.
              APPEND lw_flnmval TO lt_flnmval.
              MOVE lw_ce3op01-vv033001    TO lw_flnmval-zamunt.
              APPEND lw_flnmval TO lt_flnmval.
              MOVE lw_ce3op01-vv034001    TO lw_flnmval-zamunt.
              APPEND lw_flnmval TO lt_flnmval.
              MOVE lw_ce3op01-vv035001    TO lw_flnmval-zamunt.
              APPEND lw_flnmval TO lt_flnmval.
              MOVE lw_ce3op01-vv200001    TO lw_flnmval-zamunt.
              APPEND lw_flnmval TO lt_flnmval.
              MOVE lw_ce3op01-vv201001    TO lw_flnmval-zamunt.
              APPEND lw_flnmval TO lt_flnmval.
              MOVE lw_ce3op01-vv202001    TO lw_flnmval-zamunt.
              APPEND lw_flnmval TO lt_flnmval.
              MOVE lw_ce3op01-vv203001    TO lw_flnmval-zamunt.
              APPEND lw_flnmval TO lt_flnmval.
              MOVE lw_ce3op01-vv036001    TO lw_flnmval-zamunt.
              APPEND lw_flnmval TO lt_flnmval.
              MOVE lw_ce3op01-vv037001    TO lw_flnmval-zamunt.
              APPEND lw_flnmval TO lt_flnmval.
              MOVE lw_ce3op01-vv038001    TO lw_flnmval-zamunt.
              APPEND lw_flnmval TO lt_flnmval.
              MOVE lw_ce3op01-vv039001    TO lw_flnmval-zamunt.
              APPEND lw_flnmval TO lt_flnmval.
              MOVE lw_ce3op01-vv040001    TO lw_flnmval-zamunt.
              APPEND lw_flnmval TO lt_flnmval.
              MOVE lw_ce3op01-vv041001    TO lw_flnmval-zamunt.
              APPEND lw_flnmval TO lt_flnmval.
              MOVE lw_ce3op01-vv042001    TO lw_flnmval-zamunt.
              APPEND lw_flnmval TO lt_flnmval.
              MOVE lw_ce3op01-vv043001    TO lw_flnmval-zamunt.
              APPEND lw_flnmval TO lt_flnmval.
              MOVE lw_ce3op01-vv204001    TO lw_flnmval-zamunt.
              APPEND lw_flnmval TO lt_flnmval.
              MOVE lw_ce3op01-vv205001    TO lw_flnmval-zamunt.
              APPEND lw_flnmval TO lt_flnmval.
              MOVE lw_ce3op01-vv211001    TO lw_flnmval-zamunt.
              APPEND lw_flnmval TO lt_flnmval.
              MOVE lw_ce3op01-vv212001    TO lw_flnmval-zamunt.
              APPEND lw_flnmval TO lt_flnmval.
              MOVE lw_ce3op01-vv213001    TO lw_flnmval-zamunt.
              APPEND lw_flnmval TO lt_flnmval.
              MOVE lw_ce3op01-vv222001    TO lw_flnmval-zamunt.
              APPEND lw_flnmval TO lt_flnmval.
              MOVE lw_ce3op01-vv223001    TO lw_flnmval-zamunt.
              APPEND lw_flnmval TO lt_flnmval.
              MOVE lw_ce3op01-vv230001    TO lw_flnmval-zamunt.
              APPEND lw_flnmval TO lt_flnmval.
              MOVE lw_ce3op01-vv232001    TO lw_flnmval-zamunt.
              APPEND lw_flnmval TO lt_flnmval.
              MOVE lw_ce3op01-vv233001    TO lw_flnmval-zamunt.
              APPEND lw_flnmval TO lt_flnmval.
              MOVE lw_ce3op01-vv500001    TO lw_flnmval-zamunt.
              APPEND lw_flnmval TO lt_flnmval.
              MOVE lw_ce3op01-vv501001    TO lw_flnmval-zamunt.
              APPEND lw_flnmval TO lt_flnmval.
              MOVE lw_ce3op01-vv502001    TO lw_flnmval-zamunt.
              APPEND lw_flnmval TO lt_flnmval.
              MOVE lw_ce3op01-vv503001    TO lw_flnmval-zamunt.
              APPEND lw_flnmval TO lt_flnmval.
              MOVE lw_ce3op01-vv504001    TO lw_flnmval-zamunt.
              APPEND lw_flnmval TO lt_flnmval.
              MOVE lw_ce3op01-vv505001    TO lw_flnmval-zamunt.
              APPEND lw_flnmval TO lt_flnmval.
              MOVE lw_ce3op01-vv506001    TO lw_flnmval-zamunt.
              APPEND lw_flnmval TO lt_flnmval.
              MOVE lw_ce3op01-vv507001    TO lw_flnmval-zamunt.
              APPEND lw_flnmval TO lt_flnmval.
              MOVE lw_ce3op01-vv508001    TO lw_flnmval-zamunt.
              APPEND lw_flnmval TO lt_flnmval.
              MOVE lw_ce3op01-vv509001    TO lw_flnmval-zamunt.
              APPEND lw_flnmval TO lt_flnmval.
              MOVE lw_ce3op01-vv510001    TO lw_flnmval-zamunt.
              APPEND lw_flnmval TO lt_flnmval.
              MOVE lw_ce3op01-vv511001    TO lw_flnmval-zamunt.
              APPEND lw_flnmval TO lt_flnmval.
              MOVE lw_ce3op01-vv512001    TO lw_flnmval-zamunt.
              APPEND lw_flnmval TO lt_flnmval.
              MOVE lw_ce3op01-vv513001    TO lw_flnmval-zamunt.
              APPEND lw_flnmval TO lt_flnmval.
              MOVE lw_ce3op01-vv514001    TO lw_flnmval-zamunt.
              APPEND lw_flnmval TO lt_flnmval.
              MOVE lw_ce3op01-vv515001    TO lw_flnmval-zamunt.
              APPEND lw_flnmval TO lt_flnmval.
              MOVE lw_ce3op01-vv516001    TO lw_flnmval-zamunt.
              APPEND lw_flnmval TO lt_flnmval.
              MOVE lw_ce3op01-vv517001    TO lw_flnmval-zamunt.
              APPEND lw_flnmval TO lt_flnmval.
              MOVE lw_ce3op01-vv518001    TO lw_flnmval-zamunt.
              APPEND lw_flnmval TO lt_flnmval.
              MOVE lw_ce3op01-vv519001    TO lw_flnmval-zamunt.
              APPEND lw_flnmval TO lt_flnmval.
              MOVE lw_ce3op01-vv520001    TO lw_flnmval-zamunt.
              APPEND lw_flnmval TO lt_flnmval.
              MOVE lw_ce3op01-vv236001    TO lw_flnmval-zamunt.
              APPEND lw_flnmval TO lt_flnmval.
              MOVE lw_ce3op01-vv206001    TO lw_flnmval-zamunt.
              APPEND lw_flnmval TO lt_flnmval.
              MOVE lw_ce3op01-vv051001    TO lw_flnmval-zamunt.
              APPEND lw_flnmval TO lt_flnmval.
              MOVE lw_ce3op01-vv052001    TO lw_flnmval-zamunt.
              APPEND lw_flnmval TO lt_flnmval.
              MOVE lw_ce3op01-vv053001    TO lw_flnmval-zamunt.
              APPEND lw_flnmval TO lt_flnmval.
              MOVE lw_ce3op01-vv054001    TO lw_flnmval-zamunt.
              APPEND lw_flnmval TO lt_flnmval.
              MOVE lw_ce3op01-vv055001    TO lw_flnmval-zamunt.
              APPEND lw_flnmval TO lt_flnmval.
              MOVE lw_ce3op01-vv056001    TO lw_flnmval-zamunt.
              APPEND lw_flnmval TO lt_flnmval.
              MOVE lw_ce3op01-vv057001    TO lw_flnmval-zamunt.
              APPEND lw_flnmval TO lt_flnmval.
              MOVE lw_ce3op01-vv058001    TO lw_flnmval-zamunt.
              APPEND lw_flnmval TO lt_flnmval.
              MOVE lw_ce3op01-vv059001    TO lw_flnmval-zamunt.
              APPEND lw_flnmval TO lt_flnmval.
              MOVE lw_ce3op01-vv060001    TO lw_flnmval-zamunt.
              APPEND lw_flnmval TO lt_flnmval.
              MOVE lw_ce3op01-vv241001    TO lw_flnmval-zamunt.
              APPEND lw_flnmval TO lt_flnmval.
              MOVE lw_ce3op01-vv242001    TO lw_flnmval-zamunt.
              APPEND lw_flnmval TO lt_flnmval.
              MOVE lw_ce3op01-vv243001    TO lw_flnmval-zamunt.
              APPEND lw_flnmval TO lt_flnmval.
              MOVE lw_ce3op01-vv244001    TO lw_flnmval-zamunt.
              APPEND lw_flnmval TO lt_flnmval.
              MOVE lw_ce3op01-vv245001    TO lw_flnmval-zamunt.
              APPEND lw_flnmval TO lt_flnmval.
              MOVE lw_ce3op01-vv246001    TO lw_flnmval-zamunt.
              APPEND lw_flnmval TO lt_flnmval.
              MOVE lw_ce3op01-vv247001    TO lw_flnmval-zamunt.
              APPEND lw_flnmval TO lt_flnmval.
              MOVE lw_ce3op01-vv248001    TO lw_flnmval-zamunt.
              APPEND lw_flnmval TO lt_flnmval.
              MOVE lw_ce3op01-vv249001    TO lw_flnmval-zamunt.
              APPEND lw_flnmval TO lt_flnmval.
              MOVE lw_ce3op01-vv250001    TO lw_flnmval-zamunt.
              APPEND lw_flnmval TO lt_flnmval.
              MOVE lw_ce3op01-vv521001    TO lw_flnmval-zamunt.
              APPEND lw_flnmval TO lt_flnmval.
              MOVE lw_ce3op01-vv522001    TO lw_flnmval-zamunt.
              APPEND lw_flnmval TO lt_flnmval.
              MOVE lw_ce3op01-vv523001    TO lw_flnmval-zamunt.
              APPEND lw_flnmval TO lt_flnmval.
              MOVE lw_ce3op01-vv524001    TO lw_flnmval-zamunt.
              APPEND lw_flnmval TO lt_flnmval.
              MOVE lw_ce3op01-vv525001    TO lw_flnmval-zamunt.
              APPEND lw_flnmval TO lt_flnmval.
              MOVE lw_ce3op01-vv526001    TO lw_flnmval-zamunt.
              APPEND lw_flnmval TO lt_flnmval.
              MOVE lw_ce3op01-vv527001    TO lw_flnmval-zamunt.
              APPEND lw_flnmval TO lt_flnmval.
              MOVE lw_ce3op01-vv528001    TO lw_flnmval-zamunt.
              APPEND lw_flnmval TO lt_flnmval.
              MOVE lw_ce3op01-vv529001    TO lw_flnmval-zamunt.
              APPEND lw_flnmval TO lt_flnmval.
              MOVE lw_ce3op01-vv530001    TO lw_flnmval-zamunt.
              APPEND lw_flnmval TO lt_flnmval.
              MOVE lw_ce3op01-vv227001    TO lw_flnmval-zamunt.
              APPEND lw_flnmval TO lt_flnmval.
              MOVE lw_ce3op01-vv226001    TO lw_flnmval-zamunt.
              APPEND lw_flnmval TO lt_flnmval.
              MOVE lw_ce3op01-vv224001    TO lw_flnmval-zamunt.
              APPEND lw_flnmval TO lt_flnmval.
    *Segrigating all one record into 102 records is complete
            ENDLOOP.
            LOOP AT lt_flnmval ASSIGNING <fs_flnmval>.
              IF l_index > 93.
                l_index = 1.
              ENDIF.
              READ TABLE lt_fldlist INTO lw_fldlist INDEX l_index.
              IF sy-subrc = 0.
                CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
                  EXPORTING
                    input  = lw_fldlist-fldnam
                  IMPORTING
                    output = <fs_flnmval>-fldnam.
              ENDIF.
              l_index = l_index + 1.
            ENDLOOP.
            SORT lt_ce4op01 BY paobjnr.
            SORT lt_ce1op01 BY paobjnr  paledger vrgar  versi.
            SORT gr_zfldnm BY low.
            DELETE lt_flnmval WHERE fldnam NOT IN gr_zfldnm.
            LOOP AT lt_flnmval INTO lw_flnmval.
              READ TABLE lt_ce4op01 INTO  lw_ce4op01 WITH KEY
                                 paobjnr = lw_flnmval-paobjnr BINARY SEARCH.
              IF sy-subrc = 0.
                MOVE :   lw_flnmval-paledger  TO lw_e_t_data-paledger,
                         lw_flnmval-vrgar     TO lw_e_t_data-vrgar,
                         lw_flnmval-versi     TO lw_e_t_data-versi ,
                         lw_flnmval-gjahr     TO lw_e_t_data-gjahr,
                         lw_flnmval-perbl     TO lw_e_t_data-perbl,
                         lw_ce4op01-bukrs     TO lw_e_t_data-bukrs,
                         lw_ce4op01-kndnr     TO lw_e_t_data-kndnr,
                         lw_ce4op01-artnr     TO lw_e_t_data-artnr,
                         lw_ce4op01-prctr     TO lw_e_t_data-prctr,
                         lw_ce4op01-kokrs     TO lw_e_t_data-kokrs,
                         lw_flnmval-fldnam   TO lw_e_t_data-zfldnm,
                         lw_flnmval-zamunt   TO lw_e_t_data-zamount.
    CE1op01
                READ TABLE lt_ce1op01 INTO lw_ce1op01 WITH KEY
                            paobjnr = lw_flnmval-paobjnr
                            paledger = lw_flnmval-paledger
                            vrgar  = lw_flnmval-vrgar
                            versi = lw_flnmval-versi BINARY SEARCH.
                IF sy-subrc = 0.
                  MOVE: lw_ce1op01-rbeln  TO lw_e_t_data-rbeln,
                        lw_ce1op01-rposn  TO lw_e_t_data-rposn.
                ENDIF.
    CE1op01
                APPEND lw_e_t_data TO gt_out_data.
              ENDIF.
            ENDLOOP.
    *Begin of MOD-002
            FREE lt_flnmval.
            REFRESH :lt_ce3op01,lt_ce4op01,lt_ce1op01.
            e_t_data[] = gt_out_data[].
            DELETE e_t_data WHERE zfldnm NOT IN gr_zfldnm.
            l_s_loop_from = l_s_loop_to + lc_1.
            l_count = l_count + 20.
            IF l_count GE l_norecs.
              EXIT.
            ENDIF.
          ENDDO.
    *End of MOD-002
          ls_counter_datapakid = ls_counter_datapakid + 1.
        ENDIF.                        "IF S_COUNTER_DATAPAKID = 0
      ELSE.
        IF i_maxsize IS INITIAL.
          RAISE error_passed_to_mess_handler.
        ENDIF.
        IF g_start IS INITIAL.
          g_start = 1.
        ELSE.
          g_start  = g_end + 1.
        ENDIF.
        g_end = g_start + i_maxsize - 1.
    Population of E_T_DATA based on Data records size
        APPEND LINES OF gt_out_data FROM g_start TO g_end TO e_t_data.
        DELETE e_t_data WHERE zfldnm NOT IN gr_zfldnm.
        IF e_t_data[] IS INITIAL.
          RAISE no_more_data.
        ENDIF.
        ls_counter_datapakid = ls_counter_datapakid + 1.
      ENDIF.
    ENDFUNCTION.
    Thanks & regards,
    Sreekanth
    +91 9740091981

    Hello Sreekanth,
    See this blog [Generic Extraction via Function Module|/people/siegfried.szameitat/blog/2005/09/29/generic-extraction-via-function-module]
    Also see this
    [Line Item Level Data Extraction for Financial Accounting and Controlling|https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/a7f2f294-0501-0010-11bb-80e0d67c3e4a]
    Thanks
    Chandran

  • Problem while creating Function module

    Hi All,
                   I created a TABLE and am using this table in a FUNCTION MODULE as a reference for declaring an internal table in TABLES tab in the function module  .
    But when i click on the table name its giving an error "TABLES parameters are obsolete! "
    Can any one figure out the reasons .....and help me out!!!
    Deepika K

    Hi Deepika,
       Tables option is said to be Obsolete because these days we use internal tables without header line...
    Tables Option in FM considers internally that the table name you mentioned is with a header line and the structure of the internal table will be acting as work area.
    It is still included in new version because for Upward compatibility...
    As we still use the predefine function modules so they should be even compatible with newer versions so its still there..
    But for normal practice it can be used but preferably not to use.. rather you use EXPORT parameter and include internal table like field...
    Create a structure first and then a Table type which include the previously defined structure in  SE11 and the assign the Table type to the field in EXPORT parameter with TYPE..
    Hope this would help u.
    Regards
    Narin Nandivada.

  • How to create function module to update z tables?

    Hi,
    I am new to ABAP. I checked the forum but did not find relevant solutions.
    I have 2 z tables - ZFLIGHT and ZCUSTOMER. I have a few entries in each table.
    I want to write a report to update the entries in the table using function modules. For that I have created a function module - zflight_fm and also a function group- zflight_fg and assigned the function group to the Fm. I do not know how to proceed further, what to put as import, export parameters, tables, changing etc. Further I want exceptions to handle the successful update of the entries.
    Thanks and regards,
    Smruthi

    Steps:
    1) Changing --->a) Zflight TYPE ZFLIGHT(DDIC Ref) OR  Zflight TYPE  ANY TABLE
                           b) ZCustomer TYPE ZFLIGHT(DDIC Ref) OR  ZCustomer TYPE  ANY TABLE
    2) Execptions:
         a) Upload_failed_Flight
         b) Upload_Failed_Customer
    3) Exporting ---> a) Information what rows are uploaded
    Source Code:
    Insert Zflight from Zflight(changing parameter).
    If insert failed
    RAISE  Upload_failed_Flight.
    endif.
    Insert ZCustomer from ZCustomer(changing parameter).
    If insert failed
    RAISE  Upload_failed_Customer.
    endif.
    Regards,
    Gurpreet

  • Help required in creating function module which reads payroll clusters.

    Hi ,
    We have a requirement where in we need to create a function module for reading a sequence of tables from payroll clusters. This function module does two functions:
    1.Read the payroll results from one system.
    2.write the payroll results to other system.
    please do the needful as soon as possible.
    Thanks in advance.
    Regards,
    Durga.

    hi
    Refer to the below thread
    Programming with Clusters for HR-Payroll
    Regards
    Sameer

  • Problem in creating Function Module

    Hi,
      while creating a function (Z_SPELL_AMOUNT_INDIA) one error is coming . the error  <b>'SPELL not declared</b> ' is coming. already the Function module is running correctly in different client(another client's place) i am just download the Function module from the existing implementation site and upload the function module in new client's place. both the Projects are mySAP ECC 5.0.
      Here first i have created a function group and under the Function group itself i am uploading the FM.
      How can i declare the SPELL?
    is there any rules to be follow while creating the Function Group?
    Thanks,
    Neptune.M

    Before you copy the function module check the following
    1. Check the TOP include copied properly or not
    2. Check any form routine (if existing) copied or not
    3. In the Import, Export & tables if you are pointing to any DDIC structures, check whether they are copied or not.
    While activating the function module CHOOSE ALL THE INCLUDES AND FUNCTION GROUP AT A TIME, AND THEN ACTIVATE ALL.
    I hope this helps you.
    - Raj

  • Creating Function Module in Generic Extractor?

    Hello All
    DO anyone has steps how to create a Functional Module in Generic Extraction?
    Pl let me know
    Many Thanks
    balaji

    hi Balaji,
    first create your function module (se37),
    sample code see function module
    RSAX_BIW_GET_DATA_SIMPLE.
    then follow steps in create generic datasource
    http://help.sap.com/saphelp_nw04/helpdata/en/3f/548c9ec754ee4d90188a4f108e0121/frameset.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/86/1c8c3e94243446e10000000a114084/frameset.htm
    hope this helps.

Maybe you are looking for

  • Receiver Axis Adapter to 3rd party webservice

    Hi, My scenario is ABAP Proxy --> PI --> 3rd party webservice using Soap Adapter with Axis protocal. I'm getting the following error when attempting to post to the 3rd party web service: nested exception is: java.net.SocketException: Connection timed

  • Pictures taken with Playbook are not saved

    Hello all,  I found myself taking a few pics today with the Playbook at work, thinking I could review them later and prepare a report. To my surprise they were nowhere to be found. This is the first time something like this happens and as a user it's

  • Webclip error - WCS-510 !

    Hello, I'm getting this error when I try to webclip a web page: "An exception has occured : WCS-510 -- HTTP connection failed to URL http://www.yahoo.com by method get Please click "Cancel" or "Back" in the above panel (if present) to retry. Otherwis

  • Jakarta Commons Lang

    Hi, I am using JSP and Mysql for my application. I have a form with textarea fields. When user clicks submit, the values entered, are stored into the database. Currently am not able to use escape characters such as "'" or " "" ".. I have already down

  • Oracle.exe has stopped working

    I am trying to run the orion load manually on Win2k8 machine.I have installed Orion 10.2. When given the command manually i get the error as: Oracle.exe has stopped working. Can anybody help me with resolving this?