DATA foo TYPE ANY TABLE possible? - abap

I have the following problem:
I'm testing many BAPI's and dont want to create a Table with the corosponding types for the rows, each time I call a new BAPI.
Is it possible to generate s.th. like a generic table like:
DATA foo TYPE ANY TABLE.
and use this to put it as the table parameter to get the result of the bapi?

No, this is not possible - you can't declare variables using a generic type. However, you could try to determine the data type (e. g. using RPY_FUNCTIONMODULE_*) and then use CREATE DATA to create the table dynamically using a reference. Check the documentation of CREATE DATA for an example.

Related

How to find table type for a data element?

I create a new function modul in abap which should return a list of the data element AGVAL.
AFAIK there are two ways now:
I use an already available table type
I create a new table type
How to do this kind of introspection? I would like to now if there is already a table type with one column, which is of type AGVAL?
you can enter your element type in TA SE11 as Data Type.
Go to display and use the Where-Used-List to search for table fields / strucure fields to find the usage of this data element.
Regards
Max
I don't know any option else but using SQL to query the ABAP dictionary directly.
For instance, this query extracts all table types having a structure whose first component has the data element SO_TEXT255 (and which is not embedded in a nested structure) :
SELECT * FROM DD40L
WHERE ROWKIND = 'S'
and ROWTYPE in (
select TABNAME from DD03L
where POSITION = 1
and ROLLNAME = 'SO_TEXT255' )
Of course, it doesn't restrict to structures with only this one component but you may adapt it a little bit.
If you do not stick purely to ABAP-way it is done via SE11 in a very simple way.
Search by table types
Choose search type as "by reference line"
That's it!

How to get straight table values or table data into an variable in Qlikview?

How to get straight table values or table data into an variable in Qlikview ?
As I am going to use the table data in Javascript fetched through variable and generate PPT reports using pptxgenjs library.
Use something like let MyVar = peek(...) (see documentation for peek() here).
If you need to merge values from multiple fields you should do that first using the scripting function concat() to load those values into a string in a new (temporary) table, and use peek on that table.

How to check if a field is present in a particular view or table using ABAP

I have list of 100 views for which I need to check if those views have fields A and B. If any of those 100 views uses those two fields, I need to display a message. Any existing function module will help.
Sujeet,
Function module ISB_TABLE_READ_FIELDS accepts a table or view name and returns a table of fields on the structure. If you don't have this function module, you can write your code to select entries from table DD03L, which is keyed on table name and contains all of the fields on all database table structures.
Once you have the list of fields, the code to implement the logic you want should be trivial.
I doubt there is an existing SAP Function Module to do this - I suspect you will have to write some ABAP or do some Excel manipulation.
I would expect that there is a table within SAP which defines views - I'm not sure which though.
If no-one suggests anything else I would use ST05 - "SQL Trace" to see which tables SAP reads when you call SE12 to look at the view you are interested in. You can look at the SELECT statements and see which tables it reads to get the view definition.
I just tried pressing F1 on a field in SE12 for a view to see if there was a mention of a table. The technical info made reference to a structure containing the string "DD27" - I had a look in SE16 for tables with similar names and DD27SV looks like it might help.
Have a look and see what you think - you'd need to query that table in some ABAP or extract to Excel and do equivalent manipulation there.

dynamically generated parent key into another query

I have to take a value from one table which I have just added using seq.nextval(say Query 1) into another table for entering further information into another table through Query 2.I have used objects to pass values to the sql(oracle).I am using Spring framework's JDBCTemplate.
Can you help me with that.
Thank you.
use seq.currval to get the current value of the sequence, and include that in your subsequent insert.

query a table not in normal 3rd form

Hi I have a table which was designed by a lazy developer who did not created it in 3rd normal form. He saved the arrays in the table instead of using MM relation . And the application is running so I can not change the database schema.
I need to query the table like this:
SELECT * FROM myTable
WHERE usergroup = 20
where usergroup field contains data like this : 17,19,20 or it could be also only 20 or only 19.
I could search with like:
SELECT * FROM myTable
WHERE usergroup LIKE 20
but in this case it would match also for field which contain 200 e.g.
Anybody any idea?
thanx
Fix the bad database design.
A short-term fix is to add a related table for the correct structure. Add a trigger to parse the info in the old field to the related table on insert and update. Then write a script to [parse out existing data. Now you can porperly query but you haven't broken any of the old code. THen you can search for the old code and fix. Once you have done that then just change how code is inserted or udated inthe orginal table to add the new table and drop the old column.
Write a table-valued user-defined function (UDF in SQL Server, I am sure it will have a different name in other RDBMS) to parse the values of the column containing the list which is stored as a string. For each item in the comma-delimited list, your function should return a row in the table result. When you are using a query like this, query against the results returned from the UDF.
Write a function to convert a comma delimited list to a table. Should be pretty simple. Then you can use IN().