View Table values

Hi,
Can anyone suggest how to see values of tables whose  Display and maintance is not allowed.
For example Transp table: CDATA
Thank you very much..
Regards,
Thomas.

With a Quick&Dirty program:
Code could be like:
REPORT ....
DATA: it_cdata TYPE TABLE OF cdata.
SELECT * FROM cdata INTO TABLE it_cdata.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
  EXPORTING
    i_structure_name = 'CDATA'
  TABLES
    t_outtab         = it_cdata.
If you have more than one such a table, you should make the tablename as parameter.
André

Similar Messages

  • Adding a New row in Workbook above Table values

    Hi,
    I have created a Workbook for which i need to add 2 additional rows manually at the top.  I added a row by deleting the Blue color line (with word 'Table').  But when i refresh the workbook, the blue color line is appearing again and the row which i added disappeared. 
    How do i make this possible?  Is there any way through which i can add the lines just above the Table values?
    Any help on this will highly be appreciated.
    Regards,
    Murali

    Hi,
    As per my view , Table name was written in the Backend with VB script hence its require change that first later you can include the Additinal rows .
    Regards,
    satya

  • How to bind internal table values with RootUIElement(Table) from select Que

    Hello Friends,
           In my view Layout,there r two Input fields ,Submit button and Table... My concept is when user posting values in two input fields and clicking submit button means the result(more than one values) should be displayed in Table...
         I written coding also but i dont know to bind internal table values with Table... My code as follows,
    method onactionsearch .
       data:
         Node_Node_Flight                    type ref to If_Wd_Context_Node,
         Elem_Node_Flight                    type ref to If_Wd_Context_Element,
         Stru_Node_Flight                    type If_View1=>Element_Node_Flight ,
         itab TYPE STANDARD TABLE OF sflight.
    navigate from <CONTEXT> to <NODE_FLIGHT> via lead selection
       Node_Node_Flight = wd_Context->get_Child_Node( Name = IF_VIEW1=>wdctx_Node_Flight ).
    @TODO handle not set lead selection
       if ( Node_Node_Flight is initial ).
       endif.
    get element via lead selection
       Elem_Node_Flight = Node_Node_Flight->get_Element(  ).
    @TODO handle not set lead selection
       if ( Elem_Node_Flight is initial ).
       endif.
    alternative access  via index
    Elem_Node_Flight = Node_Node_Flight->get_Element( Index = 1 ).
    @TODO handle non existant child
    if ( Elem_Node_Flight is initial ).
    endif.
    get all declared attributes
       Elem_Node_Flight->get_Static_Attributes(
         importing
           Static_Attributes = Stru_Node_Flight ).
    select * from sflight into CORRESPONDING FIELDS OF TABLE itab
      WHERE carrid = Stru_Node_Flight-carrid and connid = Stru_Node_Flight-connid.
    Node_Node_Flight->bind_table( new_items = itab ).
    endmethod.
    Plz reply me asap...!

    Hi,
    What I understood from your coding is...
    * navigate from <CONTEXT> to <NODE_FLIGHT> via lead selection
    Node_Node_Flight = wd_Context->get_Child_Node( Name = IF_VIEW1=>wdctx_Node_Flight ).
    You are reading values from the above node and binding the values to the same node.Am i right?
    Did you take seperate context node for your input fields or binded the above context to the fields.If not then read the context attribute values which are binded to the carrid and connid then pass these values to select query.
    One more thing is select cardinality 1..n for node NODE_FLIGHT since you are displaying more than one record.
    Go through the some basic tutorials.Search in sdn you will it get.Already there is a tutorial in sdn which explains exactly what do you require.
    Go throgh this link
    Web Dynpro for ABAP: Tutorials for Beginners
    Web Dynpro for ABAP: Tutorials for Beginners [original link is broken]
    Edited by: suman kumar chinnam on Mar 26, 2009 10:50 AM

  • 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

  • Passing table values from one webdypro screen to the next in BPM flow

    Hi,
    I have a BPM scenario where in User 1 will be entering data on a java webdynpro view in the form of a table. The user 1 should be able to edit contents of the table.
    These set of values in the table from User 1 needs to be passed to User 2 through BPM. The User 2 should be able to read the values edited by User 1 in the table.
    Please could you suggest how we could map the table attribute?
    With respect to Context Elements, I have a Node created for the table. But, the data doesnot seem to pass from User 1 to User 2.
    Any suggestions on this would be extemely helpful.
    Thank You.

    Hi,
    Please follow the below mentioned steps:
    Create a Human Activity containing the task(WebDynpro Task) to edit the table values.
    Create a data context of type (Context of the table node used in the Webdynpro task).
    Map the output of the human activity to the input of the data context.
    Create another human activity that contains the task to read the values of task1
    Assign this task to User 2
    Map the output of data context with the input of the second human activity.
    Regards,
    Gayathri

  • Table values are not passed to context.

    Hi,
    Im trying to build a online(WD ABAP) form with a BAPI which is having import, export and tables parameters.
    I have binded Datasource with main node and Template source I have binded with the form which I created with the form interface using context fromBAPI. Then I got all importing and exporting parameters. And tables I have got under Changing Node of Data View in the form. But there is one other node called Data is created automatically under changing node and under that DATA node I got Table and under that I got again Data Node created and there I have all the attributes.
    I dragged table on to the form. But when Im tesing the form by submitting, Im not getting table values which are entered in table. But all other values which are binded to importing parameters Im able to get the values.
    Can some one tell me how to get the values from table to context? And can I have dynamic table in the form to map to the context so that I can update the data through BAPI?
    Warm Regards,
    J.Smitha.

    Hi,
    Smitha, you can defnetly use dynamic table in interactive form. I had similar problem and I acheived like follwing:Basically you have to bind the table .
    If you want to have fixed number of rows in the interactive form, then in wddoinit method bind the internal table to ur table node. for exmaple: if u want 2 rows in the form loop times . So by default when you open the form you will get two rows for the table.
    **************BIND THE ITAB ****************************
    DO 2 TIMES.
    APPEND LW_LFBK TO LT_LFBK.
    CLEAR LW_LFBK.
    ENDDO.
    CALL METHOD lo_nd_t_lfbk->bind_table
    EXPORTING
    new_items = LT_LFBK.
    If you want to have dynmic table then take a submit button in the form instead of normal button,
    in onaction submit write a loop every time you click that new submit button it should add a new row.
    use above coding in onactionsubmit instead of doinit.
    Thats it.
    Regards,
    Ravi

  • Using View Tables in SQ01 and SQ02, getting 'Not Authorized to Read Table'

    We are trying to use a SAP Standard View Table (CAUFV) in an SQ01 and SQ02 transaction. Even though there is no Authorization Group assigned to the View we still get "You have no authorization to read table caufv' when running the linked transaction. We tried assigning the CA and KA authorization groups to the role and got the same results. (The tables used to create the View are AFKO and AUKF and thier Authorization groups are CA and KA.) We tried other views and received the same results. Does anyone have any experience with this?

    Hello Chuck,
    There are 2 ways to restrict this
    1: The user should be a part of at least one user group to run the corresponding ABAP query. This automatically restricts the access of the user to specific functional areas, and thus the corresponding underlying logical databases.
    2: The authorization object S_QUERY should be used to give proper authorizations to the user for a query. This authorization object has a field named ACTVT, which can take values 02 for Change, 23 for Maintain and 67 for Translate.
    This value determines whether the user can create and modify the query. The possible authorizations in the object are as follows:
    S_QUERY_ALL          Change, maintain and translate query
    S_QUERY_UPD         Change and Translate

  • 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

  • Updating XML thru view table

    Given the following view table that i created
    CREATE OR REPLACE VIEW PO_DETAIL_VIEW ( PAYLOADID,
    ORDERNUMBER, LINENUMBER, SHIPPEDITEMQTY, COST,
    ORDEREDITEMQTY, ACTION, UOM, DESCRIPTION,
    SKU, STATUS, CURRENCY, PLANNEDRECEIPTDATETIME
    ) AS select extractValue(value(p),'/OrderMessage/MessageHeader/@payloadId'),
              extractValue(value(p),'/OrderMessage/Order/@orderNumber'),
              extractvalue(value(i),'/OrderLine/@lineNumber'),
    extractvalue(value(i),'/OrderLine/@shippedItemQty'),
    extractvalue(value(i),'/OrderLine/@cost'),
    extractvalue(value(i),'/OrderLine/@orderedItemQty'),
    extractvalue(value(i),'/OrderLine/@action'),
    extractvalue(value(i),'/OrderLine/@uom'),
    extractvalue(value(i),'/OrderLine/@description'),
              extractvalue(value(i),'/OrderLine/@sku'),
              extractvalue(value(i),'/OrderLine/@status'),
              extractvalue(value(i),'/OrderLine/@currency'),
              extractvalue(value(i),'/OrderLine/@plannedReceiptDateTime')
    from PURCHASEORDER p, table(xmlsequence(extract(value(p),'/OrderMessage/Order/OrderLine'))) i
    when i executed the following command:
    UPDATE po_detail_view
    SET ORDERNUMBER = '500001' where PAYLOADID='1'
    I get end of file error which disconnect me from my oracle database.
    but when i update my another view table it is fine.
    CREATE OR REPLACE VIEW PO_MASTER_VIEW ( VERSION,
    PAYLOADID, TIMESTAMP, SENDERNAME, SENDERCOMPONENT,
    DOCUMENTREFERENCEID, SINGLETRANSACTION, INDEX0, INDEX1,
    INDEX2, INDEX3, CLOSED, ORDERNUMBER,
    ORDERTYPE, UNIQUEBUSINESSKEY, HANDLINGCODE, BUYERID,
    BUYERPARTYNAME, BUYERROLE ) AS select extractValue(value(p),'/OrderMessage/MessageHeader/@version'),
    extractValue(value(p),'/OrderMessage/MessageHeader/@payloadId'),
    extractValue(value(p),'/OrderMessage/MessageHeader/@timeStamp'),
    extractValue(value(p),'/OrderMessage/MessageHeader/@senderName'),
    extractValue(value(p),'/OrderMessage/MessageHeader/@senderComponent'),
    extractValue(value(p),'/OrderMessage/MessageHeader/@documentReferenceId'),
    extractValue(value(p),'/OrderMessage/MessageHeader/@singleTransaction'),
    extractValue(value(p),'/OrderMessage/MessageHeader/HeaderIndexedAttribute[1]/@content'),     
    extractValue(value(p),'/OrderMessage/MessageHeader/HeaderIndexedAttribute[2]/@content'),               
    extractValue(value(p),'/OrderMessage/MessageHeader/HeaderIndexedAttribute[3]/@content'),
    extractValue(value(p),'/OrderMessage/MessageHeader/HeaderIndexedAttribute[4]/@content'),
    extractValue(value(p),'/OrderMessage/Order/@closed'),
    extractValue(value(p),'/OrderMessage/Order/@orderNumber'),
    extractValue(value(p),'/OrderMessage/Order/@orderType'),
    extractValue(value(p),'/OrderMessage/Order/@uniqueBusinessKey'),
    extractValue(value(p),'/OrderMessage/Order/@handlingCode'),
    extractValue(value(p),'/OrderMessage/Order/Buyer/@Id'),
    extractValue(value(p),'/OrderMessage/Order/Buyer/@PartyName'),
    extractValue(value(p),'/OrderMessage/Order/Buyer/@Role')
    from PURCHASEORDER p
    UPDATE po_master_view
    SET VERSION = '2.0' where PAYLOADID='1'
    i can see that the problem lies with
    table(xmlsequence(extract(value(p),'/OrderMessage/Order/OrderLine'))) i
    is there any better way or solutions to work ard with it?
    Thanks.

    Thanks Mark,
    That's what i suspected the case, will log the itar later when i am free.
    Actually my main issue is that I am using forms 9i to view and edit the view tables that are based on the xml schema. Forms is giving me problem in accessing complicating views.
    I think my only solution is to:
    1)create a custom table updated by the view table.
    2)Create my form block based on custom table.
    3)update the xml data using updateXML() from the custom table.

  • 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

  • Bug when viewing tables?

    There seems to be a bug when viewing tables with identical names in different schemas in SQL Developer. When I view table information in one schema and then go to a table with identical name in another schema the view isn't updated, it still shows the information for the table from the first schema. I have to select another table in the second schema before I select the table I want to look at to get the information correct.
    I have the same problem with views, so this is probably the case for all kinds of objects.
    Regards,
    Sveinung

    I have found that the problem is even more specific. It occurs only when I view schemas in different databases.
    I am not sure that I understand what you mean about abstracted script. I have tried to create a simple test case with two scripts, one for each database, that creates a table, inserts some data and creates a view on the table.
    I have not found a way to upload files, so I have pasted the contents into this thread along with a description of the steps in the GUI. I have run the scripts on Oracle 10g (10.2.0.3.0) databases.
    -- SCRIPT 1
    CREATE TABLE test_table
    col_1 NUMBER,
    col_2 VARCHAR2(6)
    INSERT INTO test_table VALUES (1, 'ROW 1')
    INSERT INTO test_table VALUES (2, 'ROW 2')
    INSERT INTO test_table VALUES (3, 'ROW 3')
    INSERT INTO test_table VALUES (4, 'ROW 4')
    INSERT INTO test_table VALUES (5, 'ROW 5')
    COMMIT
    CREATE VIEW test_view AS SELECT * FROM test_table
    -- END SCRIPT 1
    Run script 1 in some schema in a database.
    -- SCRIPT 2
    CREATE TABLE test_table
    col_1 NUMBER,
    col_2 VARCHAR2(6),
    col_3 VARCHAR2(12)
    INSERT INTO test_table VALUES (1, 'ROW 1', 'COL 3 ROW 1')
    INSERT INTO test_table VALUES (2, 'ROW 2', 'COL 3 ROW 2')
    INSERT INTO test_table VALUES (3, 'ROW 3', 'COL 3 ROW 3')
    INSERT INTO test_table VALUES (4, 'ROW 4', 'COL 3 ROW 4')
    INSERT INTO test_table VALUES (5, 'ROW 5', 'COL 3 ROW 5')
    INSERT INTO test_table VALUES (6, 'ROW 6', 'COL 3 ROW 6')
    INSERT INTO test_table VALUES (7, 'ROW 7', 'COL 3 ROW 7')
    COMMIT
    CREATE VIEW test_view AS SELECT * FROM test_table
    -- END SCRIPT 2
    Run script 2 in some schema in another database.
    Connect to the two databases in SQL Developer.
    Select the table in the first database, then select Data.
    Then select the table in the other database. In my system the data are not refreshed. This is also the case when I look at the views.
    Hope this description is good enough.
    Sveinung

  • View table T005F

    I am not able to view table T005F through Tcode: SM30. Is there a way I can view it to make new entries or upload County codes in mass?
    Please help me out.
    Regards
    Ranjani

    Hi Ranjani,
    Table Maintenance Generator is not created for the Table T005F. So we can't maintain entries via SM30.
    But Table Maintenance is allowed for table T005F therefore we can maintain entries from SE16N itself.
    STEPS:
    Goto SE16N, Enter the Table name T005F, Click Execute button.
    2. System generates the ALV report based on the condition given.
    We can maintain entries from ALV report,
    Insert New RecordUsing the Insert Button, we can Insert record at any place by placing the cursor.
    Append New RecordUsing the Append Button, we can Insert new record at the end of the Table.
    Delete the Existing RecordUsing the Delete Button, Delete the current record which is selected
    Modify the ValueWe can Modify the Existing record by changing the value and then click save button
    Copy - Duplicate RecordUsing Duplicate Record Button, system creates the duplicate record
    Click Save button after the above modification done.
    Regards
    Rajkumar Narasimman

  • Viewing Tables

    Hi All,
    I am new to SAP so need help.
    Please let me know the way to see the table values. Also let me know how to  see the SAP Standard Program.
    Thanks,
    Prabhat

    Please do not ask for such basic things. Using the search function of the forum or even Google you can find the answer for your question.
    (SE16/SE16N --> vie content of table; SE38 / SE80 --> view ABAP program)

  • Standard report to view Sales value with Cost price

    Dear All,
    Is there any standard report to view Sales value for a particular period for  customer's comparing with Cost value. For Example,
       Customer     Month           Sales Value     Cost value
        A                 April '10         10,000/-             ?
        A                 May '10            5,000/-             ?
        B                 April '10          15,000/-            ?
        C                 June '10           20,000/-           ?
        C                 July '10           10,000/-            ?  
    Regards
    KS

    Hi,
    There is no report which gives customer wise sales figures and their cost structure. Cost structure is something which has to be taken from material master or using MM material documents.
    However you can very easily create a report. You can use VBAK, VBAP, MBEWH, MBEW and MSEG tables to arrive at these figures

  • Selecting multiple rows a table according to rows passed with a table valued parameter

    Ive got a table, which looks like this:
    CREATE TABLE MyTable (
    MyChars CHAR(3) NOT NULL,
    MyId INT NOT NULL,
    CONSTRAINT PK__MyTable_MyChars_MyId PRIMARY KEY (MyChars, MyId),
    CONSTRAINT FK__MyOtherTable_Id_MyTable_MyId FOREIGN KEY (MyId) REFERENCES MyOtherTable (Id)
    Records look like i.e.:
    Chars | Id
    'AAA' | 1
    'BBB' | 1
    'CCC' | 1
    'AAA' | 2
    'BBB' | 2
    'CCC' | 2
    'DDD' | 2
    'EEE' | 3
    'FFF' | 3
    'AAA' | 4
    'DDD' | 4
    'FFF' | 4
    Now I have a SP, which takes a table valued parameter like:
    CREATE TYPE dbo.MyTVP AS TABLE ( MyChars CHAR(3) )
    This SP should return a set of Ids, which match all the rows of the parameter.
    I.e.:
    if the TVP contains 'AAA', 'BBB' & 'CCC', i get as result 1 & 2
    if the TVP contains 'AAA' & 'FFF', i get as result 4
    if the TVP contains 'BBB' & 'EEE', i get an empty result
    What my SP is currently doing, is to build a query with string concatination, which is then executed with the EXEC statement. If we take my first example, the built query would look like this:
    SELECT DISTINCT t0.MyId
    FROM MyTable t0
    INNER JOIN MyTable t1 ON t0.MyId = t1.MyId
    INNER JOIN MyTable t2 ON t1.MyId = t2.MyId
    WHERE t0.MyChars = 'AAA' AND t1.MyChars = 'BBB' AND t2.MyChars = 'CCC'
    It works, but I'm not very fond of building the query. Maintaining such things is always a pain. And it also might not be the most efficient and elegant way to do this.
    Since I can't think of any other way of doing this, I wanted to ask, if someone of you got an idea, if there is a better way to accomplish this.

    Let me give you a "cut and paste" I use in the SQL Server groups:
    1) The dangerous, slow kludge is to use dynamic SQL and admit that any random future user is a better programmer than you are. It is used by Newbies who do not understand SQL or even what a compiled language is. A string is a string; it is a scalar value like
    any other parameter; it is not code. Again, this is not just an SQL problem; this is a basic misunderstanding  of programming principles. 
    2) Passing a list of parameters to a stored procedure can be done by putting them into a string with a separator. I like to use the traditional comma. Let's assume that you have a whole table full of such parameter lists:
    CREATE TABLE InputStrings
    (keycol CHAR(10) NOT NULL PRIMARY KEY,
     input_string VARCHAR(255) NOT NULL);
    INSERT INTO InputStrings 
    VALUES ('first', '12,34,567,896'), 
     ('second', '312,534,997,896'),
     etc.
    This will be the table that gets the outputs, in the form of the original key column and one parameter per row.
    It makes life easier if the lists in the input strings start and end with a comma. You will need a table of sequential numbers -- a standard SQL programming trick, Now, the query, 
    CREATE VIEW ParmList (keycol, place, parm)
    AS
    SELECT keycol, 
           COUNT(S2.seq), -- reverse order
           CAST (SUBSTRING (I1.input_string
                            FROM S1.seq 
                             FOR MIN(S2.seq) - S1.seq -1) 
             AS INTEGER)
      FROM InputStrings AS I1, Series AS S1, Series AS S2 
     WHERE SUBSTRING (',' + I1.input_string + ',', S1.seq, 1) = ','
       AND SUBSTRING (',' + I1.input_string + ',', S2.seq, 1) = ','
       AND S1.seq < S2.seq
     GROUP BY I1.keycol, I1.input_string, S1.seq;
    The S1 and S2 copies of Series are used to locate bracketing pairs of commas, and the entire set of substrings located between them is extracted and cast as integers in one non-procedural step. The trick is to be sure that the right hand comma of the bracketing
    pair is the closest one to the first comma. The relative position of each element in the list is given by the value of "place", but it does a count down so you can plan horizontal placement in columns. 
    This might be faster now:
    WITH Commas(keycol, comma_seq, comma_place)
    AS
    (SELECT I1.keycol, S1.seq,
    ROW_NUMBER() OVER (PARTITION BY I1.keycol ORDER BY S1.seq)
    FROM InputStrings AS I1, Series AS S1
    WHERE SUBSTRING (',' || I1.input_string || ',' 
    FROM S1.seq 
    FOR 1) = ',' 
    AND S1.seq <= CHARLENGTH (I1.input_string))
    SELECT SUBSTRING(',' || I1.input_string || ','
    FROM C1.comma_place +1
    FOR C2.comma_place - C1.comma_place - 1)
    FROM Commas AS C1, Commas AS C2
    WHERE C2.comma_seq = C1.comma_seq + 1 
    AND C1.keycol = C2.keycol;
    The idea is to get all the positions of the commas in the CTE and then use (n, n+1) pairs of positions to locate substrings. The hope is that the ROW_NUMBER() is faster than the GROUP BY in the first attempt. Since it is materialized before the body of
    the query (in theory), there are opportunities for parallelism indexing and other things to speed up the works. 
    Hey, I can write kludges with the best of them, but I don't. You need to at the very least write a routine to clean out blanks, handle double commas and non-numerics in the strings, take care of floating point and decimal notation, etc. Basically, you must
    write part of a compiler in SQL. Yeeeech!  Or decide that you do not want to have data integrity, which is what most Newbies do in practice altho they do not know it. 
    A procedural loop is even worse. You have no error checking, no ability to pass local variables or expressions, etc. 
    CREATE PROCEDURE HomemadeParser(@input_string VARCHAR(8000))
    AS
    BEGIN
    DECLARE @comma_position INTEGER;
    CREATE TABLE #Slices
    (slice_value INTEGER);
    SET @input_string = @input_string + ','; --add sentinel comma
    SET @comma_position = CHARINDEX(',', @input_string); 
    WHILE @comma_position > 1
      BEGIN
      INSERT INTO #Slices (slice_value)
      VALUES(CAST(LEFT(@input_string, (@comma_position - 1)) AS INTEGER)); 
      SET @input_string = RIGHT(@input_string, LEN(@input_string)-@comma_position)
      SET @comma_position = CHARINDEX(',', @input_string)
      END;
    END;
    Better answer:
    http://www.simple-talk.com/sql/learn-sql-server/values()-and-long-parameter-lists/
    http://www.simple-talk.com/sql/learn-sql-server/values()-and-long-parameter-lists---part-ii/
    Do this with a long parameter list. You can pass up to 2000+ parameters in T-SQL, which is more than you probably will ever need. The compiler will do all that error checking that the query version and the procedural code simply do not have unless you write
    a full parser with the standard error codes. You can now pass local variables to your procedure; you can pass other data types and get automatic conversions, etc. In short, this is just good software engineering. 
    CREATE PROCEDURE LongList
    (@p1 INTEGER = NULL,
     @p2 INTEGER = NULL,
     @p3 INTEGER = NULL,
     @p4 INTEGER = NULL,
     @p5 INTEGER = NULL)
      x IN (SELECT parm
              FROM (VALUES (@p1), (@p2), (@p3), (@p4), (@p5)) AS X(parm)
            WHERE parm IS NOT NULL;
    You get all the advantages of the real compiler and can do all kinds of things with the values. 
    --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

Maybe you are looking for

  • My new mac pro tower might have died but i cannot tell. help

    Left on my mac pro tower 4-core with 3 gigs of ram on all night as I often do. I merely power down the apple 23" monitor because that's the only that heats up. Came down in the morning, turned on the monitor and all I see is a white screen. just all

  • Create table error

    hi While creating table (only structure) i m gettting this error ERROR at line 2: ORA-01401: inserted value too large for column ON CUSVAA (INST_NO, ERROR at line 2: ORA-00942: table or view does not exist i m only creating structure not inserting an

  • My MacBook Pro suddenly lost one of my printers

    My MacBook Pro suddenly can't find one of my Epson printers.  It is brand-new, has Mavericks installed, and was printing just fine before.

  • Service Controll Manager error, Win2000 Server

    When I try start the Oracle Management Server in the services I got an error message: Error 997: Overlapped I/O operation is in progress. What could be caused this error? What is the solution? Please help! Thanks in advance!

  • Cascading LOVs (v4) and retaining the child value

    I've implemented the default delivered implementation in version 4 (4.0.2.00.07 to be exact) of cascading LOVs. Working fine except for one thing...after refresh of a child LOV, the previously selected value is wiped out even when it's still a valid