Dynamic table - some fields of different rows in one column
Hey guys,
i have the following problem:
i habe a itab with some data like:
name | id | date | number
pete | 1 | 27.07 | 2
pete | 1 | 28.07 | 2
pete | 1 | 30.07 | 2
ann | 1 | 28.07 | 3
ann | 2 | 30.07 | 2
the user can define a period of time, e.g. 28-29.07
so my dynamic table will consist of the "hard" columns name and id and the dynamic added columns for every day:
name | id | 28.07 | 29.07
that's what i already have!
so my problem is, that i have to read the data from the itab into the new dynamic table (field-symbol) like:
name | id | 28.07 | 29.07
pete | 1 | 2 | 2
ann | 1 | 3 | -
i hope you can understand what i want! please give me code sample or a example report!
many thanks in adance!
best regards,
ludwig
hey Asik, you have understand what i want!
here is my table:
http://img181.imageshack.us/my.php?image=wh20080916113004ym8.png
after the loop, the 4 rows should be in my field-symbol only one row (no sum)!
but after the loop, there are to many rows! only one row is needed!
Look at the screenshot:
http://img185.imageshack.us/my.php?image=wh20080916113547wl0.png
So the second row at column "tag20080801" should be initial and with the next loop, the next day "tag20080730" should be filled with the number!
LOOP AT LT_OUT INTO LS_OUT.
ASSIGN COMPONENT 'RESSOURCEN' OF STRUCTURE <FS_LINE> TO <fs_field>.
<fs_field> = 'Ressource'.
ASSIGN COMPONENT 'NAME' OF STRUCTURE <FS_LINE> TO <fs_field>.
<fs_field> = LS_OUT-name.
ASSIGN COMPONENT 'PROJEKT' OF STRUCTURE <FS_LINE> TO <fs_field>.
<fs_field> = LS_OUT-PROJECTID.
CONCATENATE 'DATE' LS_OUT-DATE INTO LF_DATE_COL.
ASSIGN COMPONENT LF_DATE_COL OF STRUCTURE <FS_LINE> TO <fs_field>.
<fs_field> = LS_OUT-COUNT.
COLLECT <FS_LINE> INTO <FS_TABLE>.
ENDLOOP.
the right output data should look like this:
Ressourcen | Ludwig Heinz | 20080702LHZ | 4 | 4 | 4 | 1
Similar Messages
-
How to suppress row when one column has zero using condition
Hi Experts,
How do I suppress row when one column has zero.
I read it is possible using conditions.
How ?
Thankyou.Check this
1. for Query Properties, go to the Display tab and Supress Zeros is "Active"
2. select the Structure, right-click, select Properties, then click "on" Also Use Zero Suppression for Structure Elements
http://help.sap.com/saphelp_nw04/helpdata/en/a4/dd3841d132d92be10000000a1550b0/frameset.htm
Hope it Helps
Chetan
@CP.. -
Hi all,
I want to display the rows as one column
Source Amount
A 100
A 200
B 300
B 400
C 500
C 600
I want to display like below
Sum(A) Sum(B) Sum(C)
300 700 1100
Is it possible to do in SQL
ThanksSELECT
SUM(DECODE(source, 'A', amount, 0)) sum_a,
SUM(DECODE(source, 'B', amount, 0)) sum_b,
SUM(DECODE(source, 'C', amount, 0)) sum_c
FROM
t
SUM_A SUM_B SUM_C
300 700 1100 -
Dynamic Table UI Element with different data type for each cell
Hi Experts,
I have a problem with a dynamic Table UI Element in Web Dynpro ABAP. I have the following coding:
METHOD set_col_row .
TYPE-POOLS: icon.
DATA:
lv_node TYPE REF TO if_wd_context_node,
lv_node_info TYPE REF TO if_wd_context_node_info,
lv_element TYPE REF TO if_wd_context_element,
lt_attributes TYPE wdr_context_attr_info_map,
lv_table TYPE REF TO cl_wd_table,
lv_table_column TYPE REF TO cl_wd_table_column,
lv_text_view TYPE REF TO cl_wd_text_view,
lv_image TYPE REF TO cl_wd_image,
lv_text_edit TYPE REF TO cl_wd_text_edit,
lv_header TYPE REF TO cl_wd_caption,
attribute LIKE LINE OF lt_attributes,
lv_index TYPE string,
lv_cur_row TYPE i,
path TYPE string,
lv_value TYPE string,
attr_name TYPE string,
l_trc_point_id TYPE string,
l_num_cols TYPE string,
l_num_rows TYPE string,
lv_text TYPE string,
lv_index2 TYPE i,
lr_ress_selections TYPE REF TO /its/di_2_cpr_ress_selections,
lt_comp_tab TYPE cl_abap_structdescr=>component_table,
ls_comp_tab LIKE LINE OF lt_comp_tab,
lv_count TYPE i,
lv_col_count TYPE i,
lv_col_count_read TYPE i,
lv_index_read TYPE i,
lv_num_cols_minus_1 TYPE i,
lv_bind_lv_value TYPE string,
wd_standard_cell TYPE REF TO cl_wd_table_standard_cell,
lv_data_count TYPE i,
lv_data_count_str TYPE string,
wd_table_column TYPE REF TO cl_wd_table_column,
lv_column_id TYPE string.
FIELD-SYMBOLS:
TYPE ANY.
Instanz der Klasse /ITS/DI_2_CPR_RESS_SELECTIONS
lr_ress_selections = /its/di_2_cpr_ress_selections=>factory( ).
ASSIGN lr_ress_selections->gr_table->* TO gt_comp_tab.
ls_comp_tab-name = 'SUMME'.
APPEND ls_comp_tab TO lt_comp_tab.
ls_comp_tab-name = 'CELL_VARIANT'.
APPEND ls_comp_tab TO lt_comp_tab.
CLEAR ls_comp_tab.
l_num_rows = num_rows + 1.
CONDENSE l_num_rows.
l_num_cols = num_columns + 1.
CONDENSE l_num_cols.
UI-Element 'TABLE'
lv_table ?= wd_this->m_view->get_element( 'TBL_TABLE' ).
lv_table->remove_all_columns( ).
Kontext-Knoten 'TABLE'
lv_node = wd_context->get_child_node( 'TABLE' ).
lv_node_info = lv_node->get_node_info( ).
lv_node_info->remove_dynamic_attributes( ).
attribute-type_name = 'STRING'.
lv_num_cols_minus_1 = num_columns - 1.
Für jede Spalte einmal tun
DO lv_num_cols_minus_1 TIMES.
lv_index = sy-index + 1.
CONDENSE lv_index.
lv_table_column = cl_wd_table_column=>new_table_column( ).
lv_column_id = lv_table_column->id.
Spaltenüberschriften setzen
IF lv_index EQ 1. "Beim ersten Durchlauf --> erste Spalte = "Ressourcen"
lv_text = text-010.
sy-index = 0.
ELSE. "Danach für jede weitere Spalte eine Zeile aus der gt_comp_tab nehmen
lv_index_read = lv_index - 1.
READ TABLE lt_comp_tab INDEX lv_index_read INTO ls_comp_tab.
lv_text = ls_comp_tab-name.
lv_header = cl_wd_caption=>new_caption( text = lv_text ).
lv_table_column->set_header( lv_header ).
ENDIF.
CONCATENATE 'TABLE.A' lv_index INTO path.
lv_text_view = cl_wd_text_view=>new_text_view( bind_text = path ).
lv_table_column->set_table_cell_editor( lv_text_view ).
lv_table_column->bind_selected_cell_variant( 'TABLE.CELL_VARIANT' ).
lv_table->add_column( lv_table_column ).
wd_table_column ?= wd_this->m_view->get_element( lv_column_id ).
*****************Test Cell Variant*************************************************
IF lv_index GT 1.
LOOP AT .
IF sy-tabix EQ lv_cur_row.
Name zuweisen
ASSIGN COMPONENT 'NAME' OF STRUCTURE .
Zuweisen ob Blatt oder nicht
lv_element->set_attribute( name = 'NAME' value = lv_value ).
ASSIGN COMPONENT 'IS_LEAF' OF STRUCTURE set_attribute( name = attr_name value = lv_value ).
ENDIF.
ENDLOOP.
Now my problem is, that I need for every ROW of my table UI Element a different cell editor. I know how to change it for the column. But is not my issue. I want to have images (traffic lights red and green) in some rows. The other rows should have numbers. The coding works, so that I have all the data at the right place in my table, only the images are shown as a string, because the cells of these rows have the cell editor Text_View. I tried something with cell variants (with cl_wd_table_standard_cell), but it was not possible for me to get a cell variant "image" in these cells/rows were I need it.
I hope you understand my problem and now what to do here.
Thanks a lot in advance.
Best Regards,
IngmarHi Experts, I have a problem with a dynamic Table UI Element in Web Dynpro ABAP. I have the following coding: METHOD set_col_row . TYPE-POOLS: icon. DATA: lv_node TYPE REF TO if_wd_context_node, lv_node_info TYPE REF TO if_wd_context_node_info, lv_element TYPE REF TO if_wd_context_element, lt_attributes TYPE wdr_context_attr_info_map, lv_table TYPE REF TO cl_wd_table, lv_table_column TYPE REF TO cl_wd_table_column, lv_text_view TYPE REF TO cl_wd_text_view, lv_image TYPE REF TO cl_wd_image, lv_text_edit TYPE REF TO cl_wd_text_edit, lv_header TYPE REF TO cl_wd_caption, attribute LIKE LINE OF lt_attributes, lv_index TYPE string, lv_cur_row TYPE i, path TYPE string, lv_value TYPE string, attr_name TYPE string, l_trc_point_id TYPE string, l_num_cols TYPE string, l_num_rows TYPE string, lv_text TYPE string, lv_index2 TYPE i, lr_ress_selections TYPE REF TO /its/di_2_cpr_ress_selections, lt_comp_tab TYPE cl_abap_structdescr=>component_table, ls_comp_tab LIKE LINE OF lt_comp_tab, lv_count TYPE i, lv_col_count TYPE i, lv_col_count_read TYPE i, lv_index_read TYPE i, lv_num_cols_minus_1 TYPE i, lv_bind_lv_value TYPE string, wd_standard_cell TYPE REF TO cl_wd_table_standard_cell, lv_data_count TYPE i, lv_data_count_str TYPE string, wd_table_column TYPE REF TO cl_wd_table_column, lv_column_id TYPE string. FIELD-SYMBOLS: LIKE LINE OF lt_attributes, TYPE ANY TABLE, TYPE ANY, TYPE ANY, TYPE ANY. * Instanz der Klasse /ITS/DI_2_CPR_RESS_SELECTIONS lr_ress_selections = /its/di_2_cpr_ress_selections=>factory( ). ASSIGN lr_ress_selections->gr_table->* TO . lt_comp_tab = lr_ress_selections->gt_comp_tab. ls_comp_tab-name = 'SUMME'. * APPEND ls_comp_tab TO lt_comp_tab. * ls_comp_tab-name = 'CELL_VARIANT'. APPEND ls_comp_tab TO lt_comp_tab. CLEAR ls_comp_tab. l_num_rows = num_rows + 1. CONDENSE l_num_rows. l_num_cols = num_columns + 1. CONDENSE l_num_cols. * UI-Element 'TABLE' lv_table ?= wd_this->m_view->get_element( 'TBL_TABLE' ). lv_table->remove_all_columns( ). * Kontext-Knoten 'TABLE' lv_node = wd_context->get_child_node( 'TABLE' ). lv_node_info = lv_node->get_node_info( ). lv_node_info->remove_dynamic_attributes( ). attribute-type_name = 'STRING'. lv_num_cols_minus_1 = num_columns - 1. * Für jede Spalte einmal tun DO lv_num_cols_minus_1 TIMES. lv_index = sy-index + 1. CONDENSE lv_index. lv_table_column = cl_wd_table_column=>new_table_column( ). lv_column_id = lv_table_column->id. * Spaltenüberschriften setzen IF lv_index EQ 1. "Beim ersten Durchlauf --> erste Spalte = "Ressourcen" lv_text = text-010. sy-index = 0. ELSE. "Danach für jede weitere Spalte eine Zeile aus der gt_comp_tab nehmen lv_index_read = lv_index - 1. READ TABLE lt_comp_tab INDEX lv_index_read INTO ls_comp_tab. lv_text = ls_comp_tab-name. lv_header = cl_wd_caption=>new_caption( text = lv_text ). lv_table_column->set_header( lv_header ). ENDIF. CONCATENATE 'TABLE.A' lv_index INTO path. lv_text_view = cl_wd_text_view=>new_text_view( bind_text = path ). lv_table_column->set_table_cell_editor( lv_text_view ). lv_table_column->bind_selected_cell_variant( 'TABLE.CELL_VARIANT' ). lv_table->add_column( lv_table_column ). wd_table_column ?= wd_this->m_view->get_element( lv_column_id ). ******************Test Cell Variant************************************************** IF lv_index GT 1. LOOP AT ASSIGNING . ASSIGN COMPONENT 'TYPE' OF STRUCTURE TO . ADD 1 TO lv_data_count. lv_data_count_str = lv_data_count. CONCATENATE 'A' lv_index lv_data_count_str INTO path. wd_standard_cell = cl_wd_table_standard_cell=>new_table_standard_cell( view = wd_this->m_view variant_key = 'FLDATE' ). IF = '01' OR = '04'. lv_image = cl_wd_image=>new_image( bind_source = path view = wd_this->m_view ). wd_standard_cell->set_editor( lv_image ). wd_standard_cell->set_cell_design( '01' ). ELSE. lv_text_view = cl_wd_text_view=>new_text_view( bind_text = path view = wd_this->m_view ). wd_standard_cell->set_editor( lv_text_view ). wd_standard_cell->set_cell_design( '02' ). ENDIF. wd_table_column->add_cell_variant( wd_standard_cell ). ENDLOOP. ENDIF. ************************************************************************************* CONCATENATE 'A' lv_index INTO attribute-name. lv_node_info->add_attribute( attribute ). ENDDO. DO num_rows TIMES." Für jede Zeile einmal tun lv_cur_row = sy-index. lv_element = lv_node->create_element( ). lv_node->bind_element( new_item = lv_element set_initial_elements = abap_false ). DO l_num_cols TIMES. ADD 1 TO lv_col_count. IF lv_count LT 1. LOOP AT ASSIGNING . IF sy-tabix EQ lv_cur_row. * Name zuweisen ASSIGN COMPONENT 'NAME' OF STRUCTURE TO . "NAME lv_value = . * Zuweisen ob Blatt oder nicht lv_element->set_attribute( name = 'NAME' value = lv_value ). ASSIGN COMPONENT 'IS_LEAF' OF STRUCTURE TO . "NAME lv_value = . lv_element->set_attribute( name = 'IS_LEAF' value = lv_value ). ENDIF. ENDLOOP. ENDIF. IF lv_count GT 0. lv_col_count_read = lv_col_count - 1. lv_index = sy-index. LOOP AT ASSIGNING . IF sy-tabix EQ lv_cur_row. CLEAR ls_comp_tab. READ TABLE lt_comp_tab INDEX lv_col_count_read INTO ls_comp_tab. ASSIGN COMPONENT ls_comp_tab-name OF STRUCTURE TO . lv_value = . CONDENSE lv_index. CONCATENATE 'A' lv_index INTO attr_name. lv_element->set_attribute( name = attr_name value = lv_value ). ENDIF. ENDLOOP. ENDIF. lv_count = lv_count + 1. ENDDO. CLEAR lv_col_count. CLEAR lv_count. ENDDO. ENDMETHOD. I definied my table in Layout Tab of the View and create here in thos method dynamicly my columns. lv_table_column = cl_wd_table_column=>new_table_column( ). . . lv_table->add_column( lv_table_column ). In I have my data that should be shown later in my table. So I create for each row in this fieldsymbol in a loop: lv_element = lv_node->create_element( ). lv_node->bind_element( new_item = lv_element set_initial_elements = abap_false ). Later I fill every cell in my table with a different value with this loop: LOOP AT ASSIGNING . IF sy-tabix EQ lv_cur_row. CLEAR ls_comp_tab. READ TABLE lt_comp_tab INDEX lv_col_count_read INTO ls_comp_tab. ASSIGN COMPONENT ls_comp_tab-name OF STRUCTURE TO . lv_value = . CONDENSE lv_index. CONCATENATE 'A' lv_index INTO attr_name. lv_element->set_attribute( name = attr_name value = lv_value ). ENDIF. ENDLOOP. Now my problem is, that I need for every ROW of my table UI Element a different cell editor. I know how to change it for the column. But is not my issue. I want to have images (traffic lights red and green) in some rows. The other rows should have numbers. The coding works, so that I have all the data at the right place in my table, only the images are shown as a string, because the cells of these rows have the cell editor Text_View. I tried something with cell variants (with cl_wd_table_standard_cell), but it was not possible for me to get a cell variant "image" in these cells/rows were I need it. I hope you understand my problem and now what to do here. Thanks a lot in advance. Best Regards, Ingmar
-
Dynamic Table in PDF - only first row passed to the WD Java
Hi Experts,
I'm working with Web Dynpro for Java on WAS 2004s SP13, ADS for SP13 and LiveCycle Designer 7.1
I am facing a problem related to PDF-dynamic table generation.
I am creating the PDF form with a dynamic table, an empty row will be added, when ADD button is clicked, the row will be deleted when DELETE button is clicked. After form submit, only first row of the table is passed to the Web Dynpro. I'v tried to use different dataSource Context node structure without results. The structure diescribed in the thread [Dynamic Table - same data repeating in all rows; doesnt works for me. The same happend if i try to folow the advise from Wiki https://wiki.sdn.sap.com/wiki/display/WDJava/Creating%20Table%20in%20Interacting%20form%20using%20Web%20Dynpro.
Beside this, my DropDown list in the table column is not populated. I know how to populate the DropDown list outside of table. That's working fine. But the DropDown in the table just not respond on the click (is not going open). I'm pretty sure that this is a result of a Context node structure/binding issue.
Please suggest me how can i implement dynamic table and populate the data in table dropdown column.
Edited by: A. Mustacevic on Sep 7, 2009 12:18 AMHi Prabhakar,
You describe exactly my situation. The node which is bound to the table row has cardinality 1..n. Exactly Context structure is:
node dataSource (cardinality 1..1/ Singleton true) ======> dataSource of the Interactive Form
subnode TableList (cardinality 1..1/ Singleton true) ======> bound to the table in the Interactive Form
subnode TableWrapper (cardinality 1..n/ Singleton true) ======> bound to the table row in the Interactive Form
subnode TableData (cardinality 0..1/ Singleton false) ======> table data
attribute 1 ====> Context nodeattribute bound to the table row field
attribute 2
This structure is recommanded in the post that I found on the Forum (see the firs hyperlink in my firs post).
Is this structure correct? Why is not working?
Your link is not working. Can you post the correct one.
Thanks in advance.
Regards
Adnan
Edited by: A. Mustacevic on Sep 8, 2009 1:56 PM
Edited by: A. Mustacevic on Sep 8, 2009 1:57 PM
Edited by: A. Mustacevic on Sep 8, 2009 2:00 PM
Edited by: A. Mustacevic on Sep 8, 2009 2:01 PM
Edited by: A. Mustacevic on Sep 8, 2009 2:02 PM -
Sum for Dynamic Fields in a Dynamic Table with Field Symbol
Hi All,
I currently have an report which I am looking to update with some totals. The information is currently output in an ALV which is fed data from a dynamic table defined with a field symbol. The modification that needs to be applied is a summation per currency code where each of the fields to be summed is a dynamically named field at runtime. I am now just looking to see if anyone has any recommendations on how to obtain these totals it would be appreciated. I have no problem doing the leg work in piecing the solution together but am just stuck on which approach I should be investigating here. I have looked into several options but do to the fact that the totals are for dynamic fields in a dynamic table and it is a field symbol I am having some difficulties thinking of the easiest approach to obtain these totals.
Below is a simple sample of what the report currently looks like and what we are looking to add.
====================================================================================
As-Is Report:
DETAILED DATA ALV
Company Code | Plant | 2006 Total | 2007 Total | 2008 Total | CURRENCY
0001 | ABCD | 1,500 | 1,200 | 1,700 | USD
0001 | BCDE | 2,300 | 4,100 | 3,600 | GBP
0003 | DBCA | 3,200 | 1,600 | 6,200 | USD
Addition 1:
TOTALS PER CURRENCY
Currency | 2006 Total | 2007 Total | 2008 Total |
USD | 4,700 | 2,800 | 7,900 |
GBP | 2,300 | 4,100 | 3,600 |
Addition 2:
CONVERSIONS TO USD
| 2006 Curr | 2006 USD | 2008 Curr | 2006 USD |
USD | 4,700 USD | 4,700 USD | 7,900 USD | 7,900 USD |
GBP (1.5GBP/1 USD) | 2,300 GBP | 1,150 USD | 2,300 GBP | 1,800 USD |
====================================================================================
Any recommendations will be appreciated.Hi,
We cannot use the key word SUM in the loop at assigning statement.
The way i see is
When you are creating the first dynamic internal table , create one more with the structure below:
Currency | 2006 Total | 2007 Total | 2008 Total |
Then while populating the data into first itab,also move the contents to the second itab using collect statement. -
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 -
Dynamic Table Input Field - Disabled in runtime
Hi,
I have dynamically created a node. The node as a string attribute X.
Then dynamically created a IWDTable to bind to the node.
In the table I have a column, then a tablecelleditor of inputfield.
The inputfield 'value' is binded to node->X attribute info.
inputField.bindValue(attributeInfo).
Then I created a few entries of the node, populating X with some dummy value.
In runtime, my inputfields are disabled, and the dummy values don't appear.
I believe it is something to do with my binding.
Then I replaced the inputfield with a textview. textview text is binded to the node->X
attribute info.
textview.bindText(attributeInfo)
(i.e. exact same attribute info I used for the inputfield)
In runtime I see my textview with the dummy values.
Can anyone point me in the right direction?
Cheers,
Michael.Hi Guys,
I think to be clear I better include my code here.
I did bind the table to the nodeInfo, and I did bind the textView/inputfield to the particular attribute.
As mentioned before, it does show for the textView, but not for the inputfield.
Create the new node:
IWDNodeInfo newNode = wdContext.getNodeInfo().getChild("nodeName");
newNode =
wdContext.getNodeInfo().addChild(
"nodeName",
null,
true,
true,
true,
false,
false,
true,
null,
null,
null);
Create the attribute:
IWDAttributeInfo detailAttribute =
newNode.addAttribute(
"xyz",
"ddic:com.sap.dictionary.string");
Get the node
IWDNode specificNode =
wdContext.getChildNode(
"nodeName",
0);
Create the element from the node
newElement =
specificNode.createElement();
Set the attribute value:
newElement.setAttributeValue(
"xyz",
"1234");
Add the new element:
specificNode.addElement(newElement);
Create the table now:
IWDTable someTable =
(IWDTable) view.createElement(
IWDTable.class,
"TAB_ArticleQty" + articleElement.getArticleId());
someTable.setEnabled(true);
someTable.setReadOnly(false);
someTable.setRowSelectable(true);
someTable.setFooterVisible(false);
someTable.setSelectionMode(WDTableSelectionMode.NONE);
someTable.setVisibleRowCount(-1);
someTable.bindDataSource(
specificNode.getNodeInfo());
TC.addChild(someTable);
Loop at all the attributes and create the column
The code for the textView has been commented out
The code is now for the input field
* LOOP AT ALL THE ATTRIBUTES IN THE NODE:
* CREATE ONE COLUMN FOR EACH ATTRIBUTE
Iterator allAttributes =
specificNode.getNodeInfo().iterateAttributes();
while (allAttributes.hasNext()) {
IWDAttributeInfo attrInfo =
(IWDAttributeInfo) allAttributes.next();
String attrName = attrInfo.getName();
// Text View
IWDTextView TV_info =
(IWDTextView) view.createElement(
IWDTextView.class,
"TV_AQ_"
+ counter
+ attrName);
TV_info.bindText(attrInfo);
COL_qty.setTableCellEditor(TV_info);
//input field for the user to enter the value
IWDInputField input_Qty =
(IWDInputField) view.createElement(
IWDInputField.class,
"input_Qty"
+ counter
+ attrName);
input_Qty.setEnabled(true);
input_Qty.bindValue(attrInfo);
input_Qty.setWidth("4");
COL_qty.setTableCellEditor(input_Qty);
someTab.addColumn(COL_qty); -
Dynamic Tables in PDF - repeating Header row in all pages
Hi ,
I have created a dynamic table in PDF, When I add rows, the table is spanning to next page, and I should get the header row in all pages. But, I am getting the header row only for the 2nd page(In Header row properties, I have choosed the header row to be displayed in all pages). I need the Header row to be displayed in all pages.
To see the previous thread, Click [here|Dynamic Table - same data repeating in all rows;.
Thanks and Regards,
Prabhakar.Hi Prabhakar,
Try out with following step
Header Row -> Binding -> Select the check box
Repeat Row for each Data item (Min Count 1)
Please let me know if this is working or not.
Cheers
Satya -
Dynamic table with field type table
Hi,
I´m using "cl_alv_table_create=>create_dynamic_table" to create a dynamic table for ALV Grid.
But...I need to use colors in ALV, then I need to declare a field type LVC_S_SCOL in dynamic table from "cl_alv_table_create=>create_dynamic_table".
How can I declare this in fieldcat?
The code:
Creating dynamic table
DATA: table_agrup TYPE REF TO data,
line_agrup TYPE REF TO data.
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
it_fieldcatalog = t_fieldcat
IMPORTING
ep_table = table_agrup
EXCEPTIONS
generate_subpool_dir_full = 1
OTHERS = 2.
ASSIGN table_agrup->* TO .
Printing ALV
CALL METHOD obj_grid->set_table_for_first_display
EXPORTING
is_variant = w_variant
i_save = 'A'
is_layout = w_layout
CHANGING
it_outtab =
it_fieldcatalog = t_fieldcat
it_sort = t_sort
EXCEPTIONS
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
OTHERS = 4.
Thanks.It is not possible with the METHOD cl_alv_table_create=>create_dynamic_table to include another table inside that newly generated table.
I have tried to do it with the code and I got the dynamic table created after at the end of the program.
In the code,
<DYN_TABLE> has same effect as your <table> variable
<DYN_WA> has same effect as your <HEADER>
REPORT ZTEST_NP_DYNAMIC.
DATA: DY_TABLE TYPE REF TO DATA,
DY_LINE TYPE REF TO DATA.
FIELD-SYMBOLS: <DYN_TABLE> TYPE STANDARD TABLE,
<DYN_WA>,
<DYN_FIELD>.
FIELD-SYMBOLS: <FS> TYPE ANY.
* To generate the Dyanmic table with the COLOR
DATA: LS_SOURCE TYPE STRING.
DATA: LT_SOURCE LIKE STANDARD TABLE OF LS_SOURCE WITH HEADER LINE.
DATA: L_NAME LIKE SY-REPID.
DATA: L_MESSAGE(240) TYPE C,
L_LINE TYPE I,
L_WORD(72) TYPE C.
DATA: L_FORM(30) TYPE C VALUE 'TABLE_CREATE'.
LT_SOURCE = 'REPORT ZTEST_SUBROUTINE_POOL.'.
APPEND LT_SOURCE.
LT_SOURCE = 'FORM TABLE_CREATE USING I_FS TYPE ANY.'.
APPEND LT_SOURCE.
LT_SOURCE = 'DATA: BEGIN OF LT_GENTAB OCCURS 0.'.
APPEND LT_SOURCE.
LT_SOURCE = 'DATA: BUKRS TYPE BUKRS. '.
APPEND LT_SOURCE.
LT_SOURCE = 'DATA: BKTXT TYPE BKTXT. '.
APPEND LT_SOURCE.
* you can add your fields here.....
LT_SOURCE = 'DATA: COLOR TYPE lvc_t_scol. '.
APPEND LT_SOURCE.
LT_SOURCE = 'DATA: END OF LT_GENTAB.'.
APPEND LT_SOURCE.
LT_SOURCE = 'DATA: POINTER TYPE REF TO DATA.'.
APPEND LT_SOURCE.
LT_SOURCE = 'CREATE DATA POINTER LIKE STANDARD TABLE OF LT_GENTAB.'.
APPEND LT_SOURCE.
LT_SOURCE = 'I_FS = POINTER.'.
APPEND LT_SOURCE.
LT_SOURCE = 'ENDFORM. '.
APPEND LT_SOURCE.
L_NAME = 'ZTEST_SUBROUTINE_POOL'.
CATCH SYSTEM-EXCEPTIONS GENERATE_SUBPOOL_DIR_FULL = 9.
GENERATE SUBROUTINE POOL LT_SOURCE NAME L_NAME
MESSAGE L_MESSAGE LINE L_LINE WORD L_WORD. "#EC CI_GENERATE
ENDCATCH.
IF NOT L_MESSAGE IS INITIAL.
MESSAGE E000(0K) WITH L_MESSAGE L_LINE L_WORD.
ENDIF.
ASSIGN DY_TABLE TO <FS>.
PERFORM (L_FORM) IN PROGRAM (L_NAME) USING <FS>.
ASSIGN DY_TABLE->* TO <DYN_TABLE>.
* Create dynamic work area and assign to FS
CREATE DATA DY_LINE LIKE LINE OF <DYN_TABLE>.
ASSIGN DY_LINE->* TO <DYN_WA>.
Write: 'bye'.
Regards,
Naimesh Patel -
How to select rows whose one column contains some specific characters ?
These is a table say T1 with a column say C1
Let the field C1's values be:
row 1)DE/SPT/A/FWD
row 2)G/SPT/DE/DE/SPT
row 3)R/FWD/SPT/A/FWD/FWD
row 4)A/A/DE/SPT/FWD
row 5)FWD/SPT/E/DE/A
How to get only those rows whose C1 column contains FWD in last ?We can solve this with the simple use of a wildcard:
select *
from t1
where c1 like '%FWD'
/Note that this query will execute a full table scan, because any index you may have on C1 will be ignored: indexes are organised on the leading characters.
cheers, APC -
Table containing field names of all Business One system tables
Hi,
Is there a table like CUFD that contains all the field names in each Business One system table?
Thanks,
MikeHi Mike,
Unfortunately the answer is NO.
Thanks,
Gordon -
Collecting data from multiple rows into one column
I'd like to run a query and put a collection of items into one output column instead of multiple rows. See the example below:
Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - Prod
PL/SQL Release 10.2.0.5.0 - Production
"CORE 10.2.0.5.0 Production"
TNS for 32-bit Windows: Version 10.2.0.5.0 - Production
NLSRTL Version 10.2.0.5.0 - Production
CREATE TABLE "SKIP"."INGREDIENTS"
( "INGRED_ID" NUMBER,
"INGRED_NAME" VARCHAR2(20 BYTE),
"STORES" VARCHAR2(20 BYTE)
) PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
TABLESPACE "USERS" ;
REM INSERTING into SKIP.INGREDIENTS
Insert into SKIP.INGREDIENTS (INGRED_ID,INGRED_NAME,STORES) values (1,'SEA SALT','Food lion');
Insert into SKIP.INGREDIENTS (INGRED_ID,INGRED_NAME,STORES) values (2,'TABLE SALT','Food lion');
Insert into SKIP.INGREDIENTS (INGRED_ID,INGRED_NAME,STORES) values (3,'FLOUR','Piggly Wiggly');
Insert into SKIP.INGREDIENTS (INGRED_ID,INGRED_NAME,STORES) values (4,'YEAST',null);
Insert into SKIP.INGREDIENTS (INGRED_ID,INGRED_NAME,STORES) values (5,'BEER','ABC Store');
CREATE TABLE "SKIP"."PRETZELS"
( "PRETZEL_ID" NUMBER,
"PRETZEL_NAME" VARCHAR2(20 BYTE),
"PRETZEL_DESC" VARCHAR2(100 BYTE)
) PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
TABLESPACE "USERS" ;
REM INSERTING into SKIP.PRETZELS
Insert into SKIP.PRETZELS (PRETZEL_ID,PRETZEL_NAME,PRETZEL_DESC) values (1,'CLASSIC','Classic knot pretzel');
Insert into SKIP.PRETZELS (PRETZEL_ID,PRETZEL_NAME,PRETZEL_DESC) values (2,'THICK STICK','Straight pretzel, abt 1/2" in dia');
CREATE TABLE "SKIP"."INGRED_XREF"
( "PRETZEL_ID" NUMBER,
"INGRED_ID" NUMBER
) PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
TABLESPACE "USERS" ;
REM INSERTING into SKIP.INGRED_XREF
Insert into SKIP.INGRED_XREF (PRETZEL_ID,INGRED_ID) values (1,1);
Insert into SKIP.INGRED_XREF (PRETZEL_ID,INGRED_ID) values (1,2);
Insert into SKIP.INGRED_XREF (PRETZEL_ID,INGRED_ID) values (1,4);
Insert into SKIP.INGRED_XREF (PRETZEL_ID,INGRED_ID) values (2,2);
Insert into SKIP.INGRED_XREF (PRETZEL_ID,INGRED_ID) values (2,3);
Insert into SKIP.INGRED_XREF (PRETZEL_ID,INGRED_ID) values (2,5);
-- Constraints for Table INGRED_XREF
ALTER TABLE "SKIP"."INGRED_XREF" MODIFY ("PRETZEL_ID" NOT NULL ENABLE);
ALTER TABLE "SKIP"."INGRED_XREF" MODIFY ("INGRED_ID" NOT NULL ENABLE);
{code}
Desired output (note how the ingredients are all listed in one column, separated by commas):
{code}
PRETZEL_ID PRETZEL_NAME PRETZEL_DESC INGREDIENTS
1 CLASSIC Classic knot pretzel SEA SALT, TABLE SALT, YEAST
2 THICK STICK Straight pretzel, abt 1/2" in dia TABLE_SALT, FLOUR, BEERSee the FAQ : {message:id=9360005}
Especially links concerning string aggregation. -
Highlight complete row if one column is null
Hi,
i want to highlight a complete row in my publisher report if a certain column of the
row is empty (no value at all). I already tried to get forward using the examples in the
XML Publisher developer guide (i checked the samples installed by xml publisher desktop
as well) but none of them delivered the desired result.
Any hints are welcome.
regards
ThomasHi,
You can write the following code to highlight a row if a certain column is null:
<?if@row:COLUMN-NAME=''?><xsl:attribute name="background-color" xdofo:ctx="incontext">red</xsl:attribute><?end if?>
You can place this code in a text form field and place in the first column after the for-each statement.
Hope this helps.
Thanks. -
How to create an internal table with fields from different sources
Hi.
I need to create an internal table where some of the fields are from a database table, and the other fields are user specified. How do i do that?
Example:
DB table ZTAB with fields ZTAB-FIELD1, ZTAB-FIELD2.
I want to create an internal table ITAB with the fields ZTAB-FIELD1, ZTAB-FIELD2 from ZTAB. In addition, I also want to have one more field RECORD_NO, which is not from ZTAB. How do I do it? Could I do something like below?
DATA BEGIN OF ITAB.
INCLUDE STRUCTURE ZTAB.
DATA RECORD_NO TYPE I.
DATA END OF UPLINE.
Or, are there more efficient way of doing it? Thanks.hi KIan,
go:
general type
TYPE : BEGIN OF ty_itab,
field1 TYPE ztab-field1,
field2 TYPE ztab-field2,
*your own fields here:
field TYPE i,
field(30) TYPE c,
END OF ty_itab.
work area
DATA : gw_itab TYPE ty_itab.
internal table
DATA : gt_itab TYPE TABLE OF ty_itab.
hope this helps
ec
Maybe you are looking for
-
MacBook Pro 13', Mid 2010 freezing all the time
I have MacBook Pro 13', Mid 2010 running Mac OS X Lion 10.7.5. It freezes at least twice a day, I need to push the power button until it restarts every time. Already did the hardware test twice, it says it's all fine... so where is the problem?! I do
-
How to change the server for the existing project in netbeans5.5?
we r using netbeans5.5 with visual we pack. In netbeans for the project properties>run it is not giving in the list box it is only showing sun java system applicationn server 9. the remaining servers like tomcat and jboss which we have it is not show
-
Can I embed audio files in a pdf document or epub file?
-
AIA Demo Application failed during Installation.
Hi , I am getting this error while Installing and Deploying AIA Demo Application(deployment script ant –f deployDemo.xml in command window).Please find the error message displayed on the command window. D:\Devrep\Oracle\AIAHome\samples\AIADemo\config
-
Incoming mail auto marked as already read.
Just upgraded to IO6. My email Inbox appears to mark incoming mail as Already Read and so I don't receive notification alerts for new emails. Any ideas?