07-11-2007 2:23 PM
Hello,
i would like to create an internal range table about a table, which Name is in a Field.
I had create a Table with following Fields:
FALL CHAR10
LFDNR INT2
ZUORD CHAR5
FNAME M_COMB_FNAME
SIGN SIGN
OPTIO OPTION
HIGH HIGH_RANGE
LOW LOW_RANGE
At first i would like to create an internal range table, about a table which standing in the Field FNAME. And if there is a new Tablename in the Field FNAME, than i would like to create a new internal range table.
My suggestions are:
At First to create a Fieldsymbol:
assign (FNAME) to ).
And now, to create the new range table.
But How?
there are "create data", but it´s not working.
And then to fill the range table...
Is there anybody, who could help me.
Thanks.
07-12-2007 9:45 AM
07-12-2007 9:52 AM
Hello,
in FNAME standing the Name of the table, which i would like to make a range table about it.
07-12-2007 10:52 AM
Hi I'm able to create dynamic ranges for structure not for table..
If u want I can post it here...
You may be helped by that and u can try to create dynamic ranges for tables..
Regards
Prax
07-12-2007 10:57 AM
07-12-2007 11:05 AM
Hi.. plz check below...
<b>
REPORT zprax_try7.
CLASS cl_alv_table_create DEFINITION LOAD.
DATA: t0000 TYPE p0000.
DATA: t_fieldcat TYPE lvc_t_fcat, " standard table of LVC_S_FCAT initial size 0 with header line,
wa_fieldcat TYPE lvc_s_fcat,
new_table TYPE REF TO data,
new_line TYPE REF TO data,
len1 TYPE i.
FIELD-SYMBOLS: <t_tab> TYPE table,
<wa_tab> TYPE ANY.
PARAMETERS: p_pernr TYPE pernr_d DEFAULT '00000001'.
START-OF-SELECTION.
wa_fieldcat-fieldname = 'SIGN'.
wa_fieldcat-tabname = 'R_TAB'.
wa_fieldcat-datatype = 'CHAR'.
wa_fieldcat-inttype = 'C'.
wa_fieldcat-intlen = 1.
APPEND wa_fieldcat TO t_fieldcat.
wa_fieldcat-fieldname = 'OPTION'.
wa_fieldcat-tabname = 'R_TAB'.
wa_fieldcat-datatype = 'CHAR'.
wa_fieldcat-inttype = 'C'.
wa_fieldcat-intlen = 2.
APPEND wa_fieldcat TO t_fieldcat.
describe field t0000 length len1 in character mode.
CLEAR wa_fieldcat.
wa_fieldcat-fieldname = 'LOW'.
wa_fieldcat-tabname = 'R_TAB'.
wa_fieldcat-datatype = 'CHAR'.
wa_fieldcat-inttype = 'C'.
wa_fieldcat-dd_roll = 'P0000'.
wa_fieldcat-intlen = len1.
APPEND wa_fieldcat TO t_fieldcat.
wa_fieldcat-fieldname = 'HIGH'.
wa_fieldcat-tabname = 'R_TAB'.
wa_fieldcat-datatype = 'CHAR'.
wa_fieldcat-dd_roll = 'P0000'.
wa_fieldcat-inttype = 'C'.
wa_fieldcat-intlen = len1. " Find out length at runtime
APPEND wa_fieldcat TO t_fieldcat.
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
it_fieldcatalog = t_fieldcat
IMPORTING
ep_table = new_table.
ASSIGN new_table->* TO <t_tab>.
CREATE DATA new_line LIKE LINE OF <t_tab>.
ASSIGN new_line->* TO <wa_tab>.
FIELD-SYMBOLS: <fs> TYPE ANY,
<fs_tab> TYPE table.
ASSIGN COMPONENT 1 OF STRUCTURE <wa_tab> TO <fs>.
<fs> = 'I'.
ASSIGN COMPONENT 2 OF STRUCTURE <wa_tab> TO <fs>.
<fs> = 'BT'.
ASSIGN COMPONENT 3 OF STRUCTURE <wa_tab> TO <fs>. "_tab>.
t0000-pernr = '00000001'.
<fs> = t0000.
ASSIGN COMPONENT 4 OF STRUCTURE <wa_tab> TO <fs>. "_tab>.
t0000-pernr = '44444444'.
<fs> = t0000.
APPEND <wa_tab> TO <t_tab>.
t0000-pernr = p_pernr.
IF t0000 In <T_TAB>.
MESSAGE 'Yes !' TYPE 'I'.
ELSE.
MESSAGE 'No !!' TYPE 'I'.
ENDIF.</b>
But in this case structure should be in ABAP data dictionary..
Reward points if useful..
Regards
Prax
Message was edited by:
Prax
07-12-2007 12:42 PM
Regardless.
But, i now the tablename (stading in FNAME) and i could find out, which type it is.
assign lt_fallz-FNAME to <fs>.
lr_strucdescr ?= CL_ABAP_STRUCTDESCR=>describe_by_name( <fs> ).
And i tried to create a range about this tabletype, about that components.
Regards
Tobias