How to ADD rows to a dynamic internal table??
My question is simple.
I have a dynamic internal table and I need to ADD rows to if.
I read this thread How to modify a dynamic internal table from dynamic work area but they are modifying existing data.
My internal table is EMPTY and I need to ADD new rows, so I can't use LOOP ASSIGNING.
How can I do that?
Any help is welcome!
Thanks!
Bettina
Hi,
try something similar.
FIELD-SYMBOLS: <fs> type any.
FIELD-SYMBOLS: <f1> type any.
ASSIGN INITIAL LINE TO lo_data ASSIGNING <fs>. " or <f_tab> - not sure w/o editor :-)
assigning component 1 of structure <fs> to <f1>.
<f1> = 'aaa'.
I write it from memory so there can be some syntax errors but focus to command APPEND INITIAL LINE ...
Regards,
Karol
Similar Messages
-
How to add new field into dynamic internal table
Hello Expert.
how to add new field into dynamic internal table.
PARAMETERS: P_TABLE(30). "table name
DATA: I_TAB TYPE REF TO DATA.
FIELD-SYMBOLS: <TAB> TYPE standard TABLE.
*Create dynamic FS
create DATA I_TAB TYPE TABLE OF (p_table).
ASSIGN I_TAB->* TO <TAB>.
SELECT * FROM (p_table) INTO TABLE <TAB>.
here i want to add one more field into <TAB> at LAST position and my
Field name = field_stype and
Field type = 'LVC_T_STYL'
could you please helpme out .Hi,
Please find the code below.You can add the field acc to your requirement.
Creating Dynamic internal table
TYPE-POOLS: slis.
FIELD-SYMBOLS: <t_dyntable> TYPE STANDARD TABLE, u201C Dynamic internal table name
<fs_dyntable>, u201C Field symbol to create work area
<fs_fldval> type any. u201C Field symbol to assign values
PARAMETERS: p_cols(5) TYPE c. u201C Input number of columns
DATA: t_newtable TYPE REF TO data,
t_newline TYPE REF TO data,
t_fldcat TYPE slis_t_fldcat_alv,
t_fldcat TYPE lvc_t_fcat,
wa_it_fldcat TYPE lvc_s_fcat,
wa_colno(2) TYPE n,
wa_flname(5) TYPE c.
Create fields .
DO p_cols TIMES.
CLEAR wa_it_fldcat.
move sy-index to wa_colno.
concatenate 'COL'
wa_colno
into wa_flname.
wa_it_fldcat-fieldname = wa_flname.
wa_it_fldcat-datatype = 'CHAR'.
wa_it_fldcat-intlen = 10.
APPEND wa_it_fldcat TO t_fldcat.
ENDDO.
Create dynamic internal table and assign to FS
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
it_fieldcatalog = t_fldcat
IMPORTING
ep_table = t_newtable.
ASSIGN t_newtable->* TO <t_dyntable>.
Create dynamic work area and assign to FS
CREATE DATA t_newline LIKE LINE OF <t_dyntable>.
ASSIGN t_newline->* TO <fs_dyntable>.
Populating Dynamic internal table
DATA: fieldname(20) TYPE c.
DATA: fieldvalue(10) TYPE c.
DATA: index(3) TYPE c.
DO p_cols TIMES.
index = sy-index.
MOVE sy-index TO wa_colno.
CONCATENATE 'COL'
wa_colno
INTO wa_flname.
Set up fieldvalue
CONCATENATE 'VALUE' index INTO
fieldvalue.
CONDENSE fieldvalue NO-GAPS.
ASSIGN COMPONENT wa_flname
OF STRUCTURE <fs_dyntable> TO <fs_fldval>.
<fs_fldval> = fieldvalue.
ENDDO.
Append to the dynamic internal table
APPEND <fs_dyntable> TO <t_dyntable>.
Displaying dynamic internal table using Grid.
DATA: wa_cat LIKE LINE OF fs_fldcat.
DO p_cols TIMES.
CLEAR wa_cat.
MOVE sy-index TO wa_colno.
CONCATENATE 'COL'
wa_colno
INTO wa_flname.
wa_cat-fieldname = wa_flname.
wa_cat-seltext_s = wa_flname.
wa_cat-outputlen = '10'.
APPEND wa_cat TO fs_fldcat.
ENDDO.
Call ABAP List Viewer (ALV)
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
it_fieldcat = fs_fldcat
TABLES
t_outtab = <t_dyntable>. -
How to do parallel processing with dynamic internal table
Hi All,
I need to implement parallel processing that involves dynamically created internal tables. I tried doing so using RFC function modules (using starting new task and other such methods) but didn't get success this requires RFC enabled function modules and at the same time RFC enabled function modules do not allow generic data type (STANDARD TABLE) which is needed for passing dynamic internal tables. My exact requirement is as follows:
1. I've large chunk of data in two internal tables, one of them is formed dynamically and hence it's structure is not known at the time of coding.
2. This data has to be processed together to generate another internal table, whose structure is pre-defined. But this data processing is taking very long time as the number of records are close to a million.
3. I need to divide the dynamic internal table into (say) 1000 records each and pass to a function module and submit it to run in another task. Many such tasks will be executed in parallel.
4. The function module running in parallel can insert the processed data into a database table and the main program can access it from there.
Unfortunately, due to the limitation of not allowing generic data types in RFC, I'm unable to do this. Does anyone has any idea how to implement parallel processing using dynamic internal tables in these type of conditions.
Any help will be highly appreciated.
Thanks and regards,
Ashintry the below code...
DATA: w_subrc TYPE sy-subrc.
DATA: w_infty(5) TYPE c.
data: w_string type string.
FIELD-SYMBOLS: <f1> TYPE table.
FIELD-SYMBOLS: <f1_wa> TYPE ANY.
DATA: ref_tab TYPE REF TO data.
CONCATENATE 'P' infty INTO w_infty.
CREATE DATA ref_tab TYPE STANDARD TABLE OF (w_infty).
ASSIGN ref_tab->* TO <f1>.
* Create dynamic work area
CREATE DATA ref_tab TYPE (w_infty).
ASSIGN ref_tab->* TO <f1_wa>.
IF begda IS INITIAL.
begda = '18000101'.
ENDIF.
IF endda IS INITIAL.
endda = '99991231'.
ENDIF.
CALL FUNCTION 'HR_READ_INFOTYPE'
EXPORTING
pernr = pernr
infty = infty
begda = '18000101'
endda = '99991231'
IMPORTING
subrc = w_subrc
TABLES
infty_tab = <f1>
EXCEPTIONS
infty_not_found = 1
OTHERS = 2.
IF sy-subrc <> 0.
subrc = w_subrc.
ELSE.
ENDIF. -
Add column in the dynamic internal table
Hi Experts,
I have a dynamic internal table. I need add new column in the internal table and I don´t Know.
My code:
DATA: it_generic TYPE REF TO Data,
wa_generic TYPE REF TO data.
FIELD-SYMBOLS: <table> TYPE ANY TABLE,
<wa> TYPE ANY,
<field> TYPE ANY.
CREATE DATA it_generic TYPE STANDARD TABLE OF (wa_datoscarga-ZTBLCAR).
CREATE DATA wa_generic TYPE (wa_datoscarga-ZTBLCAR).
ASSIGN it_generic->* TO <table>.
CHECK <table> IS ASSIGNED.
ASSIGN wa_generic->* TO <wa>.
CHECK <wa> IS ASSIGNED.
SELECT *
INTO CORRESPONDING FIELDS OF TABLE <table>
FROM (wa_datoscarga-ZTBLCAR)
WHERE bukrs EQ p_bukrs AND
z_petic EQ z_peticion AND
ZIDFASE eq 'E'.
After this I need add one column selection at the first position of the columns.
ThanksHi,
Please refer to the below link for the code snippet on how to create a dynamic internal table -
[Create a dynamic internal table.|http://www.divulgesap.com/blog.php?p=MjE=]
Cheers,
Ravi -
How to transfer data from a dynamic internal table
Hi All
I want to transfer data from a dynamic internal table<dyn_table>
to a non dynamic internal table itab which should have the same structure as <dyn_table>.
How can this be done?
Regards,
Harshit RungtaAs stated earlier this can be done only through field symbols...
You cannot create an non dynamic internal table with ANY structure...using DATA statement
If the strucutre is defined well and good...you can create an non-dynamic internal table...
If you do not know the structure then the internal table has to be dynamic...and to be generated using field symbols
DATA: lv_ref TYPE REF TO data.
FIELD-SYMBOLS: <fs_dyn_table> TYPE STANDARD TABLE.
* You create a dynamic internal table...
CREATE DATA lv_ref LIKE (your_dynamic_internal_table).
ASSIGN lv_ref->* TO <fs_dyn_table>.
Now...do the transfer.
<fs_dyn_table> = "your_dynamic_internal_Table
Hope it helps! -
How to convert rows to lines in internal table?
Hi Folks,
i have an internal table with some rows and would like to convert that table into another internal table with columns.
Let me give you an example:
it1:
a
b
c
d
it1 should be converted into table it2 and should look like this:
it2:
a b c d
The problem is that the entries in table it1 are not fixed, so that means that the number of lines is different depending on the query...
Has anyone an idea?
Thanks in advance,
Ralf
Edited by: Ralf Vath on Oct 17, 2008 11:01 AMhi i have an example in the alv ....that the rows are transported into columns...
REPORT Z_TRANSPOSEALV .* Type pools declaration for ALV
TYPE-POOLS: slis.*Declarations for ALV, dynamic table and col no for transpose
DATA: l_col TYPE sy-tabix,
l_structure TYPE REF TO data,
l_dyntable TYPE REF TO data,
wa_lvc_cat TYPE lvc_s_fcat,
lt_lvc_cat TYPE lvc_t_fcat,
lt_fieldcatalogue TYPE slis_t_fieldcat_alv,
wa_fieldcat TYPE slis_fieldcat_alv,
lt_fieldcat TYPE slis_t_fieldcat_alv,
lt_layout TYPE slis_layout_alv.*Field symbols declarations
FIELD-SYMBOLS :
<header> TYPE ANY,
<dynheader> TYPE ANY,
<dyndata> TYPE ANY,
<ls_table> TYPE ANY,
<dynamictable> TYPE STANDARD TABLE,
<it_table> TYPE STANDARD TABLE.*Input the name of the table
PARAMETERS p_table TYPE dd02l-tabname OBLIGATORY.*Initialization event
INITIALIZATION.*Start of selection event
START-OF-SELECTION.* Create internal table of dynamic type
CREATE DATA l_dyntable TYPE STANDARD TABLE OF (p_table)
WITH NON-UNIQUE DEFAULT KEY.
ASSIGN l_dyntable->* TO <it_table>.*select statement to select data from the table as input into
*our dynamic internal table.
*Here i have restricted only till 5 rows.
*You can set a variable and give no of rows to be fetched
*The variable can be set in your select statement SELECT * INTO CORRESPONDING FIELDS OF TABLE <it_table>
FROM (p_table) up to 5 rows.*Fieldcatalogue definitions
wa_lvc_cat-fieldname = 'COLUMNTEXT'.
wa_lvc_cat-ref_table = 'LVC_S_DETA'.
APPEND wa_lvc_cat TO lt_lvc_cat. wa_fieldcat-fieldname = 'COLUMNTEXT'.
wa_fieldcat-ref_tabname = 'LVC_S_DETA'.
wa_fieldcat-key = 'X'..
APPEND wa_fieldcat TO lt_fieldcat. DESCRIBE TABLE <it_table>. DO sy-tfill TIMES.
For each line, a column 'VALUEx' is created in the fieldcatalog
Build Fieldcatalog
WRITE sy-index TO wa_lvc_cat-fieldname LEFT-JUSTIFIED.
CONCATENATE 'VALUE' wa_lvc_cat-fieldname
INTO wa_lvc_cat-fieldname.
wa_lvc_cat-ref_field = 'VALUE'.
wa_lvc_cat-ref_table = 'LVC_S_DETA'.
APPEND wa_lvc_cat TO lt_lvc_cat.
Build Fieldcatalog
CLEAR wa_fieldcat.
wa_fieldcat-fieldname = wa_lvc_cat-fieldname.
wa_fieldcat-ref_fieldname = 'VALUE'.
wa_fieldcat-ref_tabname = 'LVC_S_DETA'.
APPEND wa_fieldcat TO lt_fieldcat.
ENDDO.* Create dynamic internal table
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
it_fieldcatalog = lt_lvc_cat
IMPORTING
ep_table = l_dyntable. ASSIGN l_dyntable->* TO <dynamictable>.* Create structure as structure of the internal table
CREATE DATA l_structure LIKE LINE OF <dynamictable>.
ASSIGN l_structure->* TO <header>.* Create structure = structure of the internal table
CREATE DATA l_structure LIKE LINE OF <it_table>.
ASSIGN l_structure->* TO <ls_table>.* Create field catalog from our table structure
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_structure_name = p_table
CHANGING
ct_fieldcat = lt_fieldcatalogue
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF. DESCRIBE TABLE lt_fieldcatalogue.* Fill the internal to display <dynamictable>
DO sy-tfill TIMES.
IF sy-index = 1.
READ TABLE lt_fieldcatalogue INTO wa_fieldcat INDEX 1.
ENDIF.
For each field of it_table
ASSIGN COMPONENT 1 OF STRUCTURE <header> TO <dynheader>.
IF sy-subrc NE 0. EXIT .ENDIF.
READ TABLE lt_fieldcatalogue INTO wa_fieldcat INDEX sy-index.
Fill 1st column
<dynheader> = wa_fieldcat-seltext_m.
IF <dynheader> IS INITIAL.
<dynheader> = wa_fieldcat-fieldname.
ENDIF.*Filling the other columns
LOOP AT <it_table> INTO <ls_table>.
l_col = sy-tabix + 1.
ASSIGN COMPONENT sy-index OF STRUCTURE <ls_table> TO <dyndata>.
IF sy-subrc NE 0. EXIT .ENDIF.
ASSIGN COMPONENT l_col OF STRUCTURE <header> TO
<dynheader>.
IF sy-subrc NE 0. EXIT .ENDIF.
WRITE <dyndata> TO <dynheader> LEFT-JUSTIFIED.
ENDLOOP.
APPEND <header> TO <dynamictable>.
ENDDO.*Layout for ALV output
lt_layout-zebra = 'X'.
lt_layout-no_colhead = 'X'..
lt_layout-colwidth_optimize ='X'.
lt_layout-window_titlebar = 'ALV GRID TRANSPOSED'.*ALV Grid output for display
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
is_layout = lt_layout
it_fieldcat = lt_fieldcat
TABLES
t_outtab = <dynamictable>. -
ALV rows to column dynamic internal table
Hello People ,
I am stuck in a report which displays an output in ALV as follows :-
bukrs | kntyp | konto | knfix | period | element | emeng | emein
1000 | 10 | 1100 | berlin | 11.2011 | AG | 0.148 | kgAG
1000 | 10 | 1100 | berlin | 11.2011 | AU | 0.104 | kgAU
1000 | 10 | 1100 | berlin | 11.2011 | GA | 0.207 | kgGA
And this table has many values corresponding to element AG,AU and GA respectively . For example , there would be many element AG's with many "EMENG" values . Similarly for AU and GA .
MY question :- I am asked to make AG , AU , GA as 3 different fields which should show the value "EMENG" under respective elements . Like :-
bukrs | kntyp | konto | knfix | period | AG | AU | GA | emein
1000 | 10 | 1100 | berlin | 11.2011 | 0.148 | 0.104 | 0.207 | kgAG
That should be my output . ( elements replaced by AG , AU and GA which comes from a Metal table ZXXXX where
metal no. 1 = AU
metal no. 2 = AG
metal no. 3 = GA
If there is any metal added to it would be metal no. 4 ,5,6,7 .... so on ) and then that should be added as a field in our report .. So that has to be DYNAMIC .
I am unable to move on with problem . Pls suggest ? I am pasting my report here ...
FORM select_table_gt_bb CHANGING p_gt_bb.
TABLES : zpam_as .
DATA : i_zpam_as TYPE TABLE OF zpam_as ,
wa_zpam_as LIKE LINE OF i_zpam_as ,
i_tcurr TYPE TABLE OF tcurr ,
wa_tcurr LIKE LINE OF i_tcurr,
zt_as TYPE TABLE OF zpam_as.
SELECT * FROM zpam_as INTO TABLE gt_as
WHERE bukrs EQ bukrs
AND kntyp IN kntyp
AND konto IN konto
AND knfix IN knfix
AND buper IN buper
AND element IN element
AND ameng IN ameng
AND ashkz IN ashkz
AND emeng IN emeng
AND eshkz IN eshkz
AND emein IN emein.
SELECT * FROM zpam_tcurr INTO TABLE gt_tcurr.
IF sy-subrc IS INITIAL.
LOOP AT gt_tcurr INTO gw_tcurr.
SELECT * FROM tcurr INTO wa_tcurr WHERE fcurr = gw_tcurr-fcurr AND
tcurr = tcurr.
ENDSELECT.
APPEND wa_tcurr TO i_tcurr.
DELETE ADJACENT DUPLICATES FROM i_tcurr.
ENDLOOP.
ENDIF.
IF i_tcurr IS NOT INITIAL.
LOOP AT gt_as INTO gw_as.
CLEAR sy-subrc.
LOOP AT i_tcurr
INTO wa_tcurr
WHERE fcurr = gw_as-emein.
gw_as-tcurr = wa_tcurr-tcurr.
gw_as-ukurs = wa_tcurr-ukurs.
gw_as-total = abs( gw_as-emeng ) * wa_tcurr-ukurs.
APPEND gw_as TO zt_as.
ENDLOOP.
IF sy-subrc <> 0.
gw_as-tcurr = 'None'.
gw_as-ukurs = ''.
gw_as-total = ''.
APPEND gw_as TO zt_as.
ENDIF.
ENDLOOP.
REFRESH gt_as.
LOOP AT zt_as INTO gw_as.
APPEND gw_as TO gt_as.
ENDLOOP.
ENDIF.
ENDFORM.
Priority normalized
Edited by: Rob Burbank on Dec 28, 2011 3:44 PMHey,
But after understanding my question correctly , you sure that dynamic internal table is the solution for it ? -
How To Read Field Values Form Dynamic Internal Table
Hi,
I Created a dynamic internal table using.
FIELD-SYMBOLS: <gt_table> TYPE STANDARD TABLE,
<wa_gt_table>,
<l_fvalue> TYPE ANY.
This Interanl table is working well, and all values are populated to an ALV.
Now I try to set a link
for that I am using below code
READ TABLE <gt_table> ASSIGNING <l_fvalue> index rs_selfield-tabindex.
IF sy-subrc EQ 0.
insplot = <l_fvalue>-prueflos.
Now it is showing a syntax error :
the data object <l_fvalue> has no structure and there for no component called prueflos
Regards
NausalHi,
Refere following code
Local Field Symbol
FIELD-SYMBOLS: <lf_any> TYPE ANY. "Changed data
LOOP AT <gf_dyna_table> ASSIGNING <gf_dyna>.
DO.
ASSIGN COMPONENT sy-index OF STRUCTURE <gf_dyna> TO <lf_any>.
IF sy-subrc NE 0.
EXIT.
ENDIF.
IF ls_attach-line IS INITIAL.
ls_attach-line = <lf_any>.
ELSE.
CONCATENATE ls_attach-line <lf_any> INTO ls_attach-line
SEPARATED BY lc_tab.
ENDIF.
ENDDO.
CONCATENATE lc_cret ls_attach-line INTO ls_attach-line.
Append Changed Data to attachement table
APPEND ls_attach TO gt_attach.
Clear
CLEAR : ls_attach.
ENDLOOP.
Regards,
Prashant -
How to add one more field in Internal table
Hi Experts
i have declared an internal table
DATA: lt_viqmel_iflos TYPE TABLE OF viqmel_iflos.
viqmel_iflos is a Standared SAP Table,
Now i want to add one more Text field in the internal table only, how to add in program. any one plz help.
<REMOVED BY MODERATOR>
Mohana
Edited by: Alvaro Tejada Galindo on Feb 7, 2008 10:09 AMyou can put this:
types: begin of t_table_viqmel_iflos,
include structure of viqmel_iflos,
new_field type xxxx.
types: end of viqmel_iflos.
DATA: lt_viqmel_iflos TYPE TABLE OF t_table_viqmel_iflos.
Luck. -
How to add the records of 2 internal table records into one file
hello experts,
My scenario is...
I am retrieving the data for the for the credit, debit and trailer records of the customer into 3 different internal tables and finally i have to append all those records into one file first debit records then credit records finally the trailer record.... how to do that can anyone give some idea plzzzzzzzzz..
Plz its bit urgent..
Thanks a lot for your anticipation
SRIHello,
Do like this.
" Assume u have three itab.
"Itab1 - debit
"Itab2 - credit
"Itab3 - Credit.
REPORT ZV_TEST_SERVER .
*PARAMETERS: P_FILE TYPE STRING."RLGRAP-FILENAME.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
* BIN_FILESIZE =
FILENAME = P_FILE
* FILETYPE = 'ASC'
APPEND = 'X' " Check here
* WRITE_FIELD_SEPARATOR = ' '
* HEADER = '00'
* TRUNC_TRAILING_BLANKS = ' '
* WRITE_LF = 'X'
* COL_SELECT = ' '
* COL_SELECT_MASK = ' '
* DAT_MODE = ' '
* IMPORTING
* FILELENGTH =
TABLES
DATA_TAB = ITAB1
* EXCEPTIONS
* FILE_WRITE_ERROR = 1
* NO_BATCH = 2
* GUI_REFUSE_FILETRANSFER = 3
* INVALID_TYPE = 4
* NO_AUTHORITY = 5
* UNKNOWN_ERROR = 6
* HEADER_NOT_ALLOWED = 7
* SEPARATOR_NOT_ALLOWED = 8
* FILESIZE_NOT_ALLOWED = 9
* HEADER_TOO_LONG = 10
* DP_ERROR_CREATE = 11
* DP_ERROR_SEND = 12
* DP_ERROR_WRITE = 13
* UNKNOWN_DP_ERROR = 14
* ACCESS_DENIED = 15
* DP_OUT_OF_MEMORY = 16
* DISK_FULL = 17
* DP_TIMEOUT = 18
* FILE_NOT_FOUND = 19
* DATAPROVIDER_EXCEPTION = 20
* CONTROL_FLUSH_ERROR = 21
* OTHERS = 22
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
* BIN_FILESIZE =
FILENAME = P_FILE
* FILETYPE = 'ASC'
APPEND = 'X' " Check here
* WRITE_FIELD_SEPARATOR = ' '
* HEADER = '00'
* TRUNC_TRAILING_BLANKS = ' '
* WRITE_LF = 'X'
* COL_SELECT = ' '
* COL_SELECT_MASK = ' '
* DAT_MODE = ' '
* IMPORTING
* FILELENGTH =
TABLES
DATA_TAB = ITAB2 " Check here
* EXCEPTIONS
* FILE_WRITE_ERROR = 1
* NO_BATCH = 2
* GUI_REFUSE_FILETRANSFER = 3
* INVALID_TYPE = 4
* NO_AUTHORITY = 5
* UNKNOWN_ERROR = 6
* HEADER_NOT_ALLOWED = 7
* SEPARATOR_NOT_ALLOWED = 8
* FILESIZE_NOT_ALLOWED = 9
* HEADER_TOO_LONG = 10
* DP_ERROR_CREATE = 11
* DP_ERROR_SEND = 12
* DP_ERROR_WRITE = 13
* UNKNOWN_DP_ERROR = 14
* ACCESS_DENIED = 15
* DP_OUT_OF_MEMORY = 16
* DISK_FULL = 17
* DP_TIMEOUT = 18
* FILE_NOT_FOUND = 19
* DATAPROVIDER_EXCEPTION = 20
* CONTROL_FLUSH_ERROR = 21
* OTHERS = 22
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
* BIN_FILESIZE =
FILENAME = P_FILE
* FILETYPE = 'ASC'
APPEND = 'X' " Check here
* WRITE_FIELD_SEPARATOR = ' '
* HEADER = '00'
* TRUNC_TRAILING_BLANKS = ' '
* WRITE_LF = 'X'
* COL_SELECT = ' '
* COL_SELECT_MASK = ' '
* DAT_MODE = ' '
* IMPORTING
* FILELENGTH =
TABLES
DATA_TAB = ITAB3 " Check here
* EXCEPTIONS
* FILE_WRITE_ERROR = 1
* NO_BATCH = 2
* GUI_REFUSE_FILETRANSFER = 3
* INVALID_TYPE = 4
* NO_AUTHORITY = 5
* UNKNOWN_ERROR = 6
* HEADER_NOT_ALLOWED = 7
* SEPARATOR_NOT_ALLOWED = 8
* FILESIZE_NOT_ALLOWED = 9
* HEADER_TOO_LONG = 10
* DP_ERROR_CREATE = 11
* DP_ERROR_SEND = 12
* DP_ERROR_WRITE = 13
* UNKNOWN_DP_ERROR = 14
* ACCESS_DENIED = 15
* DP_OUT_OF_MEMORY = 16
* DISK_FULL = 17
* DP_TIMEOUT = 18
* FILE_NOT_FOUND = 19
* DATAPROVIDER_EXCEPTION = 20
* CONTROL_FLUSH_ERROR = 21
* OTHERS = 22
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
If useful reward.
Vasanth -
How to get row index in dynamically populated table?
Hi,
I am following example given in http://balusc.xs4all.nl/srv/dev-jep-dat.html to Dynamically populate datatable. How can I get row index while populating table in populateDynamicDataTable() method
private List myList;
private String[] headers; // Optional.
private HtmlDataTable dynamicDataTable;
// Actions ----------------------------------------------------------
public void loadMyList() {
// Set headers (optional).
headers = new String[] {"header1", "header2", "header3"};
// Set rows. This is a stub example, just do your dynamic thing.
String[] row1 = {"ID1", "Name1", "Value1"};
String[] row2 = {"ID2", "Name2", "Value2"};
String[] row3 = {"ID3", "Name3", "Value3"};
// Convert rows to List and set the List.
myList = new ArrayList();
myList.add(Arrays.asList(row1));
myList.add(Arrays.asList(row2));
myList.add(Arrays.asList(row3));
public void populateDynamicDataTable() {
//*********************** I want current row in this method *************//
// Any columns?
if (myList != null && myList.size() > 0) {
dynamicDataTable = new HtmlDataTable();
// Get amount of columns.
int columns = ((List) myList.get(0)).size();
// Set columns.
for (int i = 0; i < columns; i++) {
// Set header (optional).
UIOutput header = new UIOutput();
header.setValue(headers);
// Set output.
UIOutput output = new UIOutput();
ValueBinding myItem =
FacesContext
.getCurrentInstance()
.getApplication()
.createValueBinding("#{myItem[" + i + "]}");
output.setValueBinding("value", myItem);
// Set column.
UIColumn column = new UIColumn();
column.setHeader(header);
column.getChildren().add(output);
// Add column.
dynamicDataTable.getChildren().add(column);
// Getters ----------------------------------------------------------
public List getMyList() {
return myList;
public HtmlDataTable getDynamicDataTable() {
if (dynamicDataTable == null) {
loadMyList(); // Reload to get most recent data.
populateDynamicDataTable();
return dynamicDataTable;
// Setters ----------------------------------------------------------
public void setMyList(List myList) {
this.myList = myList;
public void setDynamicDataTable(HtmlDataTable dynamicDataTable) {
this.dynamicDataTable = dynamicDataTable;
I have tried dynamicDataTable.getRowIndex, but it returns -1
Is there any other way?
Thanks ,
Chitra.When you dynamically populate a datatable, you're populating the columns, not the actual rows.
Just add EL to the styleClass attribute, like:styleClass="#{myBean.myTable.rowIndex == 1 ? 'highlightedClass' : 'defaultClass'}"where 'myTable' refers to a HtmlDataTable property in the backing bean. -
How to write a perform with dynamic internal table
Hi to all experts,
i have to read infotype 2001 2003 2002 with same pernr, begin date, end date im calling hr_read_infotype three times
can i write a single perform and call it three how to pass different tables (2001, 2002, 2003).try the below code...
DATA: w_subrc TYPE sy-subrc.
DATA: w_infty(5) TYPE c.
data: w_string type string.
FIELD-SYMBOLS: <f1> TYPE table.
FIELD-SYMBOLS: <f1_wa> TYPE ANY.
DATA: ref_tab TYPE REF TO data.
CONCATENATE 'P' infty INTO w_infty.
CREATE DATA ref_tab TYPE STANDARD TABLE OF (w_infty).
ASSIGN ref_tab->* TO <f1>.
* Create dynamic work area
CREATE DATA ref_tab TYPE (w_infty).
ASSIGN ref_tab->* TO <f1_wa>.
IF begda IS INITIAL.
begda = '18000101'.
ENDIF.
IF endda IS INITIAL.
endda = '99991231'.
ENDIF.
CALL FUNCTION 'HR_READ_INFOTYPE'
EXPORTING
pernr = pernr
infty = infty
begda = '18000101'
endda = '99991231'
IMPORTING
subrc = w_subrc
TABLES
infty_tab = <f1>
EXCEPTIONS
infty_not_found = 1
OTHERS = 2.
IF sy-subrc <> 0.
subrc = w_subrc.
ELSE.
ENDIF. -
Deleting selected record in Dynamic Internal table
Hi Friends,
I want to delete selected row from a dynamic internal table. The selected entry should be deleted from Adobe and as well as Webdynpro abap.
Kindly help me how to solve this problem.
Thanks in advance.
Regards,
Phani.Hi Matthias,
Thanks a lot for responding.
In my adobe i kept a check box to delete the record. It should delete the selected ones. But right now, its deleting one by one.
I have coded following script for delete button:
IT_TIME_SHEET --> is my internal table
G_ROW_STATUS is the field to track the action performed.
var tlength = xfa.resolveNodes("IT_TIME_SHEET.DATA[*]").length;
for ( var i=0; i<tlength; i++
if(xfa.resolveNode("IT_TIME_SHEET.DATA["i"].FLAG").rawValue ==
1 )
IT_TIME_SHEET.DATA.instanceManager.removeInstance(i);
G_ROW_STATUS.rawValue = "DELETE";
In the Webdynpro abap following code I wrote:
row_count = 1.
FIELD-SYMBOLS <wa> TYPE zshr_time_sheet_time.
LOOP AT it_time_sheet ASSIGNING <wa>.
<wa>-srl_no = row_count.
row_count = row_count + 1.
ENDLOOP.
last_row = <wa>-srl_no.
DELETE it_time_sheet WHERE srl_no EQ last_row.
Suppose if two records checkboxes are selected I can loop at the internal table IT_TIME_SHEET in webdynpro and delete where checkbox is selected.
But problem is once user deletes records, adobe is deleting only one record and if i delete two records from webdynpro it looks like something wrong for the user.
Please help me how to solve this problem.
Regards,
Phani. -
Need urgent help on dynamic internal table.
Hi experts,
I got an editable dynamic internal table. When the value in 1 of the editable field has been changed, I will fire the the DATA_CHANGED event. In this event, I can get the row ID where the changes occur, but the problem is, how can I select back the data from the dynamic internal table using the row ID since index is not permitted to be used? I need to get the rest of the records form the ROW and then perform a database update accordingly. How can I select from the dynamic internal table given the row ID? THanks in advance.Hi
I suppose it depends on the kind of internal table assigned to fieldsymbol, this sample works fine:
FIELD-SYMBOLS: <FS> TYPE TABLE,
<WA> TYPE ANY.
DATA: BEGIN OF ITAB OCCURS 0,
FIELD,
END OF ITAB.
DO 10 TIMES.
ITAB-FIELD = 'a'.
APPEND ITAB.
ENDDO.
ASSIGN ITAB[] TO <FS>.
READ TABLE <FS> ASSIGNING <WA> INDEX 1.
WRITE <WA>.
It can't use the index with internal table of kind HASHED.
Max -
Distinct values from dynamic internal tabls
Hi All,
I have a dynamic internal tables like <dy_table> , i want to get distinct values from this internal tables,
how to do that, structure of dynamic internal tables is dynamic acc. to user conditions.
regards,
AnujHi Anuj
Just try this,
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
it_fieldcatalog = tb_fields_for_it
IMPORTING
ep_table = gp_dyn_table.
ASSIGN gp_dyn_table->* TO <gt_table>.
ASSIGN LOCAL COPY OF INITIAL LINE OF <gt_table> TO <fs_table>.
LOOP AT tb_output.
*To assign value for serial number.
ASSIGN COMPONENT 1 OF STRUCTURE <fs_table> TO <ls_field>.
<ls_field> = tb_output-sno.
UNASSIGN <ls_field>.
*To assign value for Sales Organization.
ASSIGN COMPONENT 2 OF STRUCTURE <fs_table> TO <ls_field>.
<ls_field> = tb_output-vkorg.
UNASSIGN <ls_field>.
*To assign Rate for its respective Condition type.
LOOP AT tb_konp WHERE knumh = tb_output-knumh.
READ TABLE tb_fieldcat1 WITH KEY fieldname = tb_output-kschl.
IF sy-subrc EQ 0.
lv_count = tb_fieldcat1-col_pos.
ASSIGN COMPONENT lv_count OF STRUCTURE <fs_table> TO <ls_field>.
IF tb_konp-konwa EQ '%'.
tb_konp-kbetr = tb_konp-kbetr / co_10.
<ls_field> = tb_konp-kbetr.
ELSE.
<ls_field> = tb_konp-kbetr.
ENDIF.
ENDIF.
ENDLOOP.
lv_count = lv_count + 1.
APPEND <fs_table> TO <gt_table>.
CLEAR <fs_table>.
ENDLOOP.
Hope this proves helpful to you.
Maybe you are looking for
-
Please help I am trying to download itunes on windows 7 32 bit, everytime I go to open download it comes up with a green screen then a error message. This installation package could not be opened. Verify that the package exist. Please help Me
-
Very slow (20 minutes) log on. Plse help.
Hi, For months, we are having slow logon-issues on our network. I have googled a lot but have not found the answer yet. I have already gathered quite some data, so I hope it will be easy for you experts to pinpoint the cause. - (Virtualized) SBS 2008
-
Layout box from end to end of the screen
The caprice is simple: I want to create 100px tall line (vertical gradient) from end to end of the screen at the top of it, independently of screen's size. I have already set up the header which is 80px tall and appears 5px from the top (so there is
-
Quick question, getting the filename of file just loaded by a loader
How do i detect the file that a loader has just completed? I wish to load a series of small files, and am using the loader functions url = "image"+index+".png"; var request:URLRequest = new URLRequest(url); loader.load(request); loader
-
so the air drop from the bottom of the screen. It takes many times to bring it up. It I can try many times and it will not come up. but them it will. the top dropper works very well and quickly every time.