‎2011 Feb 16 10:29 AM
Hi Experts,
my scenario is like i have header data, item data and serial numbers.
so with respect to the quantity in unit of measure ,there will be number of serial numbers..
i have declared the dynamic internal table,but i am not getting the logic to change the structure accordingly with respect to the flat file entries..
is it possible to do or its not possible....any suggestion!!!!i have declared like this....
TYPES: BEGIN OF ty_final,
bldat TYPE string, "Document Date
budat TYPE string, "Psting Date
bktxt TYPE string, "Document Header Text
werks TYPE string, "Plant
lgort TYPE string, "Storage Location
matnr TYPE string, "Material Number
erfmg TYPE string, "Quantity in Unit Of Entry
anln1 TYPE string, "Asset Number
anln2 TYPE string, "Asset Subnumber
sernr TYPE string, "serial Number
END OF ty_final.
DATA : it_final TYPE TABLE OF ty_final,
wa_final TYPE ty_final.
FIELD-SYMBOLS : <fs_final> TYPE table.
ASSIGN it_final TO <fs_final>.
after this i called gui upload and passed internal table it_final..
but i have to change the internal table structure dynamically before the upload function.so that it will match with the flat file...
Regards
Karthick
‎2011 Feb 16 2:34 PM
Did you mean it this way ????
types:begin of ty1,
f1 type c,
f2 type c,
end of ty1.
types:begin of ty2,
f1 type char02,
f2 type char02,
end of ty1.
data:it1 type table of ty1,
it2 type table of ty2.
field-symbols:<fs_tab> type standard table.
if op1 = 'X'.
assign it1 to <fs_tab>.
else.
assign it2 to <fs_tab>.
endif.
‎2011 Feb 16 10:44 AM
Hi,
Can you tell on what basis your flat file is going to change ?
How many types of flat file will you require to upload ?
Regards,
Madhukar Shetty
‎2011 Feb 16 1:57 PM
Hi madhukar
i have only one flat file..i am doing uploading for mb1a transaction..
my flat file is like
document date posting date docheader text plant storage location material quantityinunit of measure assetno subassetno serialno
with respect to quantity n number of serial number will be there.
in that i have to pass serial number only dyanamicaly ....
is that possible...
‎2011 Feb 16 10:49 AM
There are at least two approaches you can use to change/generate new dynamic-structured table. Either with [RTTI + RTTS|https://wiki.sdn.sap.com/wiki/display/Snippets/CreatingFlatandComplexInternalTablesDynamicallyusingRTTI] or using [CL_ALV_TABLE_CREATE|http://www.sdn.sap.com/irj/scn/advancedsearch?query=cl_alv_table_create] . In this one just determine fieldcatalog of current table and change it accordingly, then regenarate table.
There are plenty of examples in SCN for this. You should not face difficulties applying this.
Regards
Marcin
‎2011 Feb 16 1:59 PM
hi marctin,
i am not getting why i have to use field catalog?i am doing uploading for mb1a transaction..
and cant iuse the way i used to declare dynamic internal table?
‎2011 Feb 16 10:59 AM
hi,
data : ifc type lvc_t_fcat.
call method cl_alv_table_create=>create_dynamic_table
exporting
it_fieldcatalog = ifc
importing
ep_table = dy_table.
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>.
regards,
Sri
‎2011 Feb 16 2:01 PM
hi sridhar,
i m not just getting whhy i have to use field catalog?
the way i declared the dynamic internal table is wrong?
‎2011 Feb 16 2:34 PM
Did you mean it this way ????
types:begin of ty1,
f1 type c,
f2 type c,
end of ty1.
types:begin of ty2,
f1 type char02,
f2 type char02,
end of ty1.
data:it1 type table of ty1,
it2 type table of ty2.
field-symbols:<fs_tab> type standard table.
if op1 = 'X'.
assign it1 to <fs_tab>.
else.
assign it2 to <fs_tab>.
endif.
‎2011 Feb 17 4:36 AM
hi keshav,
s this way only....i have already put how i declared!!!!!!!
‎2011 Feb 21 10:19 AM
Partly solved but thanks for the kind help and tips provided by the experts..
‎2012 Sep 05 10:34 AM
i used the function module TEXT_CONVERT_XLS_TO_SAP but it's showing field symbol is not assigned in runtime