Building Dynamic Tables in UIX
I have a two dimensional array of data generated at runtime that I'd like to place in a UIX table. I'm not quite sure how to set up said table. I've come up with two ideas, neither of which seem to be panning out.
1) Set up a TableBean in Java and include it on the page. This is the close of the two solutions, but I receive the error "Table has no visible columns!" I'm setting the ColumnHeader and TableData, but I seem to be missing the column definitions. Reading through the TableBean javadoc, I am unable to find what field the column definitions are stored in.
2) Set up the table in UIX. I've had less luck with this. I'm not sure (I'm betting no from what I've seen) if I can set up an inner loop on a 2-D array using <contents childData>
Does anyone know how to build my table or have any other helpful suggestions? Thanks.
Matt,
I am trying to build a dynamic table using a table bean. The columns display fine using the code below:
ColumnBean column = new ColumnBean();
column.setColumnHeader(new StyledTextBean("Col1", null));
table.addIndexedChild(column);
For the rows: I have created the following structure:
DataObjectList listA;
for (i=0; i < no_of_rows; i++)
myArray[i1] = new Integer(rs.getInt(4));
//myArray is an array of Integers
listA = new BeanArrayDataObjectList(myArray);
dd = new DictionaryData("testRows", listA);
and then try to add the rows using:
table.setTableData(listA);
for (int i2=0; i2 < myArray.length; i2++)
table.setTableDataBinding(myArray[i2].toString());
But the row data does not display. Is setTableDataBinding the right thing to do to display the data?
Please can you help.
Thanks,
Paami
Similar Messages
-
Item Number in Dynamic Table Quirk
I'm a new LC user, ramping up to speed on this package, thanks to everyone for the useful information here and other places.
Using the great advice and info here,
http://www.assuredynamics.com/wp-content/uploads/2010/11/Assure-Dynamics-Building-dynamic- tables.pdf
I added a dynamic table to a form I've been working on. Most everything works, except the caption on the Row/Item number. So, I yanked out the subform with the table on it to create a simpler copy of the form to post here. Get this... it works on the simple form. So, there's something going on on my not so simple form that is preventing my Row/Item number from working.
I'm hoping that if I post both forms here, someone can help me fix this thing.
this is the form that works:
http://inthequeue.com/adobeLC/Template_excerpt.pdf
this is the form that does not work:
http://inthequeue.com/adobeLC/Template_std.pdf
Thanks in advance
John Q.Hi John,
Try changing the code in the layout:ready event from;
this.caption.value.text = (this.parent.index + 1).toString();
To;
this.caption.value.text.value = (this.parent.index + 1).toString();
That is add another ".value".
Your form that works targets Reader 8.0 or later and the one that doesn't Targets Reader 9.0 or later, I'm guessing that is the difference.
Regards
Bruce -
Build dynamic query depending upon selection of table and columns
Hi ,
I want your views on following requirement :
we r doing generic export to excel functionality .
1.User will select multiple tables and according to tables ,columns on that table will select
2.There can be multiple table
3.depending upon column and table selection , we have to build dynamic query and execute .
Please let me know is it possible .If yes then please tell me how to do above requirement.
Thanks in advanceHi,
Identifiers cannot be used as bind variables, query are parsed
before evaluate bind variables. Identifiers like table name.
For excel you can use some like this:
SET MARKUP HTML ON ENTMAP ON SPOOL ON PREFORMAT OFF
SPOOL test_xls.xls
SELECT colum1||chr(9)||columN FROM tableName;
or CSV:
SELECT colum1|| ',' ||columN FROM tableName;
SPOOL OFF
SET MARKUP HTML OFF ENTMAP OFF SPOOL OFF PREFORMAT ON
For construct the query i suggest to read "Dynamic SQL Statements":
http://www.java2s.com/Tutorial/Oracle/0440__PL-SQL-Statements/0300__Dynamic-SQL.htm
http://docs.oracle.com/cd/B28359_01/appdev.111/b28370/dynamic.htm
http://docs.oracle.com/cd/B10500_01/appdev.920/a96590/adg09dyn.htm
http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:227413938857
--sgc -
I have searched for a bit in the forums and documentation for something like this, and have found nothing.
I would like to be able to have Dynamic table columns, with dynamic content in the table.
I would like the ability to add non-dynamic rows to the table, placed where I like them.
Does anyone know how to do this?I am creating a report that counts a number of events per hour, each day.
the layout will look like this:
0 1 2 3 4 5 6 7 total
day1 3 3 4 5 4 3 2 3 230
day2 4 3 2 3 4 2 3 4 235
day3 3 2 2 2 2 3 2 1 310
total 9 9 9 9 9 9 9 9 1393
The user must be able to select the range of days they can see (might be a week, might be a month, might be a year).
Also, the user can select the range of hours that they want visibile.
becaus they can select the number of hours, I need to be able to dynamically create the columns to the table, according to the user's selection.
The report is a very processor consuming report, as there are thousands of events per hour, so I want to trim the atcual data crunching to a minimum.
can anyone help with dynamic tables? -
Error while insert data using execute immediate in dynamic table in oracle
Error while insert data using execute immediate in dynamic table created in oracle 11g .
first the dynamic nested table (op_sample) was created using the executed immediate...
object is
CREATE OR REPLACE TYPE ASI.sub_mark AS OBJECT (
mark1 number,
mark2 number
t_sub_mark is a class of type sub_mark
CREATE OR REPLACE TYPE ASI.t_sub_mark is table of sub_mark;
create table sam1(id number,name varchar2(30));
nested table is created below:
begin
EXECUTE IMMEDIATE ' create table '||op_sample||'
(id number,name varchar2(30),subject_obj t_sub_mark) nested table subject_obj store as nest_tab return as value';
end;
now data from sam1 table and object (subject_obj) are inserted into the dynamic table
declare
subject_obj t_sub_mark;
begin
subject_obj:= t_sub_mark();
EXECUTE IMMEDIATE 'insert into op_sample (select id,name,subject_obj from sam1) ';
end;
and got the below error:
ORA-00904: "SUBJECT_OBJ": invalid identifier
ORA-06512: at line 7
then when we tried to insert the data into the dynam_table with the subject_marks object as null,we received the following error..
execute immediate 'insert into '||dynam_table ||'
(SELECT887684 wrote:
ORA-00904: "SUBJECT_OBJ": invalid identifier
ORA-06512: at line 7The problem is that your variable subject_obj is not in scope inside the dynamic SQL you are building. The SQL engine does not know your PL/SQL variable, so it tries to find a column named SUBJECT_OBJ in your SAM1 table.
If you need to use dynamic SQL for this, then you must bind the variable. Something like this:
EXECUTE IMMEDIATE 'insert into op_sample (select id,name,:bind_subject_obj from sam1) ' USING subject_obj;Alternatively you might figure out to use static SQL rather than dynamic SQL (if possible for your project.) In static SQL the PL/SQL engine binds the variables for you automatically. -
HR Logical database PNP. OO to fill table dynamic table from PNP ?
Hi all
I want to get some stuff from the HR logical database into a dynamic table
Here's a real simple example that writes info out to a normal list.
(report is based on using Logical DB PNP)
tables: pernr.
INFOTYPES: 0001, "Organizational Assignment
0002. "Personal Data
SELECT-OPTIONS: language FOR p0002-sprsl.
INITIALIZATION.
pnptimed = 'D'.
GET pernr.
PROVIDE * FROM p0002 BETWEEN pn-begda AND pn-endda.
CHECK language.
WRITE: / p0002-pernr,
sy-vline,
p0001-ename,
sy-vline,
p0002-sprsl,
sy-vline,
p0002-gbdat.
ENDPROVIDE.
endform.
Now what I want to do is replace the write stuff by appending the entries into a dynamic table which I will display as an ALV Grid.
so I add my structure in the data declarations
types: begin of s_elements,
pernr type p0002-pernr,
ename type p0001-ename,
sprsl type p0002-sprsl,
gbdat type p0002-gbdat.
drop_down_handle type int4.
types: end of s_elements.
include zz_jimbo_incl.
build the dynamic table
create data dref type s_elements.
assign dref->* to <fs>.
i_routine = 'POPULATE_DYNAMIC_ITAB'.*
i_names = 'NAME_COLUMNS'.
i_gridtitle = 'HR TEST'.
invoker = sy-repid.
i_zebra = 'X '.
i_edit = ' '.
call function 'ZZ_CALL_SCREEN'
exporting
invoker = invoker
my_line = <fs>
i_gridtitle = i_gridtitle
i_edit = i_edit
i_zebra = i_zebra
i_names = i_names
i_routine = i_routine
importing
z_object = z_object
dy_table = dy_table.
Now to populate the dynamic Itab the routine below is entered.
form populate_dynamic_itab changing dy_table.
assign dy_table->* to <dyn_table>.
create data dy_line like line of <dyn_table>.
assign dy_line->* to <dyn_wa>.
However I can't use GET / PROVIDE / ENDPROVIDE in a Form.
Anyway round this ---seems HR has an aversion to OO.
Cheers
jimboHi,
well, GET_PERNR is a so called event_statement. It has nothing to do with ABAP 00.
Normally it will be like this:
START-OF-SELECTION.
GET_PERNR.
PROVIDE ....
END-OF-SELECTION.
-> and here the CALL SCREEN NNNN for ALV-Display.
Provide-statements you can use in forms of course, and as many times you want during GET and END-OF-SELECTION.
But as I understood : you just want to save the write-statements?
I always develop a DDIC-Structure, declarate the data objects in the programm, read the data via Provide into the infotypes, and then make a move-corresponding to my structure. and display it.
Normally no problem.
kind regards
maik -
How to populate a dynamic table according to the choice of the viewer
Hi there,
I ran into a dead-end on my "Events" page.
There is a dynamic table getting the info from a database. It will initially show the Upcoming Events.
At this point my question is this:
*Can I populate the dynamic table based on a condition where the current date and the event date (as in the db) will be compared and if the event date is later than the current date, it will be displayed in the table. Otherwise, it won't.
If I can do that, can someone please help me out with the code?
Besides that, on the right side of the page there are 3 options for the viewer:
1. View upcoming events
2. View past events
3. Search events by month and year
What I want to do is that when the viewer clicks on 'past events', the table will be reset and populated with those events whose date has passed.
When the viewer clicks on "upcoming events", the table is reset again and populated with the relevant events.
When the viewer selects a month and a year, search the database to find the relevant records.
Can all of this be written in php? Since I read smwhere that php doesn't work with onclick functions... i got confused. Cuz the data in my table will have to vary depending on what the viewer is clicking (upcoming events/past events/search events). I do not wish to create separate pages for each type of event.
If anybody has a better suggestion to carry out this task, please share!
Thanks!>Can I populate the dynamic table based on a condition where the current date and the event date (as in the db)
>will be compared and if the event date is later than the current date, it will be displayed in the table. Otherwise, it won't.
Of course. You just need to compare the date field in your database with the current date as returned by your DBMS date function. Assuming you are using MySQL, you would compare your column with the currdate() function and use the appropriate greater than/ less than operators in the SQL WHERE clause. If you don't know what a WHERE clause is then I would urge you to learn SQL as soon as possible. You can't build data driven sites without a basic understanding of SQL.
>Since I read smwhere that php doesn't work with onclick functions..
What this means is that php is a server side language, where user interactions always occur at the client site. But that does not mean you can't invoke a server side action from a client side event. You most certainly can and would.
You might consider adding links to the dynamic table page that pass a querystring to the php script which determine what filter to add in the WHERE clause- greater than the current date, less than, etc.
Also, in the future, please post these questions to the application development forum. -
How can i insert into dynamic table ?
i have regular internal table with data .
i have dynamic table <dyn_tab>
i insert the data from itab
MOVE-CORRESPONDING ITAB TO <LS_LINE>.
INSERT <LS_LINE> INTO TABLE <DYN_TABLE>.
OK , NOW I WANT TO ADD THE DATA FROM OTHER TABLE
THAT HOLD THE DATA THAT ALL THE DYNAMIC TAB BUILD FOR
HOW CAN I DO THIS INSERT ?
I NEED TO INSERT "KOSTL" TO MATCH LINE in <DYN_TABLE>
THIS WHAT I TRIED TO DO :
SHIFT INDX1 LEFT DELETING LEADING SPACE.
CONCATENATE 'KOSTL' INDX1 INTO FIELD .
ASSIGN COMPONENT FIELD OF STRUCTURE <DYN_TABLE> TO <FS>.
<FS> = IT_EKKN-KOSTL.
but i get dump that <FS> not been assign .hi,
pls chk the sample code below.
REPORT zmaschl_create_data_dynamic .
TYPE-POOLS: slis.
DATA: it_fcat TYPE slis_t_fieldcat_alv,
is_fcat LIKE LINE OF it_fcat.
DATA: it_fieldcat TYPE lvc_t_fcat,
is_fieldcat LIKE LINE OF it_fieldcat.
DATA: new_table TYPE REF TO data.
DATA: new_line TYPE REF TO data.
FIELD-SYMBOLS: <l_table> TYPE ANY TABLE,
<l_line> TYPE ANY,
<l_field> TYPE ANY.
* Build fieldcat
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_structure_name = 'SYST'
CHANGING
ct_fieldcat = it_fcat[].
LOOP AT it_fcat INTO is_fcat WHERE NOT reptext_ddic IS initial.
MOVE-CORRESPONDING is_fcat TO is_fieldcat.
is_fieldcat-fieldname = is_fcat-fieldname.
is_fieldcat-ref_field = is_fcat-fieldname.
is_fieldcat-ref_table = is_fcat-ref_tabname.
APPEND is_fieldcat TO it_fieldcat.
ENDLOOP.
* Create a new Table
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
it_fieldcatalog = it_fieldcat
IMPORTING
ep_table = new_table.
* Create a new Line with the same structure of the table.
ASSIGN new_table->* TO <l_table>.
CREATE DATA new_line LIKE LINE OF <l_table>.
ASSIGN new_line->* TO <l_line>.
* Test it...
DO 30 TIMES.
ASSIGN COMPONENT 'SUBRC' OF STRUCTURE <l_line> TO <l_field>.
<l_field> = sy-index.
INSERT <l_line> INTO TABLE <l_table>.
ENDDO.
LOOP AT <l_table> ASSIGNING <l_line>.
ASSIGN COMPONENT 'SUBRC' OF STRUCTURE <l_line> TO <l_field>.
WRITE <l_field>.
ENDLOOP.
Regards
Anver
<i>if hlped pls mark points</i> -
Here's how to use DYNAMIC tables for almost any structure (4.6C onwards)
Hi guys
I'm describing a feature here that has been around since 4.6C that is not really well known but can really simplfy programming where you need to get data into some sort of internal table and then display it either as a classical list or as al ALV grid.
This feature is RTTI which allows you to retrieve your structure, build a dynamic FCAT (Field catalog) and a Dynamic table.
Here's a really quick little program which reads 200 entries from VAPMA into a dynamic table. Any structure will work if you use the code sample shown.
To pass it to an ALV GRID is then really simple as you've already got the Field Catalog, Table and Data.
The method I'm showing below will work for almost ANY structure you care to name whether or not the fields are in the data dictionary.
I create a dynamic FCAT and dynamic table based on the FCAT and then populate it.
You can create field catalogs dynamically quite simply by using the new RTTI facility available from 4.6C onwards.
(From here it's only a small step to dynamic tables and EASY ALV grid displays)
Example to create dynamic FCAT and table and populate it with 200 entries from VAPMA
PROGRAM ZZ_BUILD_FLDCATALOG.
tables: vapma.
Define any structure
types: begin of s_elements,
vbeln type vapma-vbeln,
posnr type vapma-posnr,
matnr type vapma-matnr,
kunnr type vapma-kunnr,
werks type vapma-werks,
vkorg type vapma-vkorg,
vkbur type vapma-vkbur,
status type c,
end of s_elements.
end of your structure
data lr_rtti_struc type ref to cl_abap_structdescr .
data:
zog like line of lr_rtti_struc->components .
data:
zogt like table of zog,
wa_it_fldcat type lvc_s_fcat,
it_fldcat type lvc_t_fcat ,
dy_line type ref to data,
dy_table type ref to data.
data: dref type ref to data.
field-symbols: <fs> type any,
<dyn_table> type standard table,
<dyn_wa>.
*now I want to build a field catalog
*First get your data structure into a field symbol
create data dref type s_elements.
assign dref->* to <fs>.
lr_rtti_struc ?= cl_abap_structdescr=>describe_by_data( <fs> ).
zogt[] = lr_rtti_struc->components.
Now build the field catalog. zogt has the structure in it from RTTI.
loop at zogt into zog.
clear wa_it_fldcat.
wa_it_fldcat-fieldname = zog-name .
wa_it_fldcat-datatype = zog-type_kind.
wa_it_fldcat-inttype = zog-type_kind.
wa_it_fldcat-intlen = zog-length.
wa_it_fldcat-decimals = zog-decimals.
wa_it_fldcat-coltext = zog-name.
wa_it_fldcat-lowercase = 'X'.
append wa_it_fldcat to it_fldcat .
endloop.
Let's create a dynamic table and populate it
call method cl_alv_table_create=>create_dynamic_table
exporting
it_fieldcatalog = it_fldcat
importing
ep_table = dy_table.
assign dy_table->* to <dyn_table>.
create data dy_line like line of <dyn_table>.
assign dy_line->* to <dyn_wa>.
select vbeln posnr matnr kunnr werks vkorg vkbur
up to 200 rows
from vapma
into corresponding fields of table <dyn_table>.
from here you can pass your table to a GRID for display etc etc.
Cheers
JimboThanks for the info.
I went to their web site and also Googled.
I found a great review on their photographer's books on nikonians.org
They use an HP/Indigo Ultrastream 3000 digital offset press for all hardcover books, which is GREAT!
I did sign up and requested the 45 day trial "photographer" account.
I am curious if Shared Ink offers a size that matches the ONLY current book size from Aperture, the odd 8.5x11.
In the above review, I saw that Shared Ink offers a 12x12 book.. very nice! Except you will need to design that one in CS2
So then, all that Apple really needs to do is simply add the ability to select/create custom book sizes. Then we don't need a printing service from Apple, as there are plenty of options out there, and more arriving on the market each month! -
How to create bindings at runtime for Dynamic Tables ?
We have lot of Dynamic tables, In ADF, we need to try out the Dynamic EO, Dynamic VO, Dynamic DataControl and Dynamic binding for UI
Ex:
We need to load the data to the ADF table where database table name is dynamic, the columns in the tables are also dynamic. At runtime , we need to create VO, Dynamic binding and display to UI? We also should be able to add, delete,update records in the dynamic tables.
Does anyone done this before? Please shared your thoughts on thisHi,
for a table you can declaratively build a tree binding. Then you remove all the attribute items in the tree definition so that the number of attributes is dynamic. See: https://blogs.oracle.com/groundside/entry/towards_ultra_reusability_for_adf
Frank -
Footer overflow in dynamic table
Hi,
great forum here.. so i have a problem with livecycle form...
I build up a form with a dynamic table, adding rows with a click on "+".
The footer is working correctly ( once visible on the end of the table, not repeated) .
One cell in the first row is growing automatically, depending on the text which is entered.
If the table does not fit on the page ( because of the added rows or because of the text in the cell ) , there is a break and the table is continuing on the second page.
These work fine.
Problem:
But if the table is broken on the second page, and i will click "+" for adding new rows, 1 or 2 rows are added on the first page;
because there is space left, because of the footer, which is now on the second page.
changing the free-area on master page did not help me.
my given conditions are:
the footer have to be tied on the last row of the table, that means: if the table is broken, at least one row should appear on the second page.
Can anybod help me please ?
here is my document:
http://acrobat.com/#d=bQadx7MnDYcNxLTLDCDdfg
thanksDid you set the permission to allow everybody to view the file on acrobat.com? I am able to log in to acrobat.com - and I am logged in, but it tells me I need the latest Flash Player. I have just installed the latest and rebooted my iMac, but I still can't access your file. So I can't view your table...
One way around this is to create the table from individual objects, i.e., if each row has one Text and one Numeric cell = two cells per row, then
drag a Text field onto the Layout page, followed by a Numeric field.
wrap them in a subform.
Now you have your row. Then add the leader (header) and/or trailer (footer) objects. Proceed from here with your '+' and so forth.
Conclusion - a table doesn't have to start with the formal Table object. You can create your own manual (more flexible) table. -
ABAP dynamic tables add fields
Hi, i have to extend a dynamic table like this:
FIELD-SYMBOLS: <g_data> TYPE table.
I have to build a custom structure with all the fields
of g_data plus some other fixed fields.
In other words if g_data looks like this
AUFNR POSNR
100 10
200 20
My structure must be:
AUFNR POSNR F1 F2
100 10 23 21
200 20 234 32
Thanks in advance.
Is anybody here who haves some ideasHere is a sample program of how to build a dynamic internal table.
report zrich_0003
no standard page heading.
type-pools: slis.
field-symbols: <dyn_table> type standard table,
<dyn_wa>.
data: alv_fldcat type slis_t_fieldcat_alv,
it_fldcat type lvc_t_fcat.
selection-screen begin of block b1 with frame title text-001.
parameters: p_check type c.
selection-screen end of block b1.
start-of-selection.
perform build_dyn_itab.
perform build_report.
loop at <dyn_table> into <dyn_wa>.
write:/ <dyn_wa>.
endloop.
* Build_dyn_itab
form build_dyn_itab.
data: index(3) type c.
data: new_table type ref to data,
new_line type ref to data,
wa_it_fldcat type lvc_s_fcat.
clear wa_it_fldcat.
wa_it_fldcat-fieldname = 'AUFNR'.
wa_it_fldcat-datatype = 'CHAR'.
wa_it_fldcat-intlen = 12.
append wa_it_fldcat to it_fldcat .
clear wa_it_fldcat.
wa_it_fldcat-fieldname = 'POSNR'.
wa_it_fldcat-datatype = 'CHAR'.
wa_it_fldcat-intlen = 6.
append wa_it_fldcat to it_fldcat .
* Create fields
clear index.
do 2 times.
index = sy-index.
clear wa_it_fldcat.
concatenate 'Field' index into
wa_it_fldcat-fieldname .
condense wa_it_fldcat-fieldname no-gaps.
wa_it_fldcat-datatype = 'CHAR'.
wa_it_fldcat-intlen = 5.
append wa_it_fldcat to it_fldcat .
enddo.
* Create dynamic internal table and assign to FS
call method cl_alv_table_create=>create_dynamic_table
exporting
it_fieldcatalog = it_fldcat
importing
ep_table = new_table.
assign new_table->* to <dyn_table>.
* Create dynamic work area and assign to FS
create data new_line like line of <dyn_table>.
assign new_line->* to <dyn_wa>.
endform.
* Form build_report
form build_report.
data: fieldname(20) type c.
data: fieldvalue(5) type c.
data: index(3) type c.
field-symbols: <fs1>.
assign component 'AUFNR' of structure <dyn_wa> to <fs1>.
<fs1> = '123456789'.
assign component 'POSNR' of structure <dyn_wa> to <fs1>.
<fs1> = '000001'.
do 2 times.
index = sy-index.
* Set up fieldname
concatenate 'FIELD' index into
fieldname .
condense fieldname no-gaps.
* Set up fieldvalue
concatenate 'FLD' index into
fieldvalue.
condense fieldvalue no-gaps.
assign component fieldname of structure <dyn_wa> to <fs1>.
<fs1> = fieldvalue.
enddo.
* Append to the dynamic internal table
append <dyn_wa> to <dyn_table>.
endform.
Regards,
Rich Heilman
Message was edited by: Rich Heilman
I have modified the sample to include your requirement -
How do I build a table that can be filled in by the user?
I'm trying to build a form where the user can easily add a qty to order a size. I haven't been able to do this other than adding a text field for every option. Can you build a table that would do the same thing (see my sample below)? Even better, is there a way to get it to total? All ideas appreciated!
Small
Med
Large
XL
Total
Style A
Style BHi,
You already have a good start at generating the table. All you need to do is change the cells from static text to either a numeric field or text field. You can do this by dragging a numericField from the Object Library and placing it inside the cell.
Once you have the numeric field in place, you can edit the properties, font, alignment, currency, validation, etc. Then copy and paste the field into similar cells and change the names, for example A_small, B_small etc.
The "Total" numeric field could have a Formcalc in the calculate event:
$ = A_small + A_med + A_large + A_xl
This is on the basis of a static table where you design all of the rows that will be available to the user.
You can also set up dynamic tables where the uer can add additional rows. There are plenty of good examples in the LC help and on the forums.
Good luck,
Niall -
How to build dynamic select query
Using the ZCO_SETTLE_CHK-REC_FIELD and DISTRIBUTION_RULE-KONTY write a dynamic select single query <table>-<field name> e.g. <COAS>- <AUART> on the <table> e.g. <COAS>. If the DISTRIBUTION_RULE-KONTY is u2018ORu2019, then use DISTRIBUTION_RULE-AUFNR value in the where clause of the query to fetch the ZCO_SETTLE_CHK-REC_FIELD value maintained in the <table>-<field name>. If DISTRIBUTION_RULE-KONTY = u2018KSu2019 or u2018PRu2019 use DISTRIBUTION_RULE-KOSTL or DISTRIBUTION_RULE- PS_PSP_PNR respectively in the where clause to fetch the values.
For above how we can build dynamic queryHi,
Refer the below code which helps to design a dynamic where condition.
IF NOT p1 IS INITIAL.
CLEAR : lv_p1_condition.
CONCATENATE 'F1' ' = ' '''' p1 '''' INTO
lv_p1_condition.
ENDIF.
IF NOT p2 IS INITIAL.
CLEAR : lv_p2_condition.
CONCATENATE 'F2' ' = ' '''' p2 '''' INTO
lv_p2_condition.
ENDIF.
IF NOT p3 IS INITIAL.
CLEAR : lv_p3_condition.
CONCATENATE 'F3' ' = ' '''' p3 '''' INTO
lv_p3_condition.
ENDIF.
IF NOT lv_p1_condition IS INITIAL.
CONCATENATE lv_p1_condition lv_condition
INTO lv_condition SEPARATED BY space.
ENDIF.
IF NOT lv_p2_condition IS INITIAL.
IF lv_condition IS INITIAL.
CONCATENATE lv_p2_condition lv_condition
INTO lv_condition SEPARATED BY space.
ELSE.
CONCATENATE lv_condition 'AND' lv_p2_condition
INTO lv_condition SEPARATED BY space.
ENDIF.
ENDIF.
IF NOT lv_p3_condition IS INITIAL.
IF lv_condition IS INITIAL.
CONCATENATE lv_p3_condition lv_condition
INTO lv_condition SEPARATED BY space.
ELSE.
CONCATENATE lv_condition 'AND' lv_p3_condition
INTO lv_condition SEPARATED BY space.
ENDIF.
ENDIF.
SELECT * FROM link INTO wa
WHERE lv_condition . -
Hello experts,
is it possible to call an ALV via ( class cl_salv or fm REUSE_ALV_GRID_DISPLAY) with a dynamic table?
This dynamic table has for example one fix column for the material number and dynamic colums for additional data.
One material has 1 additional column, the other material has two additional columns.
So i need an ALV with 3 columns material add_data1 add_data2 (add_data2 of material one is empty this is ok).
To build an itab which can handle this is possible i know.Hello Benjamin,
Maybe you already found a solution for this, but if not (or for others looking for a solution), here is a sample program that creates, fills, and displays a dynamic table:
report ztpar_dynamic_salv.
parameters: p_colnr type i default 3.
start-of-selection.
perform execute.
form execute.
data t_table type ref to data.
** create dynamic table
perform create_dynamic_table using p_colnr
changing t_table.
** fill dynamic table
perform fill_dynamic_table changing t_table.
** display dynamic table
perform display_table using t_table.
endform.
form create_dynamic_table using colnr type i
changing table type ref to data.
data: lo_field type ref to cl_abap_typedescr,
lo_struct type ref to cl_abap_structdescr,
lo_table type ref to cl_abap_tabledescr.
data: t_comp type cl_abap_structdescr=>component_table,
l_comp like line of t_comp.
lo_field ?= cl_abap_typedescr=>describe_by_name( 'CHAR10' ).
do p_colnr times.
move sy-index to l_comp-name.
concatenate 'COLUMN' l_comp-name into l_comp-name.
condense l_comp-name no-gaps.
l_comp-type ?= lo_field.
append l_comp to t_comp.
enddo.
lo_struct = cl_abap_structdescr=>create( p_components = t_comp p_strict = space ).
lo_table = cl_abap_tabledescr=>create( lo_struct ).
create data table type handle lo_table.
endform.
form fill_dynamic_table changing table type ref to data.
field-symbols: <fs_table> type standard table,
<fs_line> type any,
<fs_field> type any.
assign table->* to <fs_table>.
do 5 times.
append initial line to <fs_table> assigning <fs_line>.
do.
assign component sy-index of structure <fs_line> to <fs_field>.
if sy-subrc ne 0.
exit.
endif.
<fs_field> = sy-index.
enddo.
enddo.
endform.
form display_table using i_table type ref to data.
data lo_alv type ref to cl_salv_table.
field-symbols <fs_tab> type any table.
assign i_table->* to <fs_tab>.
try.
cl_salv_table=>factory(
importing
r_salv_table = lo_alv
changing
t_table = <fs_tab> ).
catch cx_salv_msg.
message 'Cannot display result!' type 'E'.
endtry.
lo_alv->display( ).
endform.
Best regards,
Tanguy
Maybe you are looking for
-
How to handle no_data_found in Page/Regions/Body/Report
Hi, I am new to APEX. I have a report in a the Region area of a Page. The Region Source allows me to enter only SELECT statement, no BEGIN/EXCEPTION/END are allowed. How can I handle a no_data_found exception in a report? Many thanks.
-
when I display a travel expense claim, there is a text on the top of the form saying "To print the form using a browser, right-click on it and select the print command from the context menu." How can I change this text? the thread below helps Modifi
-
EAN number missing leading zeroes
Hi, I have configured two types of EAN/UPC numbers, one being 12 characters and one being 14. In our business, we have a situation where a material has a case UPC number 00099999123456 and a package UPC of 099999123456. When these values are display
-
Presenter 10 Failing During Publish(New Issue)
All of our daily users(6) are experiencing the same issue that started last week. They start the publish process and it hangs at a point where it says something about audio conversion and then it closes down and there is no file. Has anyone found a f
-
Not enabled items displays with GRAY Foreground color... I want this items to displays with BLACK foreground color, how can I do this? thanks to all. Ricardo