How to use a table- valued function as a datasource for SSRS report?

CREATE FUNCTION [dbo].[GetNetSheetRegionNetPerCapitaRow](@WeekBeginDate smalldatetime)
RETURNS @RegionNetPerCapitaRow TABLE 
(WTD1 DECIMAL(18,6),PYWTD1 decimal(18,6),percentDiff1 float,diff1 float,WTD2 decimal(18,6),YTD2 decimal(18,6),percentDiff2 float,Diff2 float,YTD3 decimal(18,6),PYTD3 decimal(18,6),percentDiff3 float,Diff3 float)
how to use the above function as a data source for SSRS report instead of a stored procedure ?

Hi,
In the Dataset - > Query Type - >  Text - >
SELECT * FROM [dbo].[GetNetSheetRegionNetPerCapitaRow](@WeekBeginDate)
sathya - www.allaboutmssql.com ** Mark as answered if my post solved your problem and Vote as helpful if my post was useful **.

Similar Messages

  • How to use dual table in ODI in source side for nested queries?

    Hi,
    Any idea how to use dual table in source for more than once. I want to build a ODI interface for the following source query
    SELECT ACTV_TYP.ACTV_TYP_SRC_CD, ACTV_TYP.ACTV_TYP, PORT_ACTV_TYP.PORT_ACTV_TYP_SRC_CD, PORT_ACTV_TYP.PORT_ACTV_TYP, SFT_DLT_STS.SFT_DLT_STS_SRC_CD, SFT_DLT_STS.SFT_DLT_STS
    FROM
    SELECT LOW_VALUE PORT_ACTV_TYP_SRC_CD, MEANING PORT_ACTV_TYP
    FROM CUSTOMS.DOMAIN_ALLOW_COLUMNS_VALUES
    WHERE TABLE_NAME = 'BRKR_PORTS'
    AND COLUMN_NAME = 'WORK_PORT_TYPE') PORT_ACTV_TYP,
    (SELECT LOW_VALUE SFT_DLT_STS_SRC_CD, MEANING SFT_DLT_STS
    FROM CUSTOMS.DOMAIN_ALLOW_COLUMNS_VALUES
    WHERE TABLE_NAME = 'BANKS'
    AND COLUMN_NAME = 'REC_STATUS') SFT_DLT_STS,
    (SELECT 1 ACTV_TYP_SRC_CD, '?????' ACTV_TYP FROM DUAL
    UNION ALL
    SELECT 2 ACTV_TYP_SRC_CD, '???????' ACTV_TYP FROM DUAL) ACTV_TYP
    Regards

    If the below query is equivalent , it seems you don't need dual table at all , just default the values in the interface.
    You are using dual tables to populate values ACTV_TYP.ACTV_TYP_SRC_CD, ACTV_TYP.ACTV_TYP values. Look at your query in the following manner :
    SELECT '1', '?????', PORT_ACTV_TYP.PORT_ACTV_TYP_SRC_CD, PORT_ACTV_TYP.PORT_ACTV_TYP, SFT_DLT_STS.SFT_DLT_STS_SRC_CD, SFT_DLT_STS.SFT_DLT_STS
    FROM
    SELECT LOW_VALUE PORT_ACTV_TYP_SRC_CD, MEANING PORT_ACTV_TYP
    FROM CUSTOMS.DOMAIN_ALLOW_COLUMNS_VALUES
    WHERE TABLE_NAME = 'BRKR_PORTS'
    AND COLUMN_NAME = 'WORK_PORT_TYPE') PORT_ACTV_TYP,
    (SELECT LOW_VALUE SFT_DLT_STS_SRC_CD, MEANING SFT_DLT_STS
    FROM CUSTOMS.DOMAIN_ALLOW_COLUMNS_VALUES
    WHERE TABLE_NAME = 'BANKS'
    AND COLUMN_NAME = 'REC_STATUS') SFT_DLT_STS
    UNION
    SELECT 2 , '??????', PORT_ACTV_TYP.PORT_ACTV_TYP_SRC_CD, PORT_ACTV_TYP.PORT_ACTV_TYP, SFT_DLT_STS.SFT_DLT_STS_SRC_CD, SFT_DLT_STS.SFT_DLT_STS
    FROM
    SELECT LOW_VALUE PORT_ACTV_TYP_SRC_CD, MEANING PORT_ACTV_TYP
    FROM CUSTOMS.DOMAIN_ALLOW_COLUMNS_VALUES
    WHERE TABLE_NAME = 'BRKR_PORTS'
    AND COLUMN_NAME = 'WORK_PORT_TYPE') PORT_ACTV_TYP,
    (SELECT LOW_VALUE SFT_DLT_STS_SRC_CD, MEANING SFT_DLT_STS
    FROM CUSTOMS.DOMAIN_ALLOW_COLUMNS_VALUES
    WHERE TABLE_NAME = 'BANKS'
    AND COLUMN_NAME = 'REC_STATUS') SFT_DLT_STS
    Now you can use dataset to make UNION.

  • How to use nested table values in IN expression?

    Hi!
    Can someone please give me a hint to the correct syntax for this:
    declare
    TYPE numtable is table of number;
    tt numtable;
    begin
      select myId bulk collect into tt from some_table;
      update some_other_table set name = 'kakadu' where xId in (select * from tt); -- this line is wrong as it is
    end;What I am doing is fixing a stored procedure that was like this before:
    update table_a set name = 'kakadu' where column_X in (select one.A from table_1 one join table_a on x y z WHERE a b c);
    update table_b set name = 'nimfa'  where column_Y in (select one.B from table_1 one join table_a on x y z WHERE a b c);The problem is, the first UPDATE changes the result of the SELECT, so I want to "remember" it.
    A and B are columns in table_1, A is the primary key. So the fixed code would be like:
    -- store the list of selected IDs from table_1
      select A bulk collect into tt from table_1 one join table_a on x y z WHERE a b c ; -- same conditions as in old code
    -- do the updates
      update table_a set name = 'kakadu' where column_X in (select * from tt);
      update table_b set name = 'nimfa' where column_Y in (select one.B from table_1 one where one.A in tt);(it can be a varray instead of nested table, as far as I am concerned)
    Thanks,
    David

    Yes, it needs to be a SQL type
    Re: How to pass an array to a function from a SELECT statement
    Or you can use a built in SQL type (version dependent)
    Re: Collection in where not working

  • Table-Valued function in oracle

    Hi All,
    I have a table-valued function in MS SQL Server, that I want to convert it.
    How can I create table-valued function in Oracle 9.2.0.1.0
    Thanks for your thoughts

    Just so we are talking the same language, array-type constructs in Oracle are generally known as "collections", while "table" generally refers to a database table. Having said that, you may see references to "PL/SQL Tables" which was the old name for collections when they first came out, although this term has been mostly withdrawn as it's somewhat misleading and causes confusion (that's marketing for you).
    Now I think about it we also have table functions, the official name for functions that return collections although IMO almost as misleading. Anyway my rambling point is that "function that returns a table" may cause confusion in Oracle circles. Or maybe it's just me.
    There are loads of String To Table examples around:
    * www.williamrobertson.net/documents/comma-separated.html
    * www.oracle-developer.net/display.php?id=412
    Couldn't you have the procedure accept an array in the first place and have something else do the string conversion before it reaches the procedure?
    Edited by: William Robertson on Aug 29, 2008 5:39 PM

  • SQL Server Multiple JOINS with Table Value Function - query never ends

    I have a query with 4 joins using a table value function to get the data and when I execute it the query never ends.
    Issue Details 
    - Table value function 
        CREATE FUNCTION [dbo].[GetIndicator] 
          @indicator varchar(50),
          @refDate datetime
    RETURNS 
    TABLE
    AS
    RETURN
    SELECT
    T1.Id ,T1.ColINT_1, T1.ColNVARCHAR_1 collate DATABASE_DEFAULT as ColNVARCHAR_1 ,T1.ColNVARCHAR_2 ,T1.ColSMALLDATETIME_1, T1.ColDECIMAL_1, T1.ColDECIMAL_1
    FROM TABLE2 T2
    JOIN TABLE3 T3
    ON T2.COLFKT3 = T3.Id
    AND T3.ReferenceDate = @RefDate
    AND T3.State != 'Deleted'
    JOIN TABLE4 T4
    ON T2.COLFKT4 = T4.Id AND T4.Name=@indicator
    JOIN TABLE1 T1
    ON T2.COLFKT1=T1.Id
    - Query
        DECLARE @RefDate datetime
    SET @RefDate = '30 April 2014 23:59:59'
    SELECT DISTINCT OTHERTABLE.Id As Id
    FROM 
    GetIndicator('ID#1_0#INDICATOR_X',@RefDate) AS OTHERTABLE
    JOIN GetIndicator('ID#1_0#INDICATOR_Y',@RefDate) AS YTABLE  
    ON OTHERTABLE.SomeId=YTABLE.SomeId
    AND OTHERTABLE.DateOfEntry=YTABLE.DateOfEntry
    JOIN GetIndicator('ID#1_0#INDICATOR_Z',@RefDate) AS ZTABLE
    ON OTHERTABLE.SomeId=ZTABLE.SomeId
    AND OTHERTABLE.DateOfEntry=ZTABLE.DateOfEntry
    JOIN GetIndicator('ID#1_0#INDICATOR_W',@RefDate) AS WTABLE 
    ON OTHERTABLE.SomeId=WTABLE.SomeId
    AND OTHERTABLE.DateOfEntry=WTABLE.DateOfEntry
    JOIN GetIndicator('ID#1_0#INDICATOR_A',@RefDate) AS ATABLE  
    ON OTHERTABLE.SomeId=ATABLE.SomeId
    AND OTHERTABLE.DateOfEntry=ATABLE.DateOfEntry
    Other details:
    - SQL server version: 2008 R2
    - If I execute the table function code outside the query, with the same args, the execution time is less the 1s.
    - Each table function call return between 250 and 500 rows.

    Hi,
    Calling function in general is a costly query. And definitely joining with a function 5 times in not an efficient one.
    1. You can populate the results for all parameters in a CTE or table variable or temporary table and join (instead of funtion) for different parameters
    2. Looks like you want fetch the IDs falling to different indicators for the same @Refdate. You can try something like this
    WITH CTE
    AS
    SELECT
    T1.Id ,T1.ColINT_1, T1.ColNVARCHAR_1 collate DATABASE_DEFAULT as ColNVARCHAR_1 ,T1.ColNVARCHAR_2 ,T1.ColSMALLDATETIME_1, T1.ColDECIMAL_1, T1.ColDECIMAL_1, T4.Name
    FROM TABLE2 T2
    JOIN TABLE3 T3
    ON T2.COLFKT3 = T3.Id
    AND T3.ReferenceDate = @RefDate
    AND T3.State != 'Deleted'
    JOIN TABLE4 T4
    ON T2.COLFKT4 = T4.Id AND T4.Name=@indicator
    JOIN TABLE1 T1
    ON T2.COLFKT1=T1.Id
    SELECT * FROM CTE WHERE Name = 'ID#1_0#INDICATOR_X' AND Name = 'ID#1_0#INDICATOR_Y' AND Name = 'ID#1_0#INDICATOR_Z' AND Name = 'ID#1_0#INDICATOR_W' AND Name = 'ID#1_0#INDICATOR_A' AND ReferenceDate = @RefDate.
    Or you can even simplify more depends on your requirement.
    Regards,
    Brindha.

  • How to use External Tables

    Hi, I want to know how to use external tables? The procedure i follow for SQL*Loader in my shell script is:
    Call the sqlldr
    Check return code
    If return code = 2. get count of records from bad file and exit.
    If return code != 0 and != 2 then exit as fatal error
    If return code = 0 then continue.
    But i don't understand how to use external table as it is not invoked and does not have a return code.

    Hello,
    What do you mean alogrithim, do you mean to invoke external table as you invoke sqlldr? You can generate external table script from sqlldr and use it to load data but you might have to modify the table name and datafile name . You can see if any bad file generated from sqlldr and if yes then you can generate external table (using sqlldr) or based on your bad file. May be if you can list what exactly you want in bullet points, then it will be easier to suggest you.
    Regards

  • In which condition Table valued function should prefer over SP except use in joins?

    Hi, 
    My requirements is:
    Entity framework needs to call DB object (TVF or SP), which will provide some data to them and they'll work on it at app level.
    DB object would be simple, one result set, it will join 5 tables and get around 30 columns to them. it would be parameterized query so can't use view.
    Now my question is what DB object would be best to use, table valued function or store procedure. and why?
    I google on it, I find some interesting links (example http://technet.microsoft.com/en-us/library/ms187650(v=sql.105).aspx)
    they mentioned conditions to convert SP to TVF but not mentioned the reason, why I should convert?
    Both have same cache plans strategy. SP has so many advantages over TVF, but I don't see any technical advantage of TVF over SP except it can be use in joins or so. 
    so In short my question is, why I can't use SP in all cases, why I would use TVF?, and which Table valued or multi-valued?
    would appreciate your time and response.

    According to a few recent blogs you should be able to use TVP or stored procedure with EF 6.1.2 with ease. In our application we haven't switched yet to 6.1.2 (we're using 6.0.0) and there is no support for stored procedures or functions so we use StoreQuery.
    I am wondering if you can share your experience of using EF with SP or TVP (and document the steps).
    I am also wondering as how exactly it's working behind the scenes and where the full query is taking place. Say, in our case we may want to add some extra conditions after retrieving a set using, say, SP. Would the final query execute on the client (e.g.
    SP executed on the server, result returned and then extra conditions executed on the "client")?
    As I said, right now we're using StoreQuery which means that our extra conditions must be case - sensitive as opposed to SQL Server case insensitive. So, if someone already tried that scenario and can tell me how exactly it works, I would appreciate it.
    Another question about EF - I defined a property as  
     [Column(TypeName = "varchar")]
            public string PhoneNumber { get; set; } // area code + phone
    and in the LINQ query as 
    var query = db.Accounts.Select(a => new AccountsList
    AcctName = a.AcctName,
    Contact = a.Contact,
    FullName = a.FullName,
    AreaCode = a.AreaCode,
    Phone = a.Phone,
    Hidden = a.Hide,
    Hide = a.Hide,
    PhoneNumber = a.AreaCode.Trim() + a.Phone.Trim(),
    AcctTypeId = a.AcctTypeId
    and I see that it's translated into CASE AreaCode IS NULL THEN N'' ELSE RTRIM(LTRIM(areaCode)) END + ... 
    My question is - why EF does it if there is no mentioning at all in the class as how NULL is supposed to be treated. Is it a bug?
    For every expert, there is an equal and opposite expert. - Becker's Law
    My blog
    My TechNet articles

  • How to declare variable in table valued function

    hello.
    i have the following code to define a inline table valued function
    but the use of cmn.ReshteId('Lf_WL') as a function in where clause is not good performance.
    Alter function lf.fn_WholeLifeBn_GetForm(@ViewKind tinyint, @CurrentLocation int) returns table
    as
    return
    select B.*
    from lf.fn_LifeBN_GetForm(@ViewKind, @CurrentLocation) B
    where Reshte = cmn.ReshteId('Lf_WL')
    for better performance following code is good:
    declare @Reshte smallint
    set @Reshte = cmn.ReshteId('Lf_TS')
    select B.*
    from lf.fn_LifeBN_GetForm(@ViewKind, @CurrentLocation) B
    where Reshte = @Reshte
    but can not use it as the first code block in inline function.
    please help for define a good function.

    What do you think about Multi-Statement Table-Valued UDFs?
    create function Func(@Var int)
    returns @T table(ColName int)
    as
    begin
      insert into @T(ColName) values (@Var)
      return
    end
    select * from Func(10)
    select * from Func(20)
    ---or
    alter function Func()
    returns @T table(ColName int)
    as
    begin
      declare @Var int
      set @Var = 10
      insert into @T(ColName) values (@Var)
      return
    end
    select * from Func()
    Best Regards,Uri Dimant SQL Server MVP,
    http://sqlblog.com/blogs/uri_dimant/
    MS SQL optimization: MS SQL Development and Optimization
    MS SQL Consulting:
    Large scale of database and data cleansing
    Remote DBA Services:
    Improves MS SQL Database Performance
    SQL Server Integration Services:
    Business Intelligence

  • SQL CLR Table-Valued Function System.NullReferenceException

    Good day.
    I wrote a clr table-valued function that gets the data from the sharepoint list using the client model.
    Sometimes I get exception (When I calling this function I get 90000 rows and then I get this exception...):
    Msg 6260, Level 16, State 1, Line 1
    An error occurred while getting new row from user defined Table Valued Function :
    System.NullReferenceException: Object reference not set to an instance of an object. System.NullReferenceException: v at SDS.FillRow(Object obj, SqlInt32& month, SqlString& datePlanSalary, SqlString& dilerCode, SqlString& dilerName, SqlString&
    model, SqlInt32& countSalary).
    How can I fix this issue?
    My Code:
    public class SDS
    [SqlFunction(SystemDataAccess = SystemDataAccessKind.Read, FillRowMethodName = "FillRow")]
    public static IEnumerable SDSItems(SqlString url, SqlString listName)
    ClientContext context = new ClientContext(url.ToString());
    List list = context.Web.Lists.GetByTitle(listName.ToString());
    CamlQuery query = new CamlQuery();
    query.ViewXml = "<View/>";
    ListItemCollection listItems = list.GetItems(query);
    context.Load(list);
    context.Load(listItems);
    context.ExecuteQuery();
    return listItems;
    public static void FillRow(
    object obj,
    out SqlInt32 month,
    out SqlString datePlanSalary,
    out SqlString dilerCode,
    out SqlString dilerName,
    out SqlString model,
    out SqlInt32 countSalary
    item = (ListItem)obj;
    month = Convert.ToInt32(item["_x041c__x0435__x0441__x044f__x04"]);
    datePlanSalary = Convert.ToString(item["_x0414__x0430__x0442__x0430__x000"]);
    dilerCode = Convert.ToString(item["_x041a__x043e__x0434__x0020__x04"]);
    dilerName = Convert.ToString(item["_x041d__x0430__x0437__x0432__x04"]);
    model = ((FieldLookupValue)item["_x041c__x043e__x0434__x0435__x04"]).LookupValue;
    countSalary = Convert.ToInt32(item["_x041a__x043e__x043b__x0438__x04"]);

    That's not a lot of information to go on, but...
    Can you put a check in your FillRow method for a null object (or one of your fields being null) and put out diagnostic information? Or is it happening in the ListItemCollection iterator itself? (i.e. before it returns a row back to FillRow). If it's happening
    in the iterator, perhaps you could subclass it and return diagnostics at that point.
    I'm also wondering (if it actually always happen at row 90000) if you're hitting a limit in web service call, or iterator, or UDF code. Does the function ever return more than 90000 rows successfully?
    Hope this helps, Bob

  • Table-Valued Function not returning any results

    ALTER FUNCTION [dbo].[fGetVendorInfo]
    @VendorAddr char(30),
    @RemitAddr char(100),
    @PmntAddr char(100)
    RETURNS
    @VendorInfo TABLE
    vengroup char(25),
    vendnum char(9),
    remit char(10),
    payment char(10)
    AS
    BEGIN
    insert into @VendorInfo (vengroup,vendnum)
    select ks183, ks178
    from hsi.keysetdata115
    where ks184 like ltrim(@VendorAddr) + '%'
    update @VendorInfo
    set remit = r.remit
    from
    @VendorInfo ven
    INNER JOIN
    (Select ksd.ks188 as remit, ksd.ks183 as vengroup, ksd.ks178 as vendnum
    from hsi.keysetdata117 ksd
    inner join @VendorInfo ven
    on ven.vengroup = ksd.ks183 and ven.vendnum = ksd.ks178
    where ksd.ks192 like ltrim(@RemitAddr) + '%'
    and ks189 = 'R') r
    on ven.vengroup = r.vengroup and ven.vendnum = r.vendnum
    update @VendorInfo
    set payment = p.payment
    from
    @VendorInfo ven
    INNER JOIN
    (Select ksd.ks188 as payment, ksd.ks183 as vengroup, ksd.ks178 as vendnum
    from hsi.keysetdata117 ksd
    inner join @VendorInfo ven
    on ven.vengroup = ksd.ks183 and ven.vendnum = ksd.ks178
    where ksd.ks192 like ltrim(@PmntAddr) + '%'
    and ks189 = 'P') p
    on ven.vengroup = p.vengroup and ven.vendnum = p.vendnum
    RETURN
    END
    GO
    Hi all,
    I'm having an issue where my Table-Valued Function is not returning any results.
    When I break it out into a select statement (creating a table, and replacing the passed in parameters with the actual values) it works fine, but with passing in the same exact values (copy and pasted them) it just retuns an empty table.
    The odd thing is I could have SWORN this worked on Friday, but not 100% sure.
    The attached code is my function.
    Here is how I'm calling it:
    SELECT * from dbo.fGetVendorInfo('AUDIO DIGEST', '123 SESAME ST', 'TOP OF OAK MOUNTAIN')
    I tried removing the "+ '%'" and passing it in, but it doesn't work.
    Like I said if I break it out and run it as T-SQL, it works just fine.
    Any assistance would be appreciated.

    Why did you use a proprietary user function instead of a VIEW?  I know the answer is that your mindset does not use sets. You want procedural code. In fact, I see you use an “f-” prefix to mimic the old FORTRAN II convention for in-line functions! 
    Did you know that the old Sybase UPDATE.. FROM.. syntax does not work? It gives the wrong answers! Google it. 
    Your data element names make no sense. What is “KSD.ks188”?? Well, it is a “payment_<something>”, “KSD.ks183” is “vendor_group” and “KSD.ks178” is “vendor_nbr” in your magical world where names mean different things from table to table! 
    An SQL programmer might have a VIEW with the information, something like:
    CREATE VIEW Vendor_Addresses
    AS
    SELECT vendor_group, vendor_nbr, vendor_addr, remit_addr, pmnt_addr
      FROM ..
     WHERE ..;
    --CELKO-- Books in Celko Series for Morgan-Kaufmann Publishing: Analytics and OLAP in SQL / Data and Databases: Concepts in Practice Data / Measurements and Standards in SQL SQL for Smarties / SQL Programming Style / SQL Puzzles and Answers / Thinking
    in Sets / Trees and Hierarchies in SQL

  • Submititng the program to another program  using internal table values

    Hi All,
    How to Submit from one program to another program using internal table values minimum 7 int tables without using the seletion screen
    thanks
    raj

    Hi All,
    Thank you very much for your inputs.
    i am facing another issue:
    For each 10,000 records it should trigger a job  (we are trying to call a program)  were the validation will be done only through the other program.
    please find the code mentioned below :
    TABLES : but000.
    DATA:  int_bp LIKE but000 OCCURS 0 WITH HEADER LINE.
    data released like BTCH0000-CHAR1.
    DATA: jobnumber LIKE tbtcjob-jobcount, " Job ID and
          jobname LIKE tbtcjob-jobname, " job name.
          startdate LIKE tbtcjob-sdlstrtdt, " Start-time
          starttime LIKE tbtcjob-sdlstrttm, " window specs.
          laststartdate LIKE tbtcjob-laststrtdt,
          laststarttime LIKE tbtcjob-laststrttm,
          job_released LIKE btch0000-char1. " JOB_CLOSE: Was job released?
    DATA : l1 TYPE i,
           b_size TYPE i,
           b_cursor TYPE cursor.
    INITIALIZATION.
      b_size = 5000.
    START-OF-SELECTION.
      OPEN CURSOR WITH HOLD b_cursor
         FOR
         SELECT *
         FROM but000
         WHERE bpkind = 'AA'.
      IF sy-subrc = 0.
        DO.
          FETCH NEXT CURSOR b_cursor INTO TABLE int_bp
                                               PACKAGE SIZE b_size.
    Note : here in this point  we are getting a dump for the second job trigger.
          IF sy-subrc = 0.
            CLEAR jobname.
            CONCATENATE sy-repid sy-datum sy-uzeit INTO jobname.
    export int_bp to memory id 'ABC'.
            CALL FUNCTION 'JOB_OPEN'
                 EXPORTING
                      jobname          = jobname
                 IMPORTING
                      jobcount         = jobnumber.
                EXCEPTIONS
                     cant_create_job  = 1
                     invalid_job_data = 2
                     jobname_missing  = 3
                     OTHERS           = 4
    CALL FUNCTION 'JOB_SUBMIT'
          EXPORTING
               authcknam = sy-uname
               jobname   = jobname
               jobcount  = jobnumber
               report    = 'YTEST_RRR'.
               variant   = lv_variant.
       SUBMIT ytest_rrr
          VIA JOB jobname NUMBER jobnumber
          AND RETURN.
        CALL FUNCTION 'JOB_CLOSE'
          EXPORTING
           event_periodic                    = 'X'
            jobcount                          = jobnumber
            jobname                           = jobname
            strtimmed                         = 'X'
          IMPORTING
            job_was_released                  = released
            else.
            EXIT.
          ENDIF.
        ENDDO.
    calling program :
    REPORT YTEST_RRR .
    data itab1 like but000 occurs 0 with header line.
    data l type i.
    import itab1 from memory id 'ABC' .
    describe table itab1 lines l.
    free memory id 'ABC'.
    write:/ 'total records are:', l.
    Please give your suggestion why its going for  dump in the second iteration.
    thanks in advance.

  • How to use Logical database in function module?

    I will create a function module in HR.
    but how to use Logical database  in function module ?  Logical database PNP always show screen.in function (RFC) code , it is a matter.

    You cannot attach the LDB to the main program of the function group.
    - So you may [SUBMIT|https://www.sdn.sap.com/irj/sdn/advancedsearch?cat=sdn_all&query=submit&adv=false&sortby=cm_rnd_rankvalue] a report which use the LDB and get back the data (export/import), by default in the syntax of SUBMIT the selection-screen will not be displayed
    - Use [LDB_PROCESS|https://www.sdn.sap.com/irj/sdn/advancedsearch?query=ldb_process&cat=sdn_all], fill a structured table for selection, and get data back in another table
    - Use [HR function modules to read Infotypes|https://www.sdn.sap.com/irj/sdn/advancedsearch?cat=sdn_all&query=hrfunctionmodulestoread+Infotypes&adv=false&sortby=cm_rnd_rankvalue].
    Regards

  • How to use the prompted value in the filter expression

    Hi
    Is it possible to use the prompted value in the filter expression?
    My requirement is that user will be prompted for a date field and I need to filter the records such that the records are displayed for the last 5 weeks from the date entered by the user.
    If somehow I know how to use the prompted value in the filter expression then this requirement is easy to be done. If this is possible, please guide me?
    If there are other ways to acheive the desired results then please suggest.
    Thanks
    -Jaz

    Edit: example added
    SQL> create table tb_test
      2  ( id number(5)
      3  , tot number(5)
      4  , mon_tot number generated always as (tot*15) virtual
      5  );
    Table created.
    SQL> insert into tb_test (id, tot) values (1, 5);
    1 row created.
    SQL> select * from tb_test;
            ID        TOT    MON_TOT
             1          5         75
    1 row selected.
    SQL> update tb_test
      2  set    tot = 15
      3  where  id = 1;
    1 row updated.
    SQL> select * from tb_test;
            ID        TOT    MON_TOT
             1         15        225
    1 row selected.

  • How to Use a table UI for input ?

    Hi All ,
    I just want to ask how to use a Table UI in webdynpro ABAP to insert , change and delete rows ?? and can we give a drop down facility in table columns ? . This is really urgent .
    Thanks in advance.
    Regards,
    LAS

    Hi LAS,
    Everything is possible. I am providing the logic here which will help you a lot.
    For insert, Change, Delete: 
       Just get the all the elements into temp internal table and get the lead slected index. Now instrt one row in the lead selected index position. then again bind the temporary internal table to your table node. Thats all it works like inserting the row.
    In the same way you can do the change and delete rows also.
    For Dropdown:
      Here i am providing the code for Dropdown. It will help you out.
      Just create the Dropdown view for the columns for which you want dropdown. And do the coding for that.
      Here in my scenario IT is the Table node which holds the information. And i am providing the dorpdown key for the column "BSCHL".
      If you have any dobts just reply to me . i will respond it.
    Code:
      data : ls_outtab               type /kyk/s_fb01_line,
             lt_outtab               type table of /kyk/s_fb01_line,
             lv_node_sd              type ref to if_wd_context_node,
             lv_node_it              type ref to if_wd_context_node,
             lv_node_info            type ref to if_wd_context_node_info,
             lv_node_sapmf05a_0106   type ref to if_wd_context_node,
             lv_node_waers           type ref to if_wd_context_node,
             lv_node_layout          type ref to if_wd_context_node,
             lv_rowcount             type i,
             lv_buzei                type i,
             lv_waers        type waers,
             lt_bschl_set    type wdy_key_value_table,
             bschl_key_item  type wdy_key_value.
    bind to context
      lv_node_sd      = wd_context->get_child_node( name = 'SD' ).
      lv_node_it      = lv_node_sd->get_child_node( name = 'IT' ).
      call method lv_node_it->bind_table
        EXPORTING
          new_items = lt_outtab.
    fill Dropdown Help for posting Key
      bschl_key_item-key    = '40'.
      bschl_key_item-value  = cl_wd_utilities=>get_otr_text_by_alias( '/KYK/FIN_FI/DEBIT_GL_ACCOUNT' ).
      insert bschl_key_item into table lt_bschl_set.
      bschl_key_item-key    = '50'.
      bschl_key_item-value  = cl_wd_utilities=>get_otr_text_by_alias( '/KYK/FIN_FI/CREDIT_GL_ACCOUNT' ).
      insert bschl_key_item into table lt_bschl_set.
      bschl_key_item-key    = '21'.
      bschl_key_item-value  = cl_wd_utilities=>get_otr_text_by_alias( '/KYK/FIN_FI/DEBITVENDOR' ).
      insert bschl_key_item into table lt_bschl_set.
      bschl_key_item-key    = '31'.
      bschl_key_item-value  = cl_wd_utilities=>get_otr_text_by_alias( '/KYK/FIN_FI/CREDITVENDOR' ).
      insert bschl_key_item into table lt_bschl_set.
      lv_node_info = lv_node_it->get_node_info( ).
      lv_node_info->set_attribute_value_set( name = 'BSCHL' value_set = lt_bschl_set ).
    Warm Regards,
    Vijay

  • How to use Temporary Table in PL-SQL

    In MySQL there is no Temporary table concept.
    So for intermediate calculation I have created a table as below
    create table SequenceTempTable
    SessionId VARCHAR(50),
    Sequence VARCHAR(500),
    CreatedDate DATE
    ) ENGINE=MEMORY;
    Whenever I invoke a SP, I load the data into SequenceTempTable using Session Id as below
    CREATE PROCEDURE `GetSequence`(
    IN Start_Date VARCHAR(25),
    IN End_Date VARCHAR(25)
    BEGIN
    SELECT UUID() INTO v_SessionId;
    INSERT INTO SequenceTempTable values (v_SessionId,'1,2,5,3',now());
    required code
    DELETE FROM SequenceTempTable WHERE SessionId = v_SessionId;
    COMMIT;
    END;
    i.e. I have created a table as temporary table (created once),
    and load the data using Session Id and once session specific intermediate computation done,
    I deleted the session specific data.
    Could you give me examples of How to use Temporary table in PL-SQL code with respect to my above example.
    Because I have gone through creating Temporary table but I stuck with use in PL-SQL. I mean to say Is there any need of creating table in advance before invoking SP.
    And one more thing as in MySQL temp table I created which is using MEMORY engine i.e. this table will always be in MEMORY so there is no need of writing data on disk.
    Regards
    Sanjeev

    Hi Sanjeev
    Read about GTT here
    http://www.oracle-base.com/articles/8i/TemporaryTables.php
    GTT always contains just session specific data. \
    In case you want to use the GTT in the same session again you can use option
    ON COMMIT PRESERVE ROWS;
    Or if it is used just once in the session use can use
    ON COMMIT DELETE ROWS;
    Do remember that for GTT the data of one session can not be accessed in other session.
    Also you can go away with Delete from GTT if not used again in same session.
    Regards
    Arun

Maybe you are looking for

  • Syncing files constantly issue & page not found when trying to access a file on web

    Can anyone assist with syncing issue. Syncing runs all day and new files are not syncing. I can see the files in web browser (not in desktop APP) however when I try to access the files I get page not found. I went into archive (after reading all the

  • Invoice and Accounting Number ranges

    Hi, I have a requirement where the invoice number and the accounting document number should be same. Ie: If I generate an invoice with number 101. The same number should be populated for the accounting document as well. Regards, Sam

  • Using BT mobile simm in a tablet computer

    Hi there. I am hoping that you might be able to help me. I have a BT dongle which works well on my laptop. I am thinking of buying an Android Tablet PC (possibly a Motorola Xoom) that can access 3G as well as wireless. My question is can I use the Si

  • Loose magnetic connector/charger port......?

    Hi, i have had my phone for about 7 months now. It's well looked after and has never been dropped or put in any water, thankfully. However I have just noticed that my magnetic connector/charger port seems/is loose. It's something that I don't use at

  • Labview for agricultural application RPM

    I am looking for some one who will create a complete hardware/software system from Labview that will monitor analog inputs for RPM and display on a dedicated screen having an intuitive output that will make it easy for unskilled operators to monitor