GDE - function module.. code .. problem

hi all,
I am extracting data using FM
from PAYR and REGUH.
I need:
Payr
doc1 ven01.........filds.a b c.
doc2 ven02.........filds..
doc3 ven02.........filds..
doc4 ven03.........filds..
My Fm is working fine.
I need from REGUH:
doc1 ven01.........filds p q r..
doc2 ven02.........filds..
doc3 ven02.........filds..
doc4 ven03.........filds..
doc5 ven05.........filds..
doc6 ven06.........filds..
doc5 and Doc6 not there in Payr table. finally i need 6 records with a, b,c, p, q, r
I wrote code:
========
error : It returns dump..
saying : INDEX problem..?
Modify e_t_data index sy-tabix.
FUNCTION z_biw_payr_get_data .
""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
*"     REFERENCE(I_REMOTE_CALL) TYPE  SBIWA_FLAG DEFAULT
*"       SBIWA_C_FLAG_OFF
*"  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  ZBIW_AP_PAYR OPTIONAL
*"  EXCEPTIONS
*"      NO_MORE_DATA
*"      ERROR_PASSED_TO_MESS_HANDLER
Example: DataSource for table SFLIGHT
  TABLES: payr.
Auxiliary Selection criteria structure
  DATA: l_s_select TYPE srsc_s_select.
Maximum number of lines for DB table
  STATICS: s_s_if TYPE srsc_s_if_simple,
counter
          s_counter_datapakid LIKE sy-tabix,
cursor
          s_cursor TYPE cursor.
*internal tables:
I_payr like payr occurs 0 with header line.
I_reguh like reguh occurs 0 with header line.
Select ranges
  RANGES: l_r_gjahr   FOR zap_payr-gjahr,
          l_r_vblnr   FOR zap_payr-vblnr,
          l_r_zbukr   FOR zap_payr-zbukr.
Initialization mode (first call by SAPI) or data transfer mode
(following calls) ?
  IF i_initflag = sbiwa_c_flag_on.
Initialization: check input parameters
                buffer input parameters
                prepare data selection
please Check DataSource validity
    CASE i_dsource.
      WHEN 'ZAP_PAYR'.
      WHEN OTHERS.
        IF 1 = 2. MESSAGE e009(r3). ENDIF.
this is a typical log call. Please write every error message like this
        log_write 'E'                  "message type
                  'R3'                 "message class
                  '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.
Fill parameter buffer for data extraction calls
    s_s_if-requnr    = i_requnr.
    s_s_if-dsource = i_dsource.
    s_s_if-maxsize   = i_maxsize.
Fill field list table for an optimized select statement
(in case that there is no 1:1 relation between InfoSource fields
and database table fields this may be far from beeing trivial)
    APPEND LINES OF i_t_fields TO s_s_if-t_fields.
  ELSE.                 "Initialization mode or data extraction ?
Data transfer: First Call      OPEN CURSOR + FETCH
               Following Calls FETCH only
First data package -> OPEN CURSOR
    IF s_counter_datapakid = 0.
Fill range tables BW will only pass down simple selection criteria
of the type SIGN = 'I' and OPTION = 'EQ' or OPTION = 'BT'.
      LOOP AT s_s_if-t_select INTO l_s_select WHERE fieldnm = 'GJAHR'.
        MOVE-CORRESPONDING l_s_select TO l_r_gjahr.
        APPEND l_r_gjahr.
      ENDLOOP.
      LOOP AT s_s_if-t_select INTO l_s_select WHERE fieldnm = 'VBLNR'.
              MOVE-CORRESPONDING l_s_select TO l_r_vblnr.
        APPEND l_r_vblnr.
      ENDLOOP.
      LOOP AT s_s_if-t_select INTO l_s_select WHERE fieldnm = 'ZBUKR'.
        MOVE-CORRESPONDING l_s_select TO l_r_zbukr.
        APPEND l_r_zbukr.
      ENDLOOP.
Determine number of database records to be read per FETCH statement
from input parameter I_MAXSIZE. If there is a one to one relation
between DataSource table lines and database entries, this is trivial.
In other cases, it may be impossible and some estimated value has to
be determined.
Extracts from Tableu2026..1
      OPEN CURSOR WITH HOLD s_cursor FOR
      SELECT mandt zbukr hbkid hktid rzawe chect checf laufd laufi lifnr
        kunnr empfg ubhkt vblnr gjahr zaldt waers rwbtr strgb pridt
        priti prius xmanu xbanc bancd extrd extrt xbukr zanre znme1
        znme2 znme3 znme4 zpstl zort1 zstra zpfac zland zregi zbnks
        zbnkn zbnkl zbkon voidr voidd voidu checv hbkiv hktiv zpst2
        xragl pernr seqnr btznr rec_belnr rec_gjahr zpfor uzawe ichec
        irefe rwskt
      FROM  payr
      WHERE zbukr  IN l_r_zbukr
            AND   vblnr  IN l_r_vblnr
      AND   gjahr  IN l_r_gjahr.
    AND   rzawe  EQ 'C'.
    ENDIF.                             "First data package ?
Fetch records into interface table.
  named E_T_'Name of extract structure'.
    FETCH NEXT CURSOR s_cursor
               APPENDING CORRESPONDING FIELDS
               OF TABLE e_t_data
               PACKAGE SIZE s_s_if-maxsize.
    IF sy-subrc <> 0.
      CLOSE CURSOR s_cursor.
      RAISE no_more_data.
    ENDIF.
**get all u2018Du2019 and 2 series VBLNR records from REGUH
_** --- CHECK the codes for WITH CASE 1 OR CASE 2._
Case 1 :
*Select * from reguh*
     Into corresponding fields of table i_reguh
     For all entries in e_t_data
     Where lifnr = e_t_data-lifnr
      And  rzawe = u2018Du2019
      and  Vblnr like u20182%u2019.
Or u2026u2026 Or u2026u2026 Or u2026u2026
Case2 :
*Select * from reguh*
     Into corresponding fields of table i_reguh
     Where rzawe = u2018Du2019
      and  Vblnr like u20182%u2019.
Loop at e_t_data.
  Read table i_reguh with key lifnr = e_t_data-lifnr
    If sy-subrc = 0.
      E_t_data-laufi  like reguh- laufi.
      E_t_data-Zbukr like reguh-zbukr.
      E_t_data-lifnr like reguh- lifnr .
      E_t_data-empfg like reguh- empfg.
      E_t_data-vblnr  like reguh-vblnr
      E_t_data-waers like reguh-waers
      E_t_data-srtgb like reguh-srtgb.
      E_t_data-znme1 like reguh- znme1.
      E_t_data-znme2  like reguh- znme2.
      E_t_data-znme3 like reguh- znme3.
      E_t_data-znme4 like reguh- znme4.
      E_t_data-zpstl like reguh-zpstl.
      E_t_data-zort1   like reguh-zortl.
      E_t_data-zstra like reguh-zstra.
      E_t_data-zpfac like reguh-zpfac.
      E_t_data-zland like reguh-zland.
      E_t_data-zregi like reguh-zregi.
      E_t_data-zbnkl like reguh-zbnkl.
      E_t_data-rzawe like reguh-rzawe.
      E_t_data-hktid like reguh-hktid.
      E_t_data-hbkid like reguh-hbkid.
      E_t_data-zpst2 like reguh-zpst2.
      E_t_data-uzawe like reguh-uzawe.
            E_t_data-pernr like reguh-pernr.
     E_t_data-btznr like reguh-btanr.
     E_t_data-laufd like reguh-laufd.
     E_t_data-zaldt like reguh-zaldt.
     E_t_data-rwbtr like reguh-rwbtr.
     E_t_data-rwskt like reguh-rwskt.
     Modify e_t_data index sy-tabix.
Else.
     E_t_data-laufi  like reguh- laufi.
            E_t_data-Zbukr like reguh-zbukr.
     E_t_data-lifnr like reguh- lifnr .
     E_t_data-empfg like reguh- empfg.
     E_t_data-vblnr  like reguh-vblnr
     E_t_data-waers like reguh-waers
     E_t_data-srtgb like reguh-srtgb.
     E_t_data-znme1 like reguh- znme1.
     E_t_data-znme2  like reguh- znme2.
     E_t_data-znme3 like reguh- znme3.
     E_t_data-znme4 like reguh- znme4.
     E_t_data-zpstl like reguh-zpstl.
     E_t_data-zort1   like reguh-zortl.
     E_t_data-zstra like reguh-zstra.
     E_t_data-zpfac like reguh-zpfac.
     E_t_data-zland like reguh-zland.
     E_t_data-zregi like reguh-zregi.
     E_t_data-zbnkl like reguh-zbnkl.
     E_t_data-rzawe like reguh-rzawe.
     E_t_data-hktid like reguh-hktid.
     E_t_data-hbkid like reguh-hbkid.
     E_t_data-zpst2 like reguh-zpst2.
     E_t_data-uzawe like reguh-uzawe.
     E_t_data-pernr like reguh-pernr.
     E_t_data-btznr like reguh-btanr.
     E_t_data-laufd like reguh-laufd.
     E_t_data-zaldt like reguh-zaldt.
     E_t_data-rwbtr like reguh-rwbtr.
     E_t_data-rwskt like reguh-rwskt.
Modify e_t_data index sy-tabix.
Endif.
Endloop.
Logic for eliminating voided Checks Begin
    itab[] = e_t_data[].
    SORT itab BY chect.
    LOOP AT itab WHERE ( voidu NE space ) AND ( voidd NE space ).
      wa_idx = sy-tabix.
      wa_chect = itab-chect. CLEAR wa_found.
            wa_zbukr = itab-zbukr.
      wa_hbkid = itab-hbkid.
      wa_hktid = itab-hktid.
      wa_rzawe = itab-rzawe.
      DO.
        SELECT SINGLE * FROM payr WHERE
        zbukr = wa_zbukr AND
        hbkid = wa_hbkid AND
        hktid = wa_hktid AND
        rzawe = wa_rzawe AND
        chect = wa_chect.
        IF sy-subrc NE 0.
Not transferring this record to BW
      message 'Invalid Check No.' type 'I'.
          DELETE itab.
          wa_found = 'Y'. EXIT.
        ENDIF.
        IF ( payr-voidu NE space ) AND ( payr-voidd NE space ).
          wa_chect = payr-checv.
          wa_zbukr = payr-zbukr.
          wa_hbkid = payr-hbkid.
                    wa_hktid = payr-hktid.
          wa_rzawe = payr-rzawe.
If the Replacement Check # points to Original Check No., this record
will be skipped.
          IF itab-chect = payr-checv.
            DELETE itab INDEX wa_idx.
            EXIT.
          ENDIF.
        ELSE.
          MOVE-CORRESPONDING payr TO itab.
          APPEND itab. wa_found = 'Y'.
          MOVE-CORRESPONDING itab TO itab1.
          APPEND itab1.
          EXIT.
        ENDIF.
        IF wa_found = 'Y'.
          EXIT.
        ENDIF.
      ENDDO.
    ENDLOOP.
    SORT itab by zbukr hbkid hktid rzawe chect.
        DELETE ADJACENT DUPLICATES FROM itab COMPARING zbukr hbkid hktid
    rzawe chect.
    LOOP AT itab1.
      READ TABLE itab WITH KEY
      zbukr = itab1-zbukr
      hbkid = itab1-hbkid
      hktid = itab1-hktid
      rzawe = itab1-rzawe
      chect = itab1-chect BINARY SEARCH.
      IF ( itab-voidu IS NOT INITIAL ).
        DELETE TABLE itab FROM itab1.
      ENDIF.
    ENDLOOP.
04/13/08 commented to satisfy 4th condition
Do not extract the Original record of the replaced Check
   LOOP AT itab.
     IF ( itab-voidu IS NOT INITIAL ) AND
        ( itab-voidd IS NOT INITIAL ).
       DELETE itab.
     ENDIF.
   ENDLOOP.
04/13/08 commented to satisfy 4th condition
Logic for eliminating voided Checks End
***The below process can be used for Delta Extraction using Time Stamp
   loop at itab.
     concatenate itab-pridt itab-priti into wa_timstmp.
     move wa_timstmp to itab-timstmp.
     move-corresponding itab to e_t_data.
     append e_t_data.
   endloop.
    e_t_data[] =    itab[].
    s_counter_datapakid = s_counter_datapakid + 1.
  ENDIF.              "Initialization mode or data extraction ?
ENDFUNCTION.
=========
Please advise me and where will i correct the code.
Thanks in advance,
Siri.
Edited by: SIRI SIRI on Jun 3, 2008 3:26 PM

Hi,
use the following:
define a index variable.
data: l_index type sy-tabix.
in your loop at e_t_data.
loop at e_t_data.
new statement
l_index = sy-tabix.
changed statement
modify e_t_data index l_index.
endloop.
The other read operations on internal tables will reset sy-tabix so that it will point to a invalid record.
regards
Siggi

Similar Messages

  • Customized function Module BOM Problems

    Hi,
    i have created New function Module as copy of of
    IDOC_INPUT_BOMMAT .
    now i need to do some customizations in the new function module
    like
    1.calculating validity dates by using function module
    CC_CHANGE_NUMBER_READ
    This is required for:
    Valid from date Change Ref - ZE1CHNGNR-ZCHFROM
    Valid to date Change Ref - ZE1CHNGNR-ZCHTO
    Current Year Change Ref - ZE1CHNGNR-ZCHCURR a new customized extended segment
    How to do this
    Please help me

    In function module "IDOC_INPUT_BOMMAT" there is a subroutine
       move and convert data from idoc to application internal tables
        perform idoc_to_bom_itabs tables idoc_data
                                         idoc_contrl.
    that transfers all the data in IDOC to internal tables.I think after this you have to write your code and modify BOM internal tables in the program. you can find all the BOM internal tables in the include "LCSDSTOP". I have never done this. Please try and see whether this will work for you.
    Thanks.

  • Function Module GUI_DOWNLOAD Problem in Japanese language.

    HI All,
    I am Using GUI_Download funtion module for downloading data from internal table to flat file.
    But one of the field having the value 'OLOA®5624'.
    In User login to Japanese Langualge:-
    After downloading data the value 'OLOA#5624' is apper insted of 'OLOA®5624'. (i.e the '®' - the symbol is replaced by # in the download ).
    If any one know please let me as early as possible.

    Hi,
    Once you download the data, you have to convert the data.
    Please check the below link for more help.
    http://help.sap.com/saphelp_nw2004s/helpdata/en/79/c554afb3dc11d5993800508b6b8b11/frameset.htm
    Thanks,
    Ramakrishna

  • Enhance sorce code in Function module option

    Dear Expets ,
              Please let me the advantage of the button - enhance source code in the menu bar of the standard function module.
              Can i write my own logic there .
              I am planning to modify the function module - CK_F_INTERNAL_ACTIVITY_VAL - based on certain condition.
    Thanks,
    Dev

    Hi,
    The option mentioned is a part of the enhancement framework provided by SAP to write Implict enhancements
    Search for Keyword "Implict enhancements" in SDN and elsewhere to get a brief idea
    Using this we can write codes in specific areas of the code as indicated by SAP.
    To view these locations -> click on the " enhance source code " button and then go to EDIT->Enhancement Operations -> show Implicit Enhancements ...SAP will highlight the areas where code can be written.
    Right Click on the area required->Enhancement Impelemtation -> Create
    It asks for a "Enhancement Implementation" as  a table control pop-up -> Creata a new one using the "create Icon" and give a suitable name .Your enhancement code will be save under this.
    In case you plan to undo the changes,go to the spot created Right Click ->Enhancement Impelemtation -> Undo
    Always use the "Where -used list" to analyse the impact of the changes when the function module code is changed and use this "Implict enhancement" only as the last option to edit source code.Implicit options may not always be available for all source codes and at all locations desired.
    Hope it helps!
    Regards
    Byju

  • Error in extracting data through function module

    Hi All
             Need  ur help .I am extracting data from crm thru function module.I have copied RSAX_BIW_GET_DATA_SIMPLE and modified it by using code.I am getting an error while testing extraction
    Structure I have created ztest_01
    Data Source :zmgc_ds1.
    There 3 crm tables from where data is picked crmd_orderadm_h,crmd_customer_h,crmd_order_index.
    I am attaching the code,can any body help me in correctring the error.Tell me if tthe placing of the code in the template is correct.please give details.
    Error which I got:
    An exception occurred that is explained in detail below.
    The exception, which is assigned to class 'CX_SY_DYN_CALL_ILLEGAL_FUNC', was
      not caught in
    procedure "RSA3_GET_DATA_SIMPLE" "(FUNCTION)", nor was it propagated by a
      RAISING clause.
    Since the caller of the procedure could not have anticipated that the
    exception would occur, the current program is terminated.
    The reason for the exception is:
    The program "SAPLRSA3" contains the CALL FUNCTION statement.
    The name of the function module to be called is "ZRSAX_BIW_GET_DATA_SIMPLE_01"
    but "ZRSAX_BIW_GET_DATA_SIMPLE_01" cannot be found in its function group.
    Possible reasons:
    a) The function module "ZRSAX_BIW_GET_DATA_SIMPLE_01" has not been activated.
      Therefore,
        it cannot be found at runtime.
    b) The Function Library contains an incorrect entry for
      "ZRSAX_BIW_GET_DATA_SIMPLE_01".
    c) The function module contains no code, even FUNCTION ... ENDFUNCTION
        is missing.
    You help would be appreciated.
    Don't worry about points,.

    Did you create your function module without problems...assigned the Z* function group? activate the function module? i assume that you copy the function module code and the variables definition on TOP include of RSAX_BIW_GET_DATA_SIMPLE
    Regards
    Message was edited by:
            Oscar Díaz

  • Generic Delta extraction by Function module issue

    Hello Experts,
    Please help !!!
    I have problem for delta extraction by Function module.  For the full load, I wrote function module based on RSAX_BIW_GET_DATA_SIMPLE. It works fine.
    But I would like to have the delta load enabled. Therefore, I modified the datasource, add a delta specific field u2018ztimestampu2019, which type is calendar day.
    Then I create a function module based on template u2018RSAX_BIW_GET_DATAu2019, as this support the upload mode. But when I test this datasource in RSA3, no matter itu2019s full load or initial delta load, it always send me an error, u201CErrors occurred during the extractionu201D.
    I had some debug, and found that there is no value  for i_isource when my function module is called. Therefore it raised the exception.
    But I do not have the chance to debug my code for the delta logic, can somebody help to check?
    I also check the entries in ROOSOURCE,
    For my datasource ZTRNREC_FM_DELTA, The DELTA value is u2018AIEu2019, and extraction method is u2018F2u2019, should I change them to DELTA= u2018Du2019 and extraction method to u2018F1u2019? Where to change?
    FUNCTION ZRSAX_TRAININGREC_DELTA.
    ""Local Interface:
    *"  IMPORTING
    *"     VALUE(I_REQUNR) TYPE  SBIWA_S_INTERFACE-REQUNR
    *"     VALUE(I_ISOURCE) TYPE  SBIWA_S_INTERFACE-ISOURCE OPTIONAL
    *"     VALUE(I_MAXSIZE) TYPE  SBIWA_S_INTERFACE-MAXSIZE OPTIONAL
    *"     VALUE(I_INITFLAG) TYPE  SBIWA_S_INTERFACE-INITFLAG OPTIONAL
    *"     VALUE(I_UPDMODE) TYPE  SBIWA_S_INTERFACE-UPDMODE OPTIONAL
    *"     VALUE(I_DATAPAKID) TYPE  SBIWA_S_INTERFACE-DATAPAKID OPTIONAL
    *"     VALUE(I_PRIVATE_MODE) OPTIONAL
    *"     VALUE(I_CALLMODE) LIKE  ROARCHD200-CALLMODE OPTIONAL
    *"     VALUE(I_REMOTE_CALL) TYPE  SBIWA_FLAG DEFAULT SBIWA_C_FLAG_OFF
    *"  TABLES
    *"      I_T_SELECT TYPE  SBIWA_T_SELECT OPTIONAL
    *"      I_T_FIELDS TYPE  SBIWA_T_FIELDS OPTIONAL
    *"      E_T_DATA STRUCTURE  ZTRN_REC_TIME OPTIONAL
    *"      E_T_SOURCE_STRUCTURE_NAME OPTIONAL
    *"  EXCEPTIONS
    *"      NO_MORE_DATA
    *"      ERROR_PASSED_TO_MESS_HANDLER
    The input parameter I_DATAPAKID is not supported yet !
    Example: InfoSource containing TADIR objects
    Auxiliary Selection criteria structure
      DATA: l_s_select TYPE sbiwa_s_select.
    Maximum number of lines for DB table
      STATICS: l_maxsize TYPE sbiwa_s_interface-maxsize,
              S_S_IF TYPE SRSC_S_IF_SIMPLE,
              S_COUNTER_DATAPAKID LIKE SY-TABIX.
    Parameter I_PRIVATE_MODE:
    Some applications might want to use this function module for other
    purposes as well (e.g. data supply for OLTP reporting tools). If the
    processing logic has to be different in this case, use the optional
    parameter I_PRIVATE_MODE (not supplied by BIW !) to distinguish
    between BIW calls (I_PRIVATE_MODE = SPACE) and other calls
    (I_PRIVATE_MODE = X).
    If the message handling has to be different as well, define Your own
    messaging macro which interprets parameter I_PRIVATE_MODE. When
    called by BIW, it should use the LOG_WRITE macro, otherwise do what
    You want.
    Initialization mode (first call by SAPI) or data transfer mode
    (following calls) ?
      IF i_initflag = sbiwa_c_flag_on.
    Initialization: check input parameters
                    buffer input parameters
                    prepare data selection
    The input parameter I_DATAPAKID is not supported yet !
    Invalid second initialization call -> error exit
        IF NOT g_flag_interface_initialized IS INITIAL.
          IF 1 = 2. MESSAGE e008(r3). ENDIF.
          log_write 'E'                    "message type
                    'R3'                   "message class
                    '008'                  "message number
                    ' '                    "message variable 1
                    ' '.                   "message variable 2
          RAISE error_passed_to_mess_handler.
        ENDIF.
    Check InfoSource validity
        CASE i_isource.
          WHEN 'ZTRNREC_FM_DELTA'.
          WHEN OTHERS.
            IF 1 = 2. MESSAGE e009(r3). ENDIF.
            log_write 'E'                  "message type
                      'R3'                 "message class
                      '009'                "message number
                      i_isource            "message variable 1
                      ' '.                 "message variable 2
            RAISE error_passed_to_mess_handler.
        ENDCASE.
    Check for supported update mode
        CASE i_updmode.
          WHEN 'F'.
          WHEN 'D'.
          WHEN 'R'.
          WHEN OTHERS.
            IF 1 = 2. MESSAGE e011(r3). ENDIF.
            log_write 'E'                  "message type
                      'R3'                 "message class
                      '011'                "message number
                      i_updmode            "message variable 1
                      ' '.                 "message variable 2
            RAISE error_passed_to_mess_handler.
        ENDCASE.
    Check for obligatory selection criteria
        APPEND LINES OF i_t_select TO g_t_select.
    Fill parameter buffer for data extraction calls
        g_s_interface-requnr    = i_requnr.
        g_s_interface-isource   = i_isource.
        g_s_interface-maxsize   = i_maxsize.
        g_s_interface-initflag  = i_initflag.
        g_s_interface-updmode   = i_updmode.
        g_s_interface-datapakid = i_datapakid.
        g_flag_interface_initialized = sbiwa_c_flag_on.
    Fill field list table for an optimized select statement
    (in case that there is no 1:1 relation between InfoSource fields
    and database table fields this may be far from beeing trivial)
        APPEND LINES OF i_t_fields TO g_t_segfields.
      ELSE.                 "Initialization mode or data extraction ?
    Data transfer: First Call      OPEN CURSOR + FETCH
                   Following Calls FETCH only
      LOOP AT G_T_SELECT INTO L_S_SELECT
            WHERE FIELDNM = 'ZTIMESTAMP'.
      ENDLOOP.
          IF G_COUNTER_DATAPAKID = 0.
            IF L_S_SELECT-LOW = '' AND L_S_SELECT-HIGH = ''.
            OPEN CURSOR WITH HOLD G_CURSOR FOR
                SELECT (g_t_fields)
                FROM ZTRN_REC_TIME.
            ELSE.
              OPEN CURSOR WITH HOLD G_CURSOR FOR
                SELECT (g_t_fields)
                FROM ZTRN_REC_TIME
                WHERE ZTIMESTAMP >= L_S_SELECT-LOW
                  AND ZTIMESTAMP  <= L_S_SELECT-HIGH.
            ENDIF.
          ENDIF.
      FETCH NEXT CURSOR G_CURSOR
                   APPENDING CORRESPONDING FIELDS
                   OF TABLE E_T_DATA
                   PACKAGE SIZE S_S_IF-MAXSIZE.
        IF SY-SUBRC <> 0.
          CLOSE CURSOR G_CURSOR.
          RAISE NO_MORE_DATA.
        ENDIF.
        S_COUNTER_DATAPAKID = S_COUNTER_DATAPAKID + 1.
      ENDIF.
    ENDFUNCTION.
    I found some similar issue in this forum by link
    Generic Extractor Delta Function Module code, but still I could not get clear answer.
    Can you please help me:
    1)     why there is no value for i_source , how to fix it?
    2)     For the delta logic for ztimestemp, is it correct?
    3)     Need I modify the entries in ROOSOURCE ?
    Thanks a lot !!!

    Hello Andre,
            Thanks a lot for your help. I did some change , but still does not work. Could you please help check.
    Now the source code are the following, It's based on the RSAX_BIW_GET_DATA_SIMPLE, as you confirm that this also supply the update mode (full, initial delta, delta).
    FUNCTION RSAX_BIW_GET_DATA_TRAININGREC1.
    ""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
    *"     VALUE(I_REMOTE_CALL) TYPE  SBIWA_FLAG DEFAULT SBIWA_C_FLAG_OFF
    *"  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  ZTRN_REC_TIME OPTIONAL
    *"  EXCEPTIONS
    *"      NO_MORE_DATA
    *"      ERROR_PASSED_TO_MESS_HANDLER
    Auxiliary Selection criteria structure
      DATA: L_S_SELECT TYPE SRSC_S_SELECT.
    Maximum number of lines for DB table
      STATICS: S_S_IF TYPE SRSC_S_IF_SIMPLE,
    counter
              S_COUNTER_DATAPAKID LIKE SY-TABIX,
    cursor
              S_CURSOR TYPE CURSOR.
    Select ranges
    RANGES:
            L_R_ZTIMESTAMP FOR ZTRN_REC_TIME-ZTIMESTAMP.
    Initialization mode (first call by SAPI) or data transfer mode
    (following calls) ?
      IF I_INITFLAG = SBIWA_C_FLAG_ON.
    Initialization: check input parameters
                    buffer input parameters
                    prepare data selection
    Check DataSource validity
        CASE I_DSOURCE.
          WHEN 'ZTRNREC_FM'.
          WHEN OTHERS.
            IF 1 = 2. MESSAGE E009(R3). ENDIF.
    this is a typical log call. Please write every error message like this
            LOG_WRITE 'E'                  "message type
                      'R3'                 "message class
                      '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.
    Fill parameter buffer for data extraction calls
        S_S_IF-REQUNR    = I_REQUNR.
        S_S_IF-DSOURCE = I_DSOURCE.
        S_S_IF-MAXSIZE   = I_MAXSIZE.
    Fill field list table for an optimized select statement
    (in case that there is no 1:1 relation between InfoSource fields
    and database table fields this may be far from beeing trivial)
        APPEND LINES OF I_T_FIELDS TO S_S_IF-T_FIELDS.
      ELSE.                 "Initialization mode or data extraction ?
    Data transfer: First Call      OPEN CURSOR + FETCH
                   Following Calls FETCH only
    First data package -> OPEN CURSOR
        IF S_COUNTER_DATAPAKID = 0.
          LOOP AT S_S_IF-T_SELECT INTO L_S_SELECT WHERE FIELDNM = 'ZTIMESTAMP'.
          MOVE-CORRESPONDING L_S_SELECT TO L_R_ZTIMESTAMP.
          APPEND L_R_ZTIMESTAMP.
          ENDLOOP.
    Determine number of database records to be read per FETCH statement
    from input parameter I_MAXSIZE. If there is a one to one relation
    between DataSource table lines and database entries, this is trivial.
    In other cases, it may be impossible and some estimated value has to
    be determined.
         IF L_S_SELECT-LOW = '' AND L_S_SELECT-HIGH = ''.
            OPEN CURSOR WITH HOLD S_CURSOR FOR
            SELECT (S_S_IF-T_FIELDS)
            FROM ZTRN_REC_TIME.
            ELSE.
            OPEN CURSOR WITH HOLD G_CURSOR FOR
            SELECT (S_S_IF-T_FIELDS)
            FROM ZTRN_REC_TIME
            WHERE ZTIMESTAMP >= L_S_SELECT-LOW
            AND ZTIMESTAMP <= L_S_SELECT-HIGH.
         ENDIF.
        ENDIF.                             "First data package ?
    Fetch records into interface table.
      named E_T_'Name of extract structure'.
        FETCH NEXT CURSOR S_CURSOR
                   APPENDING CORRESPONDING FIELDS
                   OF TABLE E_T_DATA
                   PACKAGE SIZE S_S_IF-MAXSIZE.
        IF SY-SUBRC <> 0.
          CLOSE CURSOR S_CURSOR.
          RAISE NO_MORE_DATA.
        ENDIF.
        S_COUNTER_DATAPAKID = S_COUNTER_DATAPAKID + 1.
      ENDIF.              "Initialization mode or data extraction ?
    ENDFUNCTION.
    I think it already includes the important statements you suggested.
    I test this FM in RSA3, for the Full load mode, it works fine. Also if I checked the debug mode in execution , it will stop in the code and let me debug.
    But when I choose other mode, like 'initializion of the delta transfer'  or simulation of initial delta, I always get error 'error occurs  during the extraction' .. even I choose debug mode, but it could not enter the code for debug..
    Till now I did not see any parameter or value for the upload mode..
    Another questions is that, in RSO2, I define Ztimestamp as my delta field.. But , can I add other field as selection condition in the datasource definition, and has its range table in this function module ?
    Should I change the entries in ROOSOURCE for this datasource ??
    Please let me know your feedback, do you have some concret example for generic delta extraction ?
    Thanks a lot !

  • Workbook not refreshing dynamically through Function Module.

    We have a workbook with multiple queries having common variable set.
    we are trying to execute workbook from program, using the function module RSAH_LAUNCH_EXCEL. Also we are trying to assign variable values manually.
    through the program, the workbook is getting executed but if i change the variable values inside the program manually, workbook is not getting refreshed. can someone help us.
    the below is the code
    REPORT  ztest.
    DATA: v_workbookid TYPE rsrwbindex-workbookid,
          v_subrc TYPE sy-subrc,
          ls_var TYPE rrx_var,
          lt_var TYPE STANDARD TABLE OF rrx_var.
    v_workbookid = 'D0C1TB5M99SDPACEG070AFU88'.
    ls_var-vnam = 'ZTEST_EXPORT'.
    ls_var-vartyp = '1'.
    ls_var-vparsel = 'P'.
    ls_var-sign = 'I'.
    ls_var-opt  = 'EQ'.
    ls_var-low  = '10008891'.
    ls_var-iobjnm = '0BPARTNER'.
    APPEND ls_var TO lt_var.
    CALL FUNCTION 'RSAH_LAUNCH_EXCEL'
        EXPORTING
         i_genuniid                       = lv_genuniid
          i_workbookid                     = v_workbookid
          i_objvers                        = 'A'
         i_hide_sapgui                    = 'X'
    IMPORTING
        e_subrc =           v_subrc
        TABLES
          i_t_var                          = lt_var.
    Thanks

    Did you create your function module without problems...assigned the Z* function group? activate the function module? i assume that you copy the function module code and the variables definition on TOP include of RSAX_BIW_GET_DATA_SIMPLE
    Regards
    Message was edited by:
            Oscar Díaz

  • Function Module Extraction from KONV Table taking lot of time for extractio

    Hi
    I have a requirement wherein i need to get records from KONV Table (Conditions (Transaction Data) ). i need the data corresponding to Application (KAPPL) = 'F'.
    For this i had written one function module but it is taking lot of time (@ 2.5 hrs) for fetching records as there are large number of records in KONV Table.
    I am pasting the Function Module code for reference.
    <b>kindly guide me as to how the extraction performance can be improved.</b>
    <b>Function Module Code:</b>
    FUNCTION ZBW_SHPMNT_COND.
    ""Local interface:
    *"  IMPORTING
    *"     VALUE(I_REQUNR) TYPE  SBIWA_S_INTERFACE-REQUNR
    *"     VALUE(I_ISOURCE) TYPE  SBIWA_S_INTERFACE-ISOURCE OPTIONAL
    *"     VALUE(I_MAXSIZE) TYPE  SBIWA_S_INTERFACE-MAXSIZE OPTIONAL
    *"     VALUE(I_INITFLAG) TYPE  SBIWA_S_INTERFACE-INITFLAG OPTIONAL
    *"     VALUE(I_UPDMODE) TYPE  SBIWA_S_INTERFACE-UPDMODE OPTIONAL
    *"     VALUE(I_DATAPAKID) TYPE  SBIWA_S_INTERFACE-DATAPAKID OPTIONAL
    *"     VALUE(I_PRIVATE_MODE) OPTIONAL
    *"     VALUE(I_CALLMODE) LIKE  ROARCHD200-CALLMODE OPTIONAL
    *"  TABLES
    *"      I_T_SELECT TYPE  SBIWA_T_SELECT OPTIONAL
    *"      I_T_FIELDS TYPE  SBIWA_T_FIELDS OPTIONAL
    *"      E_T_DATA STRUCTURE  ZBW_SHPMNT_COND OPTIONAL
    *"      E_T_SOURCE_STRUCTURE_NAME OPTIONAL
    *"  EXCEPTIONS
    *"      NO_MORE_DATA
    *"      ERROR_PASSED_TO_MESS_HANDLER
    The input parameter I_DATAPAKID is not supported yet !
      TABLES: KONV.
    Auxiliary Selection criteria structure
      DATA: l_s_select TYPE sbiwa_s_select.
    Maximum number of lines for DB table
      STATICS: l_maxsize TYPE sbiwa_s_interface-maxsize.
    Maximum number of lines for DB table
      STATICS: S_S_IF TYPE SRSC_S_IF_SIMPLE,
    counter
              S_COUNTER_DATAPAKID LIKE SY-TABIX,
    cursor
              S_CURSOR TYPE CURSOR.
    Select ranges
      RANGES: L_R_KNUMV  FOR KONV-KNUMV,
              L_R_KSCHL  FOR KONV-KSCHL,
              L_R_KDATU  FOR KONV-KDATU.
    Declaring internal tables
    DATA : I_KONV LIKE KONV OCCURS 0 WITH HEADER LINE.
      DATA : Begin of I_KONV occurs 0,
             MANDT LIKE konv-mandt,
             KNUMV LIKE konv-knumv,
             KPOSN LIKE konv-kposn,
             STUNR LIKE konv-stunr,
             ZAEHK LIKE konv-zaehk,
             KAPPL LIKE konv-kappl,
             KSCHL LIKE konv-kschl,
             KDATU LIKE konv-kdatu,
             KBETR LIKE konv-kbetr,
             WAERS LIKE konv-waers,
             END OF I_KONV.
    Initialization mode (first call by SAPI) or data transfer mode
    (following calls) ?
      IF i_initflag = sbiwa_c_flag_on.
    Initialization: check input parameters
                    buffer input parameters
                    prepare data selection
    The input parameter I_DATAPAKID is not supported yet !
    Invalid second initialization call -> error exit
        IF NOT g_flag_interface_initialized IS INITIAL.
          IF
            1 = 2.
            MESSAGE e008(r3).
          ENDIF.
          log_write 'E'                    "message type
                    'R3'                   "message class
                    '008'                  "message number
                    ' '                    "message variable 1
                    ' '.                   "message variable 2
          RAISE error_passed_to_mess_handler.
        ENDIF.
    Check InfoSource validity
        CASE i_isource.
          WHEN 'X'.
         WHEN 'Y'.
         WHEN 'Z'.
          WHEN OTHERS.
           IF 1 = 2. MESSAGE e009(r3). ENDIF.
           log_write 'E'                  "message type
                     'R3'                 "message class
                     '009'                "message number
                     i_isource            "message variable 1
                     ' '.                 "message variable 2
           RAISE error_passed_to_mess_handler.
        ENDCASE.
    Check for supported update mode
        CASE i_updmode.
    For full upload
          WHEN 'F'.
          WHEN 'D'.
          WHEN OTHERS.
           IF 1 = 2. MESSAGE e011(r3). ENDIF.
           log_write 'E'                  "message type
                     'R3'                 "message class
                     '011'                "message number
                     i_updmode            "message variable 1
                     ' '.                 "message variable 2
           RAISE error_passed_to_mess_handler.
        ENDCASE.
        APPEND LINES OF i_t_select TO g_t_select.
    Fill parameter buffer for data extraction calls
        g_s_interface-requnr    = i_requnr.
        g_s_interface-isource   = i_isource.
        g_s_interface-maxsize   = i_maxsize.
        g_s_interface-initflag  = i_initflag.
        g_s_interface-updmode   = i_updmode.
        g_s_interface-datapakid = i_datapakid.
        g_flag_interface_initialized = sbiwa_c_flag_on.
    Fill field list table for an optimized select statement
    (in case that there is no 1:1 relation between InfoSource fields
    and database table fields this may be far from beeing trivial)
        APPEND LINES OF i_t_fields TO g_t_fields.
    Interpretation of date selection for generic extraktion
       CALL FUNCTION 'RSA3_DATE_RANGE_CONVERT'
         TABLES
           i_t_select = g_t_select.
      ELSE.                 "Initialization mode or data extraction ?
       CASE g_s_interface-updmode.
         WHEN 'F' OR 'C' OR 'I'.
    First data package -> OPEN CURSOR
        IF g_counter_datapakid = 0.
       L_MAXSIZE = G_S_INTERFACE-MAXSIZE.
          LOOP AT g_t_select INTO l_s_select WHERE fieldnm = 'KNUMV'.
            MOVE-CORRESPONDING l_s_select TO l_r_knumv.
            APPEND l_r_knumv.
          ENDLOOP.
          LOOP AT g_t_select INTO l_s_select WHERE fieldnm = 'KSCHL'.
            MOVE-CORRESPONDING l_s_select TO l_r_kschl.
            APPEND l_r_kschl.
          ENDLOOP.
          Loop AT g_t_select INTO l_s_select WHERE fieldnm = 'KDATU'.
            MOVE-CORRESPONDING l_s_select TO l_r_kdatu.
            APPEND l_r_kdatu.
          ENDLOOP.
    *In case of full upload
    Fill field list table for an optimized select statement
    (in case that there is no 1:1 relation between InfoSource fields
    and database table fields this may be far from beeing trivial)
       APPEND LINES OF I_T_FIELDS TO S_S_IF-T_FIELDS.
          OPEN CURSOR G_CURSOR FOR
            SELECT MANDT
                   KNUMV
                   KPOSN
                   STUNR
                   ZAEHK
                   KAPPL
                   KSCHL
                   KDATU
                   KBETR
                   WAERS
            FROM   KONV
            WHERE KNUMV IN l_r_knumv
            AND   KSCHL IN l_r_kschl
            AND   KDATU IN l_r_kdatu
            AND   KAPPL EQ 'F'.
        ENDIF.
        Refresh I_KONV.
        FETCH NEXT CURSOR G_CURSOR
                   APPENDING CORRESPONDING FIELDS OF TABLE I_KONV
                   PACKAGE SIZE S_S_IF-MAXSIZE.
        IF SY-SUBRC <> 0.
          CLOSE CURSOR G_CURSOR.
          RAISE NO_MORE_DATA.
        ENDIF.
        LOOP AT I_KONV.
         IF I_KONV-KAPPL EQ 'F'.
          CLEAR :E_T_DATA.
          E_T_DATA-MANDT = I_KONV-MANDT.
          E_T_DATA-KNUMV = I_KONV-KNUMV.
          E_T_DATA-KPOSN = I_KONV-KPOSN.
          E_T_DATA-STUNR = I_KONV-STUNR.
          E_T_DATA-ZAEHK = I_KONV-ZAEHK.
          E_T_DATA-KAPPL = I_KONV-KAPPL.
          E_T_DATA-KSCHL = I_KONV-KSCHL.
          E_T_DATA-KDATU = I_KONV-KDATU.
          E_T_DATA-KBETR = I_KONV-KBETR.
          E_T_DATA-WAERS = I_KONV-WAERS.
          APPEND E_T_DATA.
       ENDIF.
        ENDLOOP.
        g_counter_datapakid = g_counter_datapakid + 1.
      ENDIF.
    ENDFUNCTION.
    Thanks in Advance
    Regards
    Swapnil.

    Hi,
    one option to investigate is to select the data with a condition on KNUMV (primary IDX).
    Since shipment costs are store in VFKP I would investigate if all your F condition records are used in this table (field VFKP-KNUMV).
    If this is the case then something like
    SELECT *
    FROM KONV
    WHERE KNUMV IN (SELECT DISTINCT KNUMV FROM VFKP)
    or
    SELECT DISTINCT KNUMV
    INTO CORRESPONDING FIELD OF <itab>
    FROM VFKP
    and then
    SELECT *
    FROM KONV
    FOR ALL ENTRIES IN <itab>
    WHERE...
    will definitively speed it up.
    hope this helps....
    Olivier

  • Table used in function module

    Hi,
    As I am programming ABAP for the first time I have a question which I think is pretty basic.
    I have created a function module Z_POPUP_GET_VALUES which calls the function POPUP_GET_VALUES. I got some sample code from another forum post and it defines a table name and fieldname. But I am not sure what this table is suppose to be (or do)? Is it an ABAP dictionary table? If so, how do I create one based on the characteristic I want to display??
    The implemented code is as follows:
    DATA: i_sval Like sval occurs 1 with Header Line.
    data: v_subrc like sy-subrc.
    i_sval-tabname =
    i_sval-fieldname = '?????'.i_sval-fieldtext = 'Eiendelsområde'.
    i_sval-field_obl = 'X'.
    append i_sval.
    CALL FUNCTION 'POPUP_GET_VALUES'
    EXPORTING
    NO_VALUE_CHECK = ' '
    POPUP_TITLE = 'Asset Area'
    START_COLUMN = '5'
    START_ROW = '5'
    IMPORTING
    RETURNCODE = v_subrc
    TABLES
    FIELDS = i_sval
    EXCEPTIONS
    ERROR_IN_FIELDS = 1
    OTHERS = 2.
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    All help appreciated!
    Best regards,
    TM

    Hi,
    Tables in function modules are parameter to that function module.
    That can be processed when the function module code is called.
       and the result can be stored in the tables.
    Tables have a structure like ABAP Dictionary structure .ie. You will be
    define the table type as a dictionary table.
    Regards,
    <b>Ramganesan K</b>

  • Unknown table type in function module

    Hello,
    i try to create a function module, which has one internal table as a result table. The structure is unknown during design time, because the table has the structure like a range table, therefor the fieldtype of the 'low and high' values, depends on the declaration of the calling programm, and is not knowing in the function module during design time.
    The function module load the results of a DDIC-Customizingtable and shell fill the sign, option, low and high field of the result table.
    Is there anybody with an idea how to solve this.
    Thanks in advance
    Michael

    For example.....  here is a program which calls the function module.  Notice that ITAB in the TABLES section is not defined.
    Program Code.
    report zrich_0002.
    ranges: r_datum for sy-datum.
    call function 'Z_TEST'
         tables
              itab = r_datum.
    check sy-subrc  = 0.
    Function Module Code.
    function z_test.
    *"*"Local interface:
    *"  TABLES
    *"      ITAB
    * Fill with data
      itab = 'IBT2006010399991231'.
      append itab.
    endfunction.
    Regards,
    Rich HEilman

  • Function Module creation in 4.6C

    Hi techies,
    I am not an ABAPer, but just copying Function Module code from 3.1 R/3 to 4.6C R/3.
    In 3.1, for the Table Parameter "E_DATA", there are two columns 'Reference Structure' and 'Reference type'. Since I am using the structure 'ZBFNEW', it looks following:
    <u>Table parameters   Ref. structure     Reference Type</u>     E_DATA                ZBFNEW    -                                                         Now same thing I wanted to do in 4.6C, but there under table parameter tab, there are no field called 'Ref Structure. The column are: Parameter Name, Type Specification and Reference type.
    So the question is How do I assign Structure in FM for Table parameter. In coulmn, i tried with all the options (Type, LIKE and TYPE Ref To), but it gives error "Only table types may be used as the reference type for a table parameter"
    Any suggestion guys???
    Regards, Pankaj

    Rich's suggestion should work for you.  The message you are receiving
    is in regards to a new feature in 4.6 that did not exist in 3.1.  Using SE11,
    you can define an internal table definition in the Dictionary. 
    Put the new table definition name next to structures.  Hit create and you
    will be asked about what you are creating.  Pick the Table Type option. For example,
    you could create a table type definition called Z_T_ZBFNEW, based on
    structure ZBFNEW.  Then you would use the TYPE setting for your table,
    setting it to TYPE Z_T_ZBFNEW.
    As an aside, the TABLE parameter tab is considered to be
    obsolete in 4.6.  You can now pass tables using the
    EXPORTING, IMPORTING and CHANGING parameters.  So if/when you start
    coding new Function Modules, I suggest you stop using the
    TABLE parameter tab.
    Just curious, how does a non-ABAPer get assigned the task to copy
    Function Modules?  Keep smiling and good luck!
    Message was edited by: Charles Folwell

  • Functional Module Extractor not pulling all the record on BW side

    Hi,
    i have written a FM extractor to pull data from CDHDR and CDPOS table. the Records count shows on RSA3 is more than 3,00,000 but while pulling it on BW side it brings only 41,000  Around records.
    I steps i have taken is -
    tried setting and resetting the package side in Info package.
    Tried putting the default package size to 50K in FM setting
    but nothing is working.
    It seems like the pacet size is not incrementing in the code. i have tired to find ou the fault but coult not and RSA3 is working fine.
    can anyone please suggest a correct piece of code or find out where exactly the fault is?

    Vikrant,
    The structure of your generic extractor function module should be something like:
    If initialisation
      Store parameters, clear packet count
    Else
      If first packet
        Create cursor
      Endif
      Read block of records from cursor
      If cursor returns no more records
        Raise NO_MORE_DATA exception
      Endif
      Process records from cursor and output
      Add one to packet count
    Endif
    This function module code can get called repeatedly.  Possibly you are only extracting data for the first packet?
    Mark

  • Function Module Failing in Run Time

    Hello Friend. Thanks to SDN to get this FM created , but still i have some more issues.  I copied the function module RSAX_BIW_GET_DATA_SIMPLE using SE80 TO Z_CUSTOMERB and also the Function Group I copied from RSAX TO ZCUSTB in SE80 ABAP area.
    <b>Error in SE80 FOR Function Group ZCUSTB: Main program Z_CUSTOMERB does not begin with Function-Pool
    please edit my code and let me know how to fix the code to include FUNCTION-POOL</b>
    But when i go to se37 Activated the FM Z_CUSTOMER and check for any syntax error in FM source code it give no error. But when i run the function module using my datasource rsa3 or execute FM then i get the dump
    dump reasons stated.
    1. FM Z_CUSTOMER is not active and hence cannot be found during run time
    2. Function Library contains incorrect entry for Z_CUSTOMERB
    3. Function Module contains no Code even the FUNCTION ... ENDFUNCTION Missing.
    I checked the code and no errors. Please suggest what should I change in FM Setting to fix the error. where is the function library
    Please revise my code to make it work its very simple logic to populate the custom table se11 ZBW_SFLI001_DS to get the data fields from KNA1 and then fetch other fields from KNB1 where KNA1-KUNNR = KNB1 KUNNR.
    Function Module Code
    FUNCTION Z_CUSTOMERB.
    ""Local Interface:
    *" IMPORTING
    *" VALUE(I_REQUNR) TYPE SRSC_S_IF_SIMPLE-REQUNR OPTIONAL
    *" 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
    *" VALUE(I_REMOTE_CALL) TYPE SBIWA_FLAG DEFAULT SBIWA_C_FLAG_OFF
    *" 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 ZBW_SFLI001_DS OPTIONAL
    *" EXCEPTIONS
    *" NO_MORE_DATA
    *" ERROR_PASSED_TO_MESS_HANDLER
    TABLES: KNA1, KNB1.
    DATA: L_S_SELECT TYPE SRSC_S_SELECT.
    STATICS: S_S_IF TYPE SRSC_S_IF_SIMPLE,
    S_COUNTER_DATAPAKID LIKE SY-TABIX,
    S_CURSOR TYPE CURSOR.
    RANGES: l_r_zcalweek FOR ZBW_SFLI001_DS-ZCALWEEK,
    l_r_ZKUNNR FOR ZBW_SFLI001_DS-ZKUNNR.
    RANGES: l_r_ERDAT FOR KNA1-ERDAT.
    DATA: zweek LIKE ZBW_SFLI001_DS-ZCALWEEK.
    DATA: ZKNA1 LIKE KNA1 OCCURS 0 WITH HEADER LINE.
    DATA: ZKNB1 LIKE KNB1 OCCURS 0 WITH HEADER LINE.
    DATA: zitab LIKE ZBW_SFLI001_DS OCCURS 0 WITH HEADER LINE.
    IF I_INITFLAG = SBIWA_C_FLAG_ON.
    CASE I_DSOURCE.
    WHEN 'ZBW_SFLI001_DS'.
    WHEN OTHERS.
    IF 1 = 2. MESSAGE E009(R3). ENDIF.
    LOG_WRITE 'E' "message type
    'R3' "message class
    '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.
    s_s_if-requnr = I_REQUNR. "Step (B)
    s_s_if-dsource = I_DSOURCE. "Step (B)
    s_s_if-maxsize = I_MAXSIZE. "Step (B)
    APPEND LINES OF I_T_FIELDS TO s_s_if-t_fields. "Step (B)
    ELSE. "Initialization mode or data extraction ?
    IF s_counter_datapakid = 0. "Step (C)
    "Begin of Step (D)
    LOOP AT s_s_if-t_select INTO l_s_select WHERE FIELDNM = 'ZCALWEEK'.
    MOVE-CORRESPONDING l_s_select TO l_r_zcalweek.
    APPEND l_r_zcalweek.
    ENDLOOP.
    LOOP AT s_s_if-t_select INTO l_s_select WHERE FIELDNM = 'ZKUNNR'.
    MOVE-CORRESPONDING l_s_select TO l_r_ZKUNNR.
    APPEND l_r_ZKUNNR.
    ENDLOOP.
    LOOP AT l_r_zcalweek.
    CASE l_r_zcalweek-option.
    WHEN 'EQ'.
    CALL FUNCTION 'WEEK_GET_FIRST_DAY'
    EXPORTING
    WEEK = l_r_zcalweek-low
    IMPORTING
    DATE = l_r_ERDAT-low
    EXCEPTIONS
    WEEK_INVALID = 1
    OTHERS = 2.
    l_r_ERDAT-high = l_r_ERDAT-low + 7.
    l_r_ERDAT-sign = 'I'.
    l_r_ERDAT-option = 'BT'.
    APPEND l_r_ERDAT.
    when 'BT'.
    zweek = l_r_zcalweek-low.
    WHILE zweek <= l_r_zcalweek-high.
    CALL FUNCTION 'WEEK_GET_FIRST_DAY'
    EXPORTING
    WEEK = zweek
    IMPORTING
    DATE = l_r_ERDAT-low
    EXCEPTIONS
    WEEK_INVALID = 1
    OTHERS = 2.
    l_r_ERDAT-high = l_r_ERDAT-low + 7.
    l_r_ERDAT-sign = 'I'.
    l_r_ERDAT-option = 'BT'.
    APPEND l_r_ERDAT.
    zweek = zweek + 1.
    ENDWHILE.
    ENDCASE.
    ENDLOOP.
    DELETE FROM ZBW_SFLI001_DS "Step (E)
    WHERE ZREQUNR = s_s_if-requnr.
    SELECT * FROM KNA1 "Step (F)
    INTO TABLE ZKNA1
    WHERE ERDAT IN l_r_ERDAT
    AND KUNNR IN l_r_ZKUNNR.
    SELECT * FROM KNB1 "Step (F)
    INTO TABLE ZKNB1
    FOR ALL ENTRIES IN ZKNA1
    WHERE KUNNR = ZKNA1-KUNNR
    AND ERDAT = ZKNA1-ERDAT.
    LOOP AT ZKNA1.
    zitab-zrequnr = s_s_if-requnr.
    CALL FUNCTION 'DATE_GET_WEEK'
    EXPORTING
    DATE = ZKNA1-ERDAT
    IMPORTING
    WEEK = zitab-zcalweek
    EXCEPTIONS
    DATE_INVALID = 1
    OTHERS = 2.
    zitab-ZKUNNR = ZKNA1-KUNNR.
    zitab-ZREGIO = ZKNA1-REGIO.
    zitab-ZFAKSD = ZKNA1-FAKSD.
    READ TABLE ZKNB1 WITH KEY KUNNR = ZKNA1-KUNNR
    ERDAT = zKNA1-ERDAT.
    IF sy-subrc = 0.
    zitab-ZZTERM = ZKNB1-ZTERM.
    ELSE.
    zitab-ZZTERM = 'NULL'.
    ENDIF.
    zitab-ZAKONT = ZKNB1-AKONT.
    ENDLOOP.
    INSERT ZBW_SFLI001_DS FROM TABLE zitab.
    OPEN CURSOR WITH HOLD s_cursor FOR "Step (I)
    SELECT (S_S_IF-T_FIELDS) FROM ZBW_SFLI001_DS
    WHERE zrequnr = s_s_if-requnr.
    ENDIF.
    FETCH NEXT CURSOR s_cursor "Step (J)
    APPENDING CORRESPONDING FIELDS
    OF TABLE E_T_DATA
    PACKAGE SIZE S_S_IF-MAXSIZE.
    IF SY-SUBRC <> 0. "Step (K)
    CLOSE CURSOR S_CURSOR. "Step (L)
    DELETE FROM zbw_sfli001_ds "Step (M)
    WHERE zrequnr = s_s_if-requnr.
    RAISE NO_MORE_DATA. "Step (N)
    ENDIF.
    s_counter_datapakid = s_counter_datapakid + 1. "Step (O)
    ENDIF.
    ENDFUNCTION.
    null

    In the top include for the function group, ensure that the first line is:
    FUNCTION-POOL Z_MY_GROUP.
    Where Z_MY_GROUP is the actual name of the actual function group that your actual function module belongs to.
    Rob

  • Extractor based on function module

    I have create an extractor based on
    A function module: ZSALESTEXT_EXTRACT
    Extract structure: ZOXDT20030
    When I execute this extractor on debug mode, as the function module ZSALESTEXT_EXTRACT is called I have a short dump with the following message:
    Since the caller of the procedure could not have expected this exception    
    to occur, the running program was terminated.                              
    The reason for the exception is:                                            
    When calling the function module "ZSALESTEXT_EXTRACT", one of the parameters
    needed according to the interface description was not specified.                                                                               
    This parameter was "E_T_DATA".                                              
    Do you know what's happen ?
    Many thanks
    Annexe Function module code :
    FUNCTION ZSALESTEXT_EXTRACT.
    ""Local interface:
    *"  TABLES
    *"      E_T_DATA STRUCTURE  ZOXDT20030
    *"      SELECTION STRUCTURE  RSSELECT
    Data: D_NAME LIKE THEAD-TDNAME,
    d_vbeln like vbap-vbeln,
    d_posnr like vbap-posnr,
    d_date1 like vbap-aedat,
    d_date2 like vbap-aedat,
    TRESULT LIKE TLINE occurs 1 with header line.
    *internal table
    Types: BEGIN OF SalesTextTable,
             VBELN Like VBAP-VBELN,
             POSNR  Like VBAP-POSNR,
             TextMST    Like TLINE-TDLINE,
             TextKPI    Like TLINE-TDLINE,
           END OF SalesTextTable.
    *Tables:   Like SalesTextTable with header line.
    DATA: ITAB TYPE TABLE OF SalesTextTable with header line
          WITH KEY              VBELN
                                POSNR,
          WA_ITAB LIKE LINE OF ITAB.
    LOOP AT SELECTION WHERE FIELDNM EQ 'DATE1'.
      d_date1 = SELECTION-LOW.
    ENDLOOP.
    LOOP AT SELECTION WHERE FIELDNM EQ 'DATE2'.
      d_date2 = SELECTION-LOW.
    ENDLOOP.
    Select VBELN POSNR
      into corresponding fields of table ITAB
      from VBAP
      where AEDAT between d_date1 and d_date2.
    Loop at ITAB into WA_ITAB.
    Concatenate WA_ITAB-VBELN WA_ITAB-POSNR into d_name.
    *     Material Sales Text
    CALL FUNCTION 'ZSALES_ORDER_TEXT_BW'
      EXPORTING
      CLIENT                        = SY-MANDT
        ID                            = '0001'
        LANGUAGE                      = 'E'
        NAME                          = d_name
        OBJECT                        = 'VBBP'
      TABLES
        LINES                         = TRESULT.
    If sy-subrc = 0.
      Read table TRESULT index 1.
    E_T_DATA-TextMST = TRESULT-TDLINE.
      refresh TRESULT.
      clear TRESULT.
    endif.
    *     KPI Comment
    CALL FUNCTION 'ZSALES_ORDER_TEXT_BW'
      EXPORTING
      CLIENT                        = SY-MANDT
        ID                            = 'Z004'
        LANGUAGE                      = 'E'
        NAME                          = d_name
        OBJECT                        = 'VBBP'
      TABLES
        LINES                         = TRESULT.
    If sy-subrc = 0.
    Read table TRESULT index 1.
    E_T_DATA-TextKPIC = TRESULT-TDLINE.
       clear TRESULT.
    endif.
    E_T_DATA-SALES_ORDER = WA_ITAB-VBELN.
    E_T_DATA-SALES_ITEM = WA_ITAB-POSNR.
    Append E_T_DATA.
    endloop.
    ENDFUNCTION.

    This FM does not have the correct import parameters. Have a look at RSAX_BIW_GET_DATA_SIMPLE.
    FUNCTION RSAX_BIW_GET_DATA_SIMPLE.
    ""Lokale Schnittstelle:
    *"  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
    *"     VALUE(I_REMOTE_CALL) TYPE  SBIWA_FLAG DEFAULT SBIWA_C_FLAG_OFF
    *"  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  SFLIGHT OPTIONAL
    *"  EXCEPTIONS
    *"      NO_MORE_DATA
    *"      ERROR_PASSED_TO_MESS_HANDLER
    Your FM will be called from the service API and must have the same parameters as this same FM.
    Cheers
    Aneesh

  • Unable to send table to function module using RFC

    Hi all,
    I'm trying to send a table from XI to a function module using RFC. I tested the process first using indivdual parameters. At this point there were no problems. Now I changed the import parameter of
    the FM into a table and imported the changes into XI. I changed the Message mapping and tested it with multiple records. When I run the process XI calls the FM but the FM doesn't receive any data. I tested this by puting a break-point in the FM. There are no errors in the XML Messages Monitor. I found this message in the Communication Channel Monitoring:
    Short Log:
    Server 0 10_39293 Receiver channel 'CC_BackendIn' for party '', service 'BS_Backend' (internal name 'RfcClient[CC_BackendIn]')
    Client data: {jco.client.lang=EN, jco.client.snc_mode=0, jco.client.client=610, jco.client.passwd=******, jco.webas.ignore_jdsr_error=1, jco.client.user=Admin, jco.client.sysnr=10, jco.client.ashost=192.168.51.8}
    Repository data: {jco.client.lang=EN, jco.client.snc_mode=0, jco.client.client=610, jco.client.passwd=******, jco.webas.ignore_jdsr_error=1, jco.client.user=Admin, jco.client.sysnr=10, jco.client.ashost=192.168.51.8}
    Current pool size: 0, maximum pool size : 1
    Channel History
    - OK: 2009-02-18 01:35:14 CET: Message processed for interface MIIA_BapiIn
    Any ideas?
    Thanks for your help!
    Regards,
    Ivo van Ee

    Hi everyone,
    thanks for your prompt response! I tested the mapping in XI and didn't find any error here. So I concentrated on the receiver side. There were some communication channels running on the server that were generating errors. I stopped alle the communication channels and started just the two communication channels for this process. This time the table was successfully exported to the function module! Problem solved. Still not sure what caused the problem in the first place, but everything is working fine now.
    Thanks for your help.
    Regards,
    Ivo

Maybe you are looking for