Multiple calls of same function module do NOT initialize variables ?

Hi all,
..so its my fist post here, this is a bit strange problem for me and maybe someone knows whats happening.
So I have in SAP Solution Manager a function module 'Z', which calls a standard SAP class CL_SPROJECT_SOLAR_BASE_REPORT, which in turn calls the standard function module 'SPROJECT_GET_ADMIMP_SCREEN_BP'.
During development, things worked fine, but now I run my Z-Program for more than one instance and even I do all FREE for the Class, apperently the function module SPROJECT_GET_ADMIMP_SCREEN_BP, which is called by the class CL_SPROJECT_SOLAR_BASE_REPORT, does not get it's variables from the global data of the function pool re-initialized, when it is called for the second, 3rd, ... time.
This is a bit strane behavior for me, I would have expected that variables in a function module (or even in the global data of that function pool) get re-initialized each time that function module is called ?
Actually, this is the only function in that function pool.
Well, if not, does anyone has an idea how I can get the variables of this module pool re-initialized between the calls ? More concrete, the global data of function pool SAPLSPROJECT_SOLAR_ADMEVAL_BP define:
DATA: g_v_with_var TYPE char1.
In the function module line 36 (no reference to g_v_with_var, no module call, no changes to g_v_with_var before the IF-statement at all) it is querying:
  IF g_v_with_var IS INITIAL.
So this is my problem, the second time I am calling the class  (which is 'free'ed and re-created between the calls) which calls this function module the 'g_v_with_var' is not initial and there seems to be no way to have it set to initial again ?
So even thought this is in SolMan, I think the question & problem is a ABAP technical one ?
Any thoughts, help or support would be very much appreciated,
thank so much,
Frank

Hi Mae,
..thanks a lot for your fast reply, unfortunately there is only one function and no functions or forms at all for initializing. The variable I am fighting with is g_v_with_var and that is referenced only 4 times in the whole function pool:
Global Data:   101 DATA: g_v_with_var TYPE char1.
Function Module SPROJECT_GET_ADMIMP_SCREEN_BP (which is the only function module):
    36   IF g_v_with_var IS INITIAL.
   127       g_v_with_var = airep_true.
   193         CLEAR g_v_with_var.
If in line 36 g_v_with_var is 'X', which it is always after the first call, the function will exit with an exception, so line 193 to clear it will actually never be executed...and it is not cleared  the next time the function module is called, so you never get back to have the function run...
All the best,
Frank

Similar Messages

  • Multiple call of update function module

    Hi Everybody,
    I have made implementation to the definition MB_DOCUMENT_BADI( material Document creation).
    While executing this BADI I am getting short dum with this error  Multiple call of update function module.
    Here is the short dump--
    In the FORM routine Buchen_Ausfuehren (program SAPMM07M), an error
    message was issued by a Business Add-In (BAdI) or function module.
    This is not permitted, because it could lead to data             
    inconsistencies. For this reason, the update of the material     
    document was also terminated with a termination message (dump).  
    Note that this message (M7 372) is not the responsible error     
    message.                                                         
    Please any body suggest the way forward.
    Regards,
    Sandeep.

    Hi Kiran,
    Thanks for the reply.
    I have created one implementation to the BADI MB_DOCUMENT_BADI. This badi will hit while creation of material document.I have write the code in method MB_DOCUMENT_BEFORE_UPDATE such that it will act only for certain movement types specially for t-codeMb1a and MB31.
    What problem I am facing i have used a error message "MB_DOCUMENT_BEFORE_UPDATE" in this method.If we got the erroe message then we dont need to post the material dcoument,but here problem is that if the material document could not posted then it corrupt the material and when we performing 261/101 we got error message like " Inconsistency between MM and ML for material and plant"
    I have used following things like-
    1-while updating the customized table using " Commit Work".
    2-Call function vb_change_batch for updating the batch and not in update task.
    3. Dequeue the table after updating the table.
    Will thos things can create any inconsistency to  the MM and ML.
    Please suggest me uor thoughts.
    Thanks
    sandeep.
    Thanks ,
    sandeep.

  • User Exit for Variable which calls to a Function Module is NOT working ???

    Hi all,
        I have a created a variable 'ZNBUSDAY' with Processing Type 'Customer Exit' on 0SCL_DELDAT  (Date). The query is on 0PUR_C04 and passing 0SCL_DELDAT  to Function Module  Z_WORKDAY to get the Next Business Day by using the company Calendar(30). The following code is NOT working and what is WRONG with it, PLEASE? The FM is working FINE.
    DATA: wa_calendar(2) TYPE c value '30',
          wa_znbusday    like sy-datum,
          0scl_deldat    like sy-datum,
          p_days         TYPE i value 1.
    case i_vnam.
       when 'ZNBUSDAY'.
       CLEAR wa_znbusday.
       CALL FUNCTION 'Z_WORKDAY'
         EXPORTING
         CURR_DATE        = 0scl_deldat
         NUMBER_DAYS      = p_days
         CALENDAR         = wa_calendar
       IMPORTING
         WORK_DAY         = wa_znbusday
         l_s_range-low  = wa_znbusday.
         l_s_range-opt  = 'EQ'.
         l_s_range-sign = 'I'.
         append l_s_range to e_t_range.
    endcase.
    Thanks,
    Venkat.

    Hi Venkat,
    Looks like you're only assigning type sy-datum to 0scl_deldat but not the actual value. Try the following:
    DATA: wa_calendar(2) TYPE c value '30',
          wa_znbusday    like sy-datum,
          0scl_deldat    like sy-datum,
          p_days         TYPE i value 1.
    case i_vnam.
       when 'ZNBUSDAY'.
       CLEAR wa_znbusday.
       0scl_deldat = sy-datum.
       CALL FUNCTION 'Z_WORKDAY'
         EXPORTING
         CURR_DATE        = 0scl_deldat
         NUMBER_DAYS      = p_days
         CALENDAR         = wa_calendar
       IMPORTING
         WORK_DAY         = wa_znbusday
         l_s_range-low  = wa_znbusday.
         l_s_range-opt  = 'EQ'.
         l_s_range-sign = 'I'.
         append l_s_range to e_t_range.
    endcase.
    Kind regards,
    Alex

  • Debuggin a Call to Remote Function Module

    Hi
    I have a scenario where i have a Remote Function Module in r3 which is being called synchronously by an external java application. The FM has a lot of input and output parameters and many tables.  The output returned by the FM is not as expected.
    Can anyone tell me how debug a Remote Function Module when a call has been made from an external application.
    I am not able to get the test data sent by the external application . So when the external application gives a call to this Remote FM and if it is possibele to debug it would be great.
    regards
    Nilesh Taunk.

    Hi Nilesh,
    1) Login to SAP with the same ID with which you will calling the RFC function module from the outside system.
    2) Goto transaction - se37/se38
    3) Goto Utilities => Settings.
    4) Select the ABAP Editor Tab.
    5) Click on the Debugging tab.
    6) Tick the Actv. button and give the user name with which you will be debugging the code. In this case the logged in user id.
    7) Press Enter.
    8) Now put an external break point inside the Function Module.
    9) Load your external application (from where you want to debug the FM) once again.
    The execution will stop in the FM.
    Hope it helps..
    Lokesh
    PS: This was a simple question, but I guess the reason no one has answered your question is due to the fact that you havent rewarded points to members helping you. Also remember to close your post once it has been answered.

  • Call report in function module

    Hi All,
    Please tell me how to call report in function module. i want input parameters of function module with same selection screen parameters of report. please tell to me .if possible provide the code.
    Thanks,
    Raju.

    Hi Kumar,
    Incorporate the below logic in the FM that you have developed.
    SUBMIT zreport WITH s_vbeln  IN t_saleorder_range
                                WITH p_file         EQ w_file
                                AND RETURN.
    Note: Here, t_salerder_range is an internal table of type range. It has four fields just like selection-options...SIGN,OPTION, LOW and HIGH. Whatever the values that you pass here would be taken as the selection screen values for the report that you are calling.
    Hope this is helpful
    Thanks,
    Babu Kilari

  • Function module RSAOU_BWBC_GET not found

    hi guys i have a ODS in my BWD systems , everything works fine, loading is correct, i have moved it to my testing environment and sense then, the transfer rules are inactive when i try to active them i get this error
    With Remote Function Call to system EBQCLNT900 error Function module "RSAOU_BWBC_GET" not found.  occurred.
    I have checked both r/3 systems, the function module doesnu2019t exist. I have checked both BW systems and the function module does exist and is active.
    If this was an issue with QAS. Then DEV shouldnu2019t also load any data in BWD, and in BWD everything works fine.
    I have checked the connections and its all fine.
    Any suggestions?

    HI,
    Seems like some connectivity issue or something related to transfer rules mismatch with the data source.Its not exaclty what BW is lloking for.
    Can you just do a check if the connection is happening properly between the systems.
    Also can you verify the data source in the source system in quality is OK and is same as development.
    can try to transport the data source again and then do a replication again and transport the transfer rules again.
    Thanks
    Aeet

  • Function module "Z_XSI_ACTIVE" not found

    Dear all,
    I m getting an error
    Runtime Errors CALL_FUNCTION_NOT_FOUND
    Except. CX_SY_DYN_CALL_ILLEGAL_FUNC
    Date and Time 18.07.2008 16:02:20
    Short dump has not been completely stored (too big)
    Short text
    Function module "Z_XSI_ACTIVE" not found.
    Pls see details
    Error analysis
    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 "XSI_ACTIVE_DELV" "(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 "SAPLVVTR" contains the CALL FUNCTION statement.
    The name of the function module to be called is "Z_XSI_ACTIVE".
    No function module exists with the name "Z_XSI_ACTIVE".
    All function modules are listed in the Function Library (SE37).
    Possible reasons:
    a) Wrong name specified. Pay particular attention to
    upper/lower case and underscores ("_").
    or
    b) Transport error
    c) In the case of an enqueue/dequeue module,
    the lock object may not have been activated
    (ABAP/4 Dictionary).
    Pls view Function Module "XSI_ACTIVE_DELV" and tell me about function "Z_XSI_ACTIVE".
    I think it has problem with user exit.

    In the IMG (tx SPRO) you have Logistics Execution->Shipping->Basic Shipping Functions->Configure Global Shipping Data.  If you execute that, you have the choice for field ExpDlvCo to have
    Inactive
    Active
    Active depending on function module XSI_ACTIVE
    Active depending on function module XSI_ACTIVE with changes
    Help on this field says:
    Express Delivery Company Active
        This indicator dictates whether the express-delivery-company interface
        is active and may contain the following values:
           "X": clients active
           " " (blank): clients inactive
        Special processing:
        The values of "S" and "U" call up the "XSI_ACTIVE" customer function
        module. "S" indicates that the data is read-only, whereas "U" means that
        data can be changed. The interface for this function module must be
        identical to the one in the function module "XSI_ACTIVE_SAMPLE".
    I.e., if you set the ExpDlvCo field to be  "Active depending on function module XSI_ACTIVE" or "Active depending on function module XSI_ACTIVE with changes", then you have to create a function module Z_XSI_ACTIVE, with the same interface as XSI_ACTIVE_SAMPLE.
    matt

  • Function module "GM_DOCUMENT_REVERSE" not found.  after Patch Update

    Hi Abapers/Basis
    After patch update i am not able to do FBCJ reversal entry getting below error message.
    Runtime Errors         CALL_FUNCTION_NOT_FOUND
    Exception              CX_SY_DYN_CALL_ILLEGAL_FUNC
    Date and Time          25.05.2011 14:43:26
    Short text
         Function module "GM_DOCUMENT_REVERSE" not found.
    What happened?
         The function module "GM_DOCUMENT_REVERSE" is called,
         but cannot be found in the library.
         Error in the ABAP Application Program
         The current ABAP program "SAPLRWCL" had to be terminated because it has
         come across a statement that unfortunately cannot be executed.
    What can you do?
         Note down which actions and inputs caused the error.
         To process the problem further, contact you SAP system
         administrator.
         Using Transaction ST22 for ABAP Dump Analysis, you can look
         at and manage termination messages, and you can also
    Error analysis
        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 "CALL_DISPATCHER_STORNO_R" "(FORM)", 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 "SAPLRWCL" contains the CALL FUNCTION statement.
        The name of the function module to be called is "GM_DOCUMENT_REVERSE".
        No function module exists with the name "GM_DOCUMENT_REVERSE".
        All function modules are listed in the Function Library (SE37).
        Possible reasons:
        a) Wrong name specified. Pay particular attention to
           upper/lower case and underscores ("_").
           or
        b) Transport error
        c) In the case of an enqueue/dequeue module,
           the lock object may not have been activated
           (ABAP/4 Dictionary).
    How to correct the error
        Check the last transports to the SAP System.
        Is the program "SAPLRWCL" currently being changed?
        If an enqueue/dequeue module is involved, is the activation
        of the lock object missing in the ABAP/4 Dictionary?
        If the error occures in a non-modified SAP program, you may be able to
        find an interim solution in an SAP Note.
        If you have access to SAP Notes, carry out a search with the following
        keywords:
        "CALL_FUNCTION_NOT_FOUND" "CX_SY_DYN_CALL_ILLEGAL_FUNC"
        "SAPLRWCL" or "LRWCLF10"
        "CALL_DISPATCHER_STORNO_R"
        Function modules with names similar to "GM_DOCUMENT_REVERSE":
        GM_DOCUMENT_CLOSE
        GM_DOCUMENT_RECORD
        GM_DOCUMENT_DELETE
        GM_DOCUMENT_POST
        GM_DOCUMENT_CHECK
        G_DOCUMENT_RECORD
        GJ_DOCUMENT_RECORD
        GM_DOCUMENT_PROJECT
        GET_DOCUMENTS
        GM_DOCUMENT_DISPLAY
        If you cannot solve the problem yourself and want to send an error
        notification to SAP, include the following information:
    If you cannot solve the problem yourself and want to send an error
    notification to SAP, include the following information:
    1. The description of the current problem (short dump)
       To save the description, choose "System->List->Save->Local File
    (Unconverted)".
    2. Corresponding system log
       Display the system log by calling transaction SM21.
       Restrict the time interval to 10 minutes before and five minutes
    after the short dump. Then choose "System->List->Save->Local File
    (Unconverted)".
    3. If the problem occurs in a problem of your own or a modified SAP
    program: The source code of the program
       In the editor, choose "Utilities->More
    Utilities->Upload/Download->Download".
    Moderator message: please don't just dump your dumps, search for SAP notes or open a call with SAP instead.
    Edited by: Thomas Zloch on May 25, 2011 2:16 PM

    Hi Karthik,
    Thank you for ur reply.
    I did not implement any user exit/ badi. Dump is saying that my smarform function module does not exist in the se37 library.
    I have excuted my form through se38, that time is working fine. When i tried through output type it is going to dump.
    Regards,
    Kusuma.

  • Problem while calling an RFC Function Module in Background

    Hello,
    I have created a RFC function module for reading data from an external DB system. The FM calls an external RFC program (coded in C++ using RFC SDK), which delivers the required data. This external program is maintainged as an TCP RFC Connection in SM59.
    Further I have created a report, that calls the RFC function module to get the data from the external RFC programm.
    My problem is, when I call the report in foreground, everything works OK, the RFC connection works and data can be read from the external program.
    However, when I schedule the report to run in background as a job, the report is stating in the protocoll that there was a problem calling the defined RFC connection (although the connection is working properly at that time).
    More funny is, this particular problem with running in background occurs only in the productive system, in test and development system the report works correctly also while running as a job in background.
    Can you suggest the solution to this problem? Could it be something with authorisations or server settings?
    I will be on holiday for the next 6 weeks, so take your time to answer .
    Regards,
    Dusan.
    Edited by: Julius Bussche on Jan 22, 2009 7:19 PM
    Please read the forum rules about u r g e n t ...

    This is an external RFC server program, not a remote enabled ABAP RFC function module as the others seem to be assuming, right?
    Is it possible that your DEV and QAS systems only have one application server, but the PROD has many and dedicated one(s) for processing low priority background jobs?
    It might be that the target server of your TCP connection is not this BTC instance, and your RFC server is returning the data "locally" - so, into nirvana...
    Just guessing, but might be worth checking.
    Cheers,
    Julius

  • Calling a RFC Function Module

    Hello Guys,
    I have a question regarding calling a RFC function module.
    In BW - BI 7.0 I call a RFC function module:
    (The ABAP program in BW-BI 7.0 is below)
      CALL FUNCTION ''ZTESTFUNCTIONMODULE'  " Function module in ECC
         DESTINATION 'DECCLNT110'  " ECC system
        TABLES
          it_gl_item   = it_gl
          it_errlog_gl = it_errlog_gl.
    The 'ZTESTFUNCTIONMODULE'   is RFC enabled in the ECC system.
    The purpose is we retarct the data from BW to ECC.
    When I run the function module it always asks for the user id and password.
    The SAP logon screen appears and it asks for the user id and password.
    The destination is maintained in the SM59 transaction and also the user is maintained there. I think it should login automatically into remote system and return the tables. is it correct. How to skip the logon screen.
    Do I have to pass the user id and password in the function module. I think it should take the user id from the SM59 destination. Is it correct.
    Please advise. As always thanks for your help guys.

    Hi Senthil,
    I think you answered your query in your question itself
    The user ID and password need to be maintained in RFC destination in SM59.
    Go to SM59 and then click on test connection..if it does not ask for ID and passwoed that means correct ID and password is maintained in SM59 otherwise maintain it.
    Regards,
    Atish

  • *Can we call a Standard Function Module inside a Zfunction module ?*

    Can anyone please help me know whether we can call a Standard Function Module inside a Zfunction module ?
    I tried the same (No syntax error) BUT when i activate the zFunction Module it throws the error:-
    +'' REPORT/PROGRAM statement missing, or program type is INCLUDE. " +

    Yes, I got the Answer -
    We Can we call a Standard Function Module inside a Zfunction module.
    But we need to make sure that the Function Groups are activated.
    FUNCTION ZFM_TEST_NESTED_FM.
    ""Local Interface:
    *"  EXPORTING
    *"     REFERENCE(EX_CONVERT_UPPER_CASE) TYPE  STRING
    CALL FUNCTION 'TERM_TRANSLATE_TO_UPPER_CASE'
      EXPORTING
      LANGU                     = SY-LANGU
        TEXT                         = 'gaurav'
    IMPORTING
        TEXT_UC                   = EX_CONVERT_UPPER_CASE
    EXCEPTIONS
       NO_LOCALE_AVAILABLE       = 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.
    ENDFUNCTION.

  • Formal error: Invalid calling sequence for function modules

    Hi All,
    I have developed a function module for FQEVENT 620 Payment: Transfer Line Items for Clearing.
    The clearing works fine.
    After clearing the open items i need to post an FI-CA Document(BAPI : BAPI_CTRACDOCUMENT_CREATE) for each open item(cleared item)
    I have used the bapi : BAPI_CTRACDOCUMENT_CREATE in the same function module that i have developed for FQEVENT 620 Payment: Transfer Line Items for Clearing.Here i am getting an error "Formal error: Invalid calling sequence for function modules".
    So please let me know where i can use this bapi to post fi-ca document.Is there a BAdi or Enhancement Spot where i can use this BAPI or tell me what should i do to overcome this error.
    Regards
    Venkat

    Venkat:
    While I am confused about your business process - creating an open item when clearing one seems strange.  Look into event 0020 which is called after documents are posted - it may present the opportunity to post process additional documents.
    regards,
    bill.

  • Where should i call the rfc function module? in xi or in r/3

    where should i call the rfc function module?
    for the synch scenario: file < -- >  xi <---> rfc
    i know the type of rfc is tcp/ip; but i'm not sure with the followings,
    and with some trials i can not even see any message via rwb even all the setting
    can be activated without errors.
    where should i create the rfc destination? in r/3 or xi
    where should i call the rfc via abap program? in r/3 or xi
    i guess the calling program should belong to the different server with the rfc itself....
    so confused....
    Thanks for your reply!!
    Jun

    if i create the destination in xi point to r/3, then i call the rfc use the destination in r/3 right ?
    The call doesnt use the destination in R3. XI has the RFC destination which is just used to connect to the R3 system
    but where i need to create the fm via se37? in xi or r/3 ?
    In R3
    Regards,
    Prateek

  • Error in calling the Remote Function Module

    Hi all,
    I am trying to call the Remote function Module which is in CRM  from ECC .
    But we are not able to detect the function module as it is showing the error as Function Module not found.
    Can anybody help us in calling the Remote Function Module .
    Regards,
    Madhavi

    Please check the foll 2 things :
    RFC radio button clicked in se37 for that FM
    RFC connection established with the remote server in SM59
    Thanks

  • Check Function Module is not working

    Hi All Expert,
    I'm new in workflow and  develop custom workflow for Transaction FB65 ( Vendor Credit Memo) and using business object FIPP , event CREATED.
    Actually  requirement is that when user  click on park button in FB65 then should  be trigger workflow only for particular vendor code .
    Now my workflow is working fine for all vendor code.
    For particular vendor code, I have created an new entries in  SWE2 and assigning a check function module to that
    Refer Link :         http://www.****************/Tutorials/Workflow/checkfunctionmodule/demo.htm
    and also same entries create in SWETYPV But Check Function Module is not working before workflow trigger.
    Appreciate your help and support.
    Regards
    Saurabh

    Hi
    : Check FM  : ZWF_DR_CR_MEMO 
    SourceCode :
    FUNCTION ZWF_DR_CR_MEMO.
    *"*"Local Interface:
    *"  IMPORTING
    *"     VALUE(OBJTYPE) LIKE  SWETYPECOU-OBJTYPE
    *"     VALUE(OBJKEY) LIKE  SWEINSTCOU-OBJKEY
    *"     VALUE(EVENT) LIKE  SWETYPECOU-EVENT
    *"     VALUE(RECTYPE) LIKE  SWETYPECOU-RECTYPE
    *"  EXPORTING
    *"     REFERENCE(RESULT) TYPE  C
    *"  TABLES
    *"      EVENT_CONTAINER STRUCTURE  SWCONT
    *"  EXCEPTIONS
    *"      NOT_TRIGGERED
    BREAK-POINT.
    TABLES : VBSEGK.
      DATA : LV_VEND TYPE VBSEG-LIFNR.
      CLEAR : LV_VEND.
      SELECT SINGLE  LIFNR FROM  VBSEGK INTO LV_VEND WHERE BELNR EQ OBJKEY.
        if sy-subrc eq 0
          IF LV_VEND = '0000120510'.
            RAISE NOT_TRIGGERED.
          ENDIF
      endif.
    ENDFUNCTION.

Maybe you are looking for