Call Function in SAP Query

Hi All,
How do you call a function in SQ02 & Populate a structure table?
Thanks
Adeel
Edited by: Adeel Sarwar on Mar 4, 2009 2:03 PM

Done

Similar Messages

  • IS IT POSSIBLE TO CALL FUNCTION IN sap QUERY sq01

    IS IT POSSIBLE TO CALL FUNCTION IN sap QUERY sq01

    Use enhancement project SQUE0001 for background downloads of query data.  Use the 'Private File' option with the query execution.

  • Send data to ECC table through RFC Call function from SAP B1 via  b1if

    Hi,
    I have created scenario in B1if which triggers from SAP B1, now I have to send this data in to ECC table, so I have created scenario for that with inbound SAP B1, outbound void and in process RFC Call atom is there but I am not getting data in receiver and also how to write xml to send data in RFC function. Function for RFC has configured from ECC end and have access of that function.
    So please help me to send data to ECC table through RFC Call function from SAP B1 (9.0) via b1if
    Thanks

    Solved by my own.

  • Call event in SAP Query SQ01

    Hi All,
    I have a query in SQO1 which I run displays the following :-
    Purchase Order                    Material
    45000000082                       EB12345679
    Now what I want is when I double click the PO it should automatically go to ME23N and if I double click the material it should go to MM03.
    Please can you bear in mind that this is a query via SQ02 where I will be adding the code you provide not SE37 so please make sure the coding reflects this.
    Points will be awarded
    Thanks

    Hi,
    I dont think that ALV double click can be handles via SAP query. One possibility is that you can modify the report program that SAP generates for the query. Change the program to handle the double click evet on the ALV grid and call transaction ME23n using the PO number on the line selected.
    Regards
    Ajith

  • Call screen in SAP Query selection screen (SQ01)

    Hi experts , in sq01 selection screen my requirement is: for one field  when the user call F4 the small screen should be appear and when they fill
    those 3 fields I should concatenate them and send it as a single field to query for process , the important thing is those 3 fields should be in '
    one line beside each other , is there a way like call screen or ... in  sq01 for this issue ??
    the screen that should be appear is something like this

    Hi,
    I dont think that ALV double click can be handles via SAP query. One possibility is that you can modify the report program that SAP generates for the query. Change the program to handle the double click evet on the ALV grid and call transaction ME23n using the PO number on the line selected.
    Regards
    Ajith

  • How to fill data when call function of sap standard script form?

    Hi every experts,
    <Priority Normalized>
    In our system, when we log in 'FR', we can print purchase order in language Franch,in t_code:ME22N.  And when logging in 'EN', we can print it in language English, in ME22N. The English form is just only translated from Franch, with all same structure and frame.  The form is done by script form.
    And when logging in 'ZH', we create a new program, calling function smartform, instead of translating from EN language. Because of different structure and frame, I don't know the way to write script, so  I print puchase order by smartform, when logging in 'ZH'.
    But I have a new issue. Our MM module consultant needs me to print Chinese form if one condition, print English form in other condition.
    So I have no idea to solve it. Because in my program, I get data to fill smartform and call function of smartform. And I don't know how to get data to fill script form. I only know the function name, 'OPEN_FORM' 'WRITE_FORM' 'CLOSE_FORM'.....
    If I only call the several functions, I will get only frame without no data. So who can tell me how to do????
    <Urgency downgraded>
    Edited by: Suhas Saha on Jul 26, 2011 3:34 PM
    Edited by: Vinod Kumar on Jul 26, 2011 4:09 PM

    Hi,
    Normally if we look in NACE transaction, you can see that upto five different FORMS can be assigned to a single output type . i.e. for each form there will be a seperate routine through which it gets called. But it all start from the first form only.
    so you need to write your code in the ENTRY of the first form and if it does not satisfy do not go for processing of it but just exit of that form ENTRY. so that it will take you to next form.
    hope this helps.
    Thanks,
    Venkatesh

  • Getting session hang When calling Function from SQL query

    Hi All,
    I am using Oracle 8.1.7.4.0. I have a fucntion in a Package and I am calling it from the SQL query. When I am firing the query my oracle session is going to hang position and I am not able to any thing. I have to kill the session.
    But this same thing is working fine in Oracle 9.i.
    There are no out parameter and no DML, DDL and DCL statement in this fucntion.
    Could you please get back me what is the problem on it.
    Regards
    SUN

    Check why your session hangs.
    Just a few ideas:
    * Blocking locks?
    * Endless loop?
    * Performance (maybe it is just slow in orac8i and you have to wait a bit longer). Check the execution plans of the SQL statements in your function.
    * Don't use a function, but direct SQL, it is faster in both versions.

  • Problem calling function

    Hi,
    i have creted a function module which read stock quantity using BAPI_MATERIAL_AVAILABILITY.
    Import - MFRPN
    Export - QNTY
    If i execute function module from SAP the result it's OK but when i call function from PHP it does not output nothing.
    $sap = new saprfc(array(
                                       "logindata"=>array(
                                            "ASHOST"=>"192.168.3.1"          // application server
                                            ,"SYSNR"=>"00"                    // system number
                                            ,"CLIENT"=>"200"               // client
                                            ,"USER"=>"rfc"               // user
                                            ,"PASSWD"=>"123456789"          // password
                                       ,"show_errors"=>true               // let class printout errors
                                       ,"debug"=>false)) ;                     // detailed debugging information
              // Call-Function
              // Call-Function
              $result=$sap->callFunction("Z_READ_QNTY",
                                                             array(
                                                                     array("IMPORT","MFRPN",$_POST['cod']),
                                                                     array("EXPORT","QNTY",$quantity),
              // Call successfull?
              if ($sap->getStatus() == SAPRFC_OK)
                   echo $quantity;
              else
                   // No, print long Version of last Error
                   $sap->printStatus();
                   // or print your own error-message with the strings received from
                   //           $sap->getStatusText() or $sap->getStatusTextLong()
    Please someone help me.
    Thank you.

    hi Dan,
    i will send you an working code sample. The  Fuba ZGET_MAKTX is easy  MATNR as import parameter and MAKTX as export parameter.
    you will receive the material short description.
    hope this will help you a little bit.
    in your code i thing you forgot to fill the $quantity    like this    $quantity = saprfc_export($fce,"QNTY");   before         echo $quantity;
    regards
    Tony
    <?php
         //Login to SAP R/3
         $login = array ("ASHOST"=>"vsap3", "SYSNR"=>"2", "CLIENT"=>"200","USER"=>"vsrfc", "PASSWD"=>"********", "CODEPAGE"=>"1100");
         $rfc = saprfc_open($login);
         if (!$rfc) {
              echo "RFC connection failed";
              exit;
         $fce = saprfc_function_discover($rfc,"ZGET_MAKTX");
         if (!$fce) {
              echo "Discovering interface of function module failed";
              exit;
         saprfc_import($fce,"MATNR","200200");
         $rc = saprfc_call_and_receive ($fce);
             if ($rfc_rc != SAPRFC_OK) { if ($rfc == SAPRFC_EXCEPTION ) echo ("Exception raised: ".saprfc_exception($fce)); else echo (saprfc_error($fce)); exit; }
             $maktx = saprfc_export($fce,"MAKTX");
             echo $maktx;
             saprfc_function_free($fce);
             saprfc_close($rfc);
    ?>
    Edited by: Tony Wienhold on Oct 7, 2008 11:19 AM
    Edited by: Tony Wienhold on Oct 7, 2008 11:22 AM

  • Declarations in SAP QUERY generated ABAP Programs

    hi,
    i had created a ABAP Program through ABAP Query (SQ01,SQ02,SQ03) but i have a issue that when i transport it to the PRD server i got the run time error. The Z program which i had created is the copy of the SQ01 generated program and i had done all the includes declarations in this program. but there is a problem that it is consist of the declarations of the structures,quries .
    I want to know is it necessary to always transport the Infoset and user group and the structure which is present in the program generated .
    Please provide me guidelines for this problem  .
    Edited by: ricx .s on Jul 6, 2009 5:31 AM
    Edited by: ricx .s on Jul 6, 2009 8:07 AM

    hi,
    i had copied the program bcoz i want to chekc that it is really necessary to transport the user group and infoset so that it can achieve functionality similar to the SAP QUERY.
    is there any other way without whichi can ahieve the functionality of SAP QUERY generated program and take it into the ABAP Porgram?

  • SAP Query Hotspot

    Is it possible to place a hotspot in a report developed in SAP Query similar to how it is done with ALV programming?  I know how to do it within ALV but was hoping I could use same functionality in SAP Query. 
    Also, if it is possible, where is the appropriate place to apply this code within the infoset?
    Thanks,
    Brian

    Hi Brian,
    You can try below solution.
    When you define a SAP Query , at the backend a program is generated . You can copy this program to a Z program and modify as required.Check with your technical consultant.
    Regards
    Balaji

  • Creating a function and passing query value

    I have what I thought was a pretty easy to resolve situation:
    I want to concatenate two query fields, if the 2nd one isn't empty.
    I created a function:
    <cfargument name="q1" value='#query.q1#' />
    <cfargument name="q1a" value='#query.q1a#' />
    <CFSET variables.myPunct = ": ">
    <cfset variables.ResultVar="">
    <cfif Trim(arguments.q1) NEQ "">
    <cfset variables.ResultVar='#arguments.q1#'>
    </cfif>
    <cfif Trim(arguments.q1a) NEQ "">
    <cfif variables.ResultVar NEQ "">
    <cfset variables.ResultVar='#variables.ResultVar &
    variables.myPunct#'>
    </cfif>
    <cfset variables.ResultVar='#variables.ResultVar &
    arguments.q1a#'>
    </cfif>
    <cfreturn variables.ResultVar>
    This is basically just the example they provide in the online
    instruction, with the names changed.
    In the detail band of my report, I have an expression builder
    field containing: report.mytestfunction()
    When I run this, I get: Element Q1 is undefined in ARGUMENTS.
    I've tried this ninety different ways (literally). It seems
    very clear to me that the query.q1 (for that matter, any of the
    query results) are NOT getting passed to the function. I have tried
    making the expression: report.mytestfunction(query.q1). I have
    tried creating an input parameter.
    The documentation on this is ridiculously limited,
    considering that the ability to implement conditional logic depends
    entirely on the "function", as far as I can tell. I can in no way
    get the function to interface with the query results. If is set
    fixed values in the function, as opposed to trying to use the query
    variables, it outputs fine.
    Any ideas?

    That has got to be the only way I DIDN'T try, although I
    could swear I tried that, too. Maybe I didn't have the "required"?
    I don't know. I know it works now. For the record, FUNCTION:
    <cfargument name="q1" required="yes" />
    <cfargument name="q1a" required="yes" />
    <CFSET variables.myPunct = ": ">
    <cfset variables.ResultVar="">
    <cfif Trim(arguments.q1) NEQ "">
    <cfset variables.ResultVar='#arguments.q1#'>
    </cfif>
    <cfif Trim(arguments.q1a) NEQ "">
    <cfif variables.ResultVar NEQ "">
    <cfset variables.ResultVar='#variables.ResultVar &
    variables.myPunct#'>
    </cfif>
    <cfset variables.ResultVar='#variables.ResultVar &
    arguments.q1a#'>
    </cfif>
    <cfreturn variables.ResultVar>
    In the "Detail" band, called function:
    report.mytestfunction(query.q1, query.q1a)
    Thanks for the tip. I'm going to go take a long walk on a
    short pier now.
    max

  • Can we call function modules in SAP query or ADHOC query

    Hi ,
    Can we call afunction moudule in sap query or ADHOC query ?If yes How
    An early responce is greatly appreciated
    Thanks and best regards
    Rajeev Chhabra

    Hello Rajeev Chhabra,
       Yes; you can call function module in SAP Query. In InfoSet definition (SQ02), you can create additional field. In this field definition, you can add code snippet where you can function module.  
    However, this is not possible in Quick Viewer (SQVI) Query.
    Thanks,
    Venu

  • Calling function using user-defined type from query

    I am in a bit over my head on this, at least at 2:30 in the morning after several hours of intense development. I am working on a function to return financial aging figures by aging date range. I created a user type Aging with a Currency type member for
    each of these.
     Public Type Aging
      Aging0 As Currency
      Aging30 As Currency
      Aging60 As Currency
      Aging90 As Currency
      Aging120 As Currency
     End Type
    I then created a function that accepts the account ID & the as-of date. I have all the rest of the code written to actually calculate all of it, but I am having a fundamental problem figuring out how to call the function. To eliminate any of the complex
    mathematical elements for testing, I have reducted the function to a set of simple explicitly-set values below:
    Public Function GetAging(AccountID As Integer, AsOfDate As Date) As Aging
        GetAging.Aging0 = 0
        GetAging.Aging30 = 0
        GetAging.Aging60 = 0
        GetAging.Aging90 = 0
        GetAging.Aging120 = 0
    End Function
    This all works fine from the immediate window, where I can type this:
    ?GetAging(115,#2015-04-05#).Aging0
    and get the expected response of 0 (I have tested with other values for each member, so I know this part is working correctly).
    But can I and/or how do I call this from a query? I should be able, as a test, to pass in each account # and the current date, just to get the Aging0 element out of my function--something like this:
     SELECT
      AccountID,
      CustomerName,
      GetAging([AccountID],Date()).Aging0
     FROM
      Customer
     ORDER BY
      CustomerName
    I get "The expression you entered has an invalid .(dot) or ! operator or invalid parentheses. But if I remove the ".Aging0", I get this error: Undefined function 'GetAging' in expression. 
    What am I missing here?

    To expand on the answer of Hans, you could use a AgePoint parameter in the function like this:
    Public Function GetAging(AccountID As Integer, AsOfDate As Date, AgePoint As Integer) As Currency
    ' do calculation
    Select Case AgePoint
    Case 0: GetAging = Aging.Aging0
    Case 30: GetAging = Aging.Aging30
    Case 60: GetAging = Aging.Aging60
    Case 90: GetAging = Aging.Aging90
    Case 120: GetAging = Aging.Aging120End Select
    End Function
    then use it in the query like this:
    SELECT
    AccountID,
    CustomerName,
    GetAging([AccountID],Date(), 0),
    GetAging([AccountID],Date(), 30),
    GetAging([AccountID],Date(), 60),
    GetAging([AccountID],Date(), 90),
    GetAging([AccountID],Date(), 120)
    FROM
    Customer
    ORDER BY
    CustomerName
    However, this has the big drawback that the function will be called 5 times for each and every AccountID, so you will probably have bad performance.
    Since you pass the AccountID to the function, you could consider to calculate the results for all AccountIDs in the code and store the results into a table, then join this table into the query.
    Matthias Kläy, Kläy Computing AG

  • Is it possible to use aggregation function in SQ Sap query?

    I need to create a sap query like using SELECT MAX(begda) statement.
    Please teach me how...
    Thank u in advance..

    Hi Ella,
    You can very well use the aggregate functions in sql which is usually a performance tuning technique.
    A calculation that is made on several records or cells of data. SUM, AVG, MAX, MIN and COUNT are examples of aggregate functions that are used in spreadsheets and database programs.
    SELECT ( ( ] ...
    MAX: returns the maximum value of the column
    MIN: returns the minimum value of the column
    AVG: returns the average value of the column
    SUM: returns the sum value of the column
    COUNT: counts values or lines as follows:
    · COUNT( DISTINCT ) returns the number of different values in the column.
    · COUNT( * ) returns the total number of lines in the selection.
    Ex:    DATA: fldate LIKE sbook-fldate,
          count  TYPE i,
          avg    TYPE p DECIMALS 2,
          max    TYPE p DECIMALS 2.
    SELECT fldate COUNT( * ) AVG( luggweight ) MAX( luggweight )
           FROM sbook
           INTO (fldate, count, avg, max)
           WHERE carrid = 'LH' AND
                 connid = '0400'
           GROUP BY fldate.
      WRITE: / fldate, count, avg, max.
    ENDSELECT.
    For further info:
    http://help.sap.com/saphelp_nw04/helpdata/EN/fc/eb3990358411d1829f0000e829fbfe/content.htm
    http://help.sap.com/abapdocu/en/ABAPSELECT_AGGREGATE.htm
    Thanks and Regards
    Srikant.P
    Edited by: SRIKANTH P on May 27, 2009 9:41 AM

  • Can we call function module in sap script

    hi
    can we call function module in sap script
    i want to use function module HR_TMW_GET_EMPLOYEE_NAME in sapscript
    to get Empname by using personal no
    pernr no is coming from bseg-pernr table
    so how i can use it .
    please help me
    thanks in advanced.

    hi,
    You can use like this:
    PERFORM FUNCTION_MODULE IN PROGRAM SUBROUTINE_POOL
    USING &FIELD1&
    USING &FIELD2&
    CHANGING &FIELD3&
    ENDPERFORM.
    where function_module is the func. module name defined in program SUBROUTINE_POOL , field1 n field2 are the fields to be passed, and field3 is the value which you want to display...
    You have to read field1 & field2 in the pool, process them & get the value of field to be output.
    Reward helpful answers.
    Regards,
    SIddhesh Sanghvi.

Maybe you are looking for