Dynamic internal table- column to row conversion
Hello all,
Inside a program i generate a dynamic internal table and
This table has one single column. But I need to convert the rows as columns.
Eg:
dynamic internal table ITAB has content
Forbes
Times
Reuters
Warner
stern
I would like to have a ITAB2 like this
Forbes Times Reuters Warner Stern
Please note this is a Dynamic internal table!!!!
I need some approach for my problem. Thanks a lot in advance.
Karthik.
Hi karthik,
1.
For this purpose,
in my program,
<b> there is an INDEPENDENT FORM</b>
whose inputs are
<b> LIST OF FIELDS, (just as u require)</b>
and from those, it consructs dynamic table.
2. Here is the program.
the dynamic table name will be
<DYNTABLE>.
3. U can use this program (FORM in this program)
to generate any kind of internal table
by specifying list of fields.
4.
REPORT abc.
COMPULSORY
FIELD-SYMBOLS: <dyntable> TYPE ANY TABLE.
FIELD-SYMBOLS: <dynline> TYPE ANY.
DATA: lt TYPE lvc_t_fcat.
DATA: ls TYPE lvc_s_fcat.
FIELD-SYMBOLS: <fld> TYPE ANY.
DATA : fldname(50) TYPE c.
DATA : ddfields LIKE ddfield OCCURS 0 WITH HEADER LINE.
START-OF-SELECTION.
field list
ddfields-fieldname = 'BUKRS'.
APPEND DDFIELDS.
ddfields-fieldname = 'MATNR'.
APPEND DDFIELDS.
PERFORM mydyntable .
see <DYNTABLE> in debug mode.
BREAK-POINT.
INDEPENDENT FORM
FORM mydyntable .
Create Dyn Table From FC
FIELD-SYMBOLS: <fs_data> TYPE REF TO data.
FIELD-SYMBOLS: <fs_1>.
FIELD-SYMBOLS: <fs_2> TYPE ANY TABLE.
DATA: lt_data TYPE REF TO data.
data : lt TYPE lvc_t_fcat .
CONSTRUCT FIELD LIST
LOOP AT ddfields.
ls-fieldname = ddfields-fieldname.
APPEND ls TO lt.
ENDLOOP.
ASSIGN lt_data TO <fs_data>.
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
it_fieldcatalog = lt
IMPORTING
ep_table = <fs_data>
EXCEPTIONS
generate_subpool_dir_full = 1
OTHERS = 2.
IF sy-subrc <> 0.
ENDIF.
Assign Dyn Table To Field Sumbol
ASSIGN <fs_data>->* TO <fs_1>.
ASSIGN <fs_1> TO <fs_2>.
ASSIGN <fs_1> TO <dyntable>.
ENDFORM. "MYDYNTABLE
regards,
amit m.
Similar Messages
-
Dynamic internal table column issue
Hi
i have ALV report with dynamic internal table.after i build the internal table and fieldcatalog i have problem i.e. when grid is displayed then one of the column value is coming in the next column.i populated col_pos in field catalog also and in the debug mode data is populated correctly for respective columns in fieldcatalog and dynamic internal table. But when it is displayed i have this problem.
any inputs on this?Hi Moorthy,
Did you perform an ALV consistency check?
Check the below given links as well.
The Consistency Check - ALV Grid Control (BC-SRV-ALV) - SAP Library
SAP ALV Consistency Check
Regards,
Philip. -
Dynamic internal table column,How to create .
Hi all
My requirement is to convert the layout as bellow:
before:
column1 column2 column3
1 A 1
1 B 1
1 C 2
2 A 1
2 C 1
convert to :
column1 A B C
1 1 1 2
2 1 0 1
The detail requirement is first to select all the customers and then to get the customers sales informations . the customer's name should be the internal field name .
can anyone give me some suggestions? thanks a lot.hi,
chk this.
Types: begin of ttab,
fld1(10) type c,
fld2 type sy-datum,
end of ttab.
data: itab type table of ttab.
You can also build an internal table at runtime.
Here is a sample program.
report zxy_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.
* Create fields
clear index.
do 10 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>.
do 10 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.
check these links:
http://searchsap.techtarget.com/tip/1,289483,sid21_gci554038,00.html
/people/rich.heilman2/blog/2005/07/27/dynamic-internal-tables-and-structures--abap
rgds
Anver -
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 -
Filling Data in Dynamic internal table
Hello,
I have 2 internal tables TAB1 and TAB2.
I have Created Dynamic internal table From TAB1 rows.
Now I want to fill that Dynm. internal table from TAB2.
But TAB2 have more Rows with diffarant names. I want to move particular field of TAB2 to particular field.of dynamic IT.
kindly help.Hi,
I am sending the dynamic alv report for your referenece.
REPORT YMS_DYNAMICALV.
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_flds(5) type c.
selection-screen end of block b1.
start-of-selection.
build the dynamic internal table
perform build_dyn_itab.
write 5 records to the alv grid
do 5 times.
perform build_report.
enddo.
call the alv grid.
perform call_alv.
Build_dyn_itab
form build_dyn_itab.
data: new_table type ref to data,
new_line type ref to data,
wa_it_fldcat type lvc_s_fcat.
Create fields .
do p_flds times.
clear wa_it_fldcat.
wa_it_fldcat-fieldname = sy-index.
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>.
do p_flds times.
index = sy-index.
Set up fieldvalue
concatenate 'FLD' index into
fieldvalue.
condense fieldvalue no-gaps.
<b> assign component index of structure <dyn_wa> to <fs1>.
<fs1> = fieldvalue.</b>
enddo.
Append to the dynamic internal table
append <dyn_wa> to <dyn_table>.
endform.
CALL_ALV
form call_alv.
data: wa_cat like line of alv_fldcat.
do p_flds times.
clear wa_cat.
wa_cat-fieldname = sy-index.
wa_cat-seltext_s = sy-index.
wa_cat-outputlen = '5'.
append wa_cat to alv_fldcat.
enddo.
Call ABAP List Viewer (ALV)
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
it_fieldcat = alv_fldcat
tables
t_outtab = <dyn_table>.
endform.
Thanks,
Shankar -
Adding Specific columns of dynamic internal table row into another column
Hi Gurus,
I need to add few columns of a dynamic internal table row into another column:
Article description hy01 hy02 total
101 panza 10 12 22
102 masht 12 12 24
dynamic internal table is created and columns hy01 hy02.... can increase
How to add the the values in hy01 hy 02... into total.
Regards,
DepHi,
If you really want to have a dynamic table, then you will have to find a way to generate a whole new table, and then copy the data from the old table to the new one. There is no way to modify a type during runtime in ABAP.
Here an example how to generate a dynamic table based on another internal table, hope this will help you.
TYPE-POOLS: slis.
PARAMETERS: p_nb_hy TYPE i DEFAULT 2. "Number of new HY columns to be added
* Type ZST_T:
* matnr TYPE matnr
* maktx TYPE maktx
* hy01 TYPE i
* total TYPE i
TYPES: ty_t TYPE STANDARD TABLE OF zst_s.
PERFORM main.
*& Form main
* text
FORM main.
DATA: lt_fieldcat TYPE slis_t_fieldcat_alv,
lt_t TYPE ty_t,
lr_new_t TYPE REF TO data.
FIELD-SYMBOLS: <lt_new_t> TYPE STANDARD TABLE.
"Add some lines to LT_T just to have something to display on screen
DO 10 TIMES.
APPEND INITIAL LINE TO lt_t.
ENDDO.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_structure_name = 'ZST_S'
CHANGING
ct_fieldcat = lt_fieldcat.
"Copy LT_T to LR_NEW_T
PERFORM extend_and_copy_table USING lt_t p_nb_hy CHANGING lr_new_t lt_fieldcat.
CLEAR lt_t. "Not needed anymore...
ASSIGN lr_new_t->* TO <lt_new_t>.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
it_fieldcat = lt_fieldcat
TABLES
t_outtab = <lt_new_t>.
ENDFORM. "main
*& Form extend_and_copy_table
FORM extend_and_copy_table USING ut_t TYPE STANDARD TABLE
uv_nb_hy TYPE i
CHANGING cr_t TYPE REF TO data
ct_fieldcat TYPE slis_t_fieldcat_alv
RAISING cx_sy_struct_creation cx_sy_table_creation.
DATA: lo_tabledescr TYPE REF TO cl_abap_tabledescr,
lo_structdescr TYPE REF TO cl_abap_structdescr,
lo_new_structdescr TYPE REF TO cl_abap_structdescr,
lo_new_tabledescr TYPE REF TO cl_abap_tabledescr,
lt_components TYPE cl_abap_structdescr=>component_table,
ls_component TYPE cl_abap_structdescr=>component,
lv_field_cnt TYPE numc2,
ls_fieldcat TYPE slis_fieldcat_alv,
lr_fieldcat TYPE REF TO slis_fieldcat_alv.
FIELD-SYMBOLS: <ls_old_s> TYPE ANY,
<lt_new_t> TYPE STANDARD TABLE,
<ls_new_s> TYPE ANY.
"Get the list of all components from UT_T line structure
lo_tabledescr ?= cl_abap_tabledescr=>describe_by_data( ut_t ).
lo_structdescr ?= lo_tabledescr->get_table_line_type( ).
lt_components = lo_structdescr->get_components( ).
"The new columns will be from type of column HY01
ls_component-type = lo_structdescr->get_component_type( 'HY01' ).
"The new columns will have the same fieldcat info as column HY01
READ TABLE ct_fieldcat INTO ls_fieldcat WITH KEY fieldname = 'HY01'.
"HY<lv_field_cnt> = new field name
lv_field_cnt = uv_nb_hy + 1.
"For each new column...
DO uv_nb_hy TIMES.
"Generate the new column field name
CONCATENATE 'HY' lv_field_cnt INTO ls_component-name.
ls_fieldcat-fieldname = ls_component-name.
"Add the new field to the components of the new structure
INSERT ls_component INTO lt_components INDEX 4.
"Add the new field's fieldcat info to the fieldcat
INSERT ls_fieldcat INTO ct_fieldcat INDEX 4.
lv_field_cnt = lv_field_cnt - 1.
ENDDO.
"Adjust the COL_POS from fieldcat
LOOP AT ct_fieldcat REFERENCE INTO lr_fieldcat.
lr_fieldcat->col_pos = sy-tabix.
ENDLOOP.
"Create the new table
lo_new_structdescr = cl_abap_structdescr=>create( p_components = lt_components ).
lo_new_tabledescr = cl_abap_tabledescr=>create( p_line_type = lo_new_structdescr ).
CREATE DATA cr_t TYPE HANDLE lo_new_tabledescr.
ASSIGN cr_t->* TO <lt_new_t>.
"Copy all data from old to new table
LOOP AT ut_t ASSIGNING <ls_old_s>.
APPEND INITIAL LINE TO <lt_new_t> ASSIGNING <ls_new_s>.
MOVE-CORRESPONDING <ls_old_s> TO <ls_new_s>.
ENDLOOP.
ENDFORM. "main -
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 ? -
No column text displayed in alv when i use dynamic internal table
Hi friends,
when I use dynamic internal table to display the fields in ALV formant, field column text was not displaying ,
total row of column text was blank.
can u sujjest me in this...
with regards,
prasad.Hi
That depends on how you've filled the catalog table, here u need to insert the description for the labels (short, medium and long) and the description for the layout variant management.
So u make sure to fill the fields like
SCRTEXT_L
SCRTEXT_M
SCRTEXT_S
REPTEXT
Max -
Column names of a dynamic internal table
Hi Friends,
I have a dynamic internal table flowing in my ABAP program and I want to list down the column names of the this dynamic internal table.
The declaration of this dynamic internal table :
FIELD-SYMBOLS:
<l_t_data> TYPE STANDARD TABLE.
Can you please tell me how to get the column names?
Thanks,
GauravHi,
You can use ABAP Runtime Type Identification to get the column names of the internal table.
e.g >
>lo_itab holds reference to description object of internal table whose column names i have to extract.
>Using method describe_by_data of class cl_abap_typedescr export the field symbol assigned to the table and import the object reference into lo_itab.
>Then using method get_table_line_type of lo_itab import line type description object reference into lo_line.
>Check if lo_line is referring to a structure, if yes , downcast it to a object reference lo_struct of type cl_abap_structdescr.
>The column description of all columns in the structure is stored in 'components' table of cl_abap_structdescr.
So loop at the table to get all the column names stored in column 'name' of table 'components'.
Thank You. -
How to create Dynamic internal table with columns also created dynamically.
Hi All,
Any info on how to create a dynamic internal table along with columns(fields) also to be created dynamically.
My requirement is ..On the selection screen I enter the number of fields to be in the internal table which gets created dynamically.
I had gone thru some posts on dynamic table creation,but could'nt find any on the dynamic field creation.
Any suggestions pls?
Thanks
NaraI don't understand ...
something like that ?
* Form P_MODIFY_HEADER. *
form p_modify_header.
data : is_fieldcatalog type lvc_s_fcat ,
v_count(2) type n ,
v_date type d ,
v_buff(30).
* Update the fieldcatalog.
loop at it_fieldcatalog into is_fieldcatalog.
check is_fieldcatalog-fieldname+0(3) eq 'ABS' or
is_fieldcatalog-fieldname+0(3) eq 'VAL' .
move : is_fieldcatalog-fieldname+3(2) to v_count ,
p_perb2+5(2) to v_date+4(2) ,
p_perb2+0(4) to v_date+0(4) ,
'01' to v_date+6(2) .
v_count = v_count - 1.
call function 'RE_ADD_MONTH_TO_DATE'
exporting
months = v_count
olddate = v_date
importing
newdate = v_date.
if is_fieldcatalog-fieldname+0(3) eq 'ABS'.
concatenate 'Quantité 0'
v_date+4(2)
v_date+0(4)
into v_buff.
else.
concatenate 'Montant 0'
v_date+4(2)
v_date+0(4)
into v_buff.
endif.
move : v_buff to is_fieldcatalog-scrtext_s ,
v_buff to is_fieldcatalog-scrtext_m ,
v_buff to is_fieldcatalog-scrtext_l ,
v_buff to is_fieldcatalog-reptext .
modify it_fieldcatalog from is_fieldcatalog.
endloop.
* Modify the fieldcatalog.
call method obj_grid->set_frontend_fieldcatalog
exporting it_fieldcatalog = it_fieldcatalog.
* Refresh the display of the grid.
call method obj_grid->refresh_table_display.
endform. " P_MODIFY_HEADER -
How to Organize the columns in the dynamic internal table?
Hello Folks!
How to Organize the columns in the dynamic internal table? i tried passing the parameter COL_POS to the fieldcatalog, Which is not working.Organize in What order ? What is your way to output ?
If you use ALV, you need to create fresh FIELD CATALOG for your dynamic table and then assign the column position.
Regards,
Diwakar -
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 -
Hide or Delete Empty columns in dynamic internal table
Hi,
I am having an dynamic internal table which contains more than 100 columns.
I need to delete empty column from that table, can any one help this.Hello,
If you are talking about ALV then you can just the the table for empty columns before populating fieldcataloge and hide the columns.
If your query is still not answered please provide a detail requirement. -
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!
BettinaHi,
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 -
How to populate dynamic internal table fields with data??
Hi Folks,
How to assign a particular internal table field to a dynamically assigned internal table?
I have an excel sheet, and i upload the excel sheet data into an internal IT_EXLOAD table using FM ALSM_EXCEL_TO_INTERNAL_TABLE
Now i created a dynamic internal table which has the same column as in my DB table.
I have to fill the dynamically created Internal table with the IT_EXLOAD data dynamically.
Suppose in future if i add some field in DB table and for that field if i add some column in excel sheet there is no need to change in the program.
Looking for reply...
Best Regards,
Sayakhi,
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
filename = p_path
i_begin_col = '1'
i_begin_row = '2'
i_end_col = '2'
i_end_row = '1000'
TABLES
intern = intern
EXCEPTIONS
inconsistent_parameters = 1
upload_ole = 2
OTHERS = 3.
*declare intern_tmp as internal table tb_data in wich you want the data
*and declare a field symbol <fs_123>
LOOP AT intern.
ASSIGN COMPONENT intern-col OF STRUCTURE
intern_tmp TO <fs_123>.
IF NOT <fs_123> IS ASSIGNED.
CLEAR intern.
CLEAR intern_tmp.
CONTINUE.
ENDIF.
<fs_123> = intern-value.
AT END OF row.
CLEAR tb_data.
MOVE-CORRESPONDING: intern_tmp TO tb_data.
APPEND tb_data.
CLEAR intern_tmp.
ENDAT.
CLEAR intern.
ENDLOOP.
**paste this code and you can see the data in ur tables dynamically.
Thanks
Nitin Sachdeva
Maybe you are looking for
-
Urgently required Crystal Reports 2008 FixPack_03 for SAP B1 8.8
Dear All, I Urgently need Crystal Reports 2008 FixPack_03 for SAP B1 8.8. It is unavailable on the following link: Crystal Reports 2008 Reference [original link is broken] I have also searched it but unable to find it. If anyone has this, kindly shar
-
OAException Error FND-INVALID APPLICATION with JDeveloper tutorial
Hi I´m following Oracle Application Framework Developer’s Guide Release 11.5.10 RUP3. I´m trying to test my setup running the test_fwktutorial.jsp, but when i select the "Hello World" from the list i get the following error oracle.apps.fnd.framework.
-
How to use external .tld files with uix
Hey, I have a set of custom .tld files and that i was to use in my UIX pages. I got them to work correctly if I am using jsp files but for some reason it doesn't recognize the tags when they are in uix pages I far as I can tell, UIX actually requires
-
I lost My iphone 4 police were not responding what to do
Dear Apple Team I lost my iphone 4, its been 4 to 5 months now police were not tracking, i have seen in my icloud account in find my iphone it says your iphone is erased and it shows some else name like raaziphone its changed and it always showing of
-
Simple interceptor won't invoke
Hi, I'm trying to implement my first interceptor in EJB3 (in glassfish v3 final and netbeans 6.8) but the method wont invoke. I have checked the syntax a number of times and I can't see what's going wrong. Can anyone help? The class using the interce