Issue in using CL_ALV_TABLE_CREATE= CREATE_DYNAMIC_TABLE
Hi,
I am using CL_ALV_TABLE_CREATE=>CREATE_DYNAMIC_TABLE to create dynamic internal table. I am displaying a tree in the output, based on the value selected in the tree, dynamic internal table is generated. If I continuously select the tree value for more than 36 times. This method is giving me a dump.
Kindly help me in resolving this issue.
Thanks in advance.
Regards.
once you build the field catalog use the following code to create the itab. this doesnt have the limitation of 36
data: struct_type type ref to cl_abap_structdescr,
tab_type type ref to cl_abap_tabledescr ,
comp_tab type cl_abap_structdescr=>component_table,
comp like line of comp_tab,
dref type ref to data ,
dref1 type ref to data ,
op_len type i .
clear: comp , comp_tab ,is_fieldcat .
refresh comp_tab .
loop at it_fieldcat into is_fieldcat .
clear op_len .
op_len = is_fieldcat-outputlen .
comp-name = is_fieldcat-fieldname.
comp-type = cl_abap_elemdescr=>get_c( op_len ).
append comp to comp_tab.
clear : is_fieldcat , comp .
endloop .
clear struct_type .
call method cl_abap_structdescr=>create
exporting
p_components = comp_tab
p_strict = cl_abap_structdescr=>false
receiving
p_result = struct_type .
* struct_type = cl_abap_structdescr=>create( comp_tab ).
clear tab_type .
call method cl_abap_tabledescr=>create
exporting
p_line_type = struct_type
p_table_kind = cl_abap_tabledescr=>tablekind_std
* P_UNIQUE = ABAP_FALSE
* P_KEY =
* P_KEY_KIND = KEYDEFKIND_DEFAULT
receiving
p_result = tab_type .
create data dref1 type handle tab_type.
Similar Messages
-
Hi friends,
I have a problem while creating dynamic table by using
CL_ALV_TABLE_CREATE=>CREATE_DYNAMIC_TABLE.
this method is only executing for 36 times, i saw some threads which were on similar topic but none was answered fully.
i have to execute this method more times not exactly like 36 times it will not be senseful in my application if i execute it only 36 times.
Some one suggest me that i'll have to use was 6.0 but it's a limitation for me that i have to use 4.7 so pls suggest me according to keep in mind 4.7 n in my application none one isstatic all things in my application is dybanic.
how to solve this problem?
I will be thankful for your replies,
regards,hi anuj
try this example may be it wil help you.
type-pools : abap.
field-symbols: <dyn_table> type standard table,
<dyn_wa>,
<dyn_field>.
data: dy_table type ref to data,
dy_line type ref to data,
xfc type lvc_s_fcat,
ifc type lvc_t_fcat.
selection-screen begin of block b1 with frame.
parameters: p_table(30) type c default 'T001'.
selection-screen end of block b1.
start-of-selection.
perform get_structure.
perform create_dynamic_itab. *********Creates a dyanamic internal table*********
perform get_data.
perform write_out.
form get_structure.
data : idetails type abap_compdescr_tab,
xdetails type abap_compdescr.
data : ref_table_des type ref to cl_abap_structdescr.
Get the structure of the table.
ref_table_des ?=
cl_abap_typedescr=>describe_by_name( p_table ).
idetails[] = ref_table_des->components[].
loop at idetails into xdetails.
clear xfc.
xfc-fieldname = xdetails-name .
xfc-datatype = xdetails-type_kind.
xfc-inttype = xdetails-type_kind.
xfc-intlen = xdetails-length.
xfc-decimals = xdetails-decimals.
append xfc to ifc.
endloop.
endform.
form create_dynamic_itab.
Create dynamic internal table and assign to FS
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>.
endform.
form get_data.
Select Data from table.
select * into table <dyn_table>
from (p_table).
endform.
Write out data from table.
loop at <dyn_table> into <dyn_wa>.
do.
assign component sy-index
of structure <dyn_wa> to <dyn_field>.
if sy-subrc <> 0.
exit.
endif.
if sy-index = 1.
write:/ <dyn_field>.
else.
write: <dyn_field>.
endif.
enddo.
endloop.
one more
REPORT ZCLUST1 .
Example: how to create a dynamic internal table
The dynamic internal table stucture
DATA: BEGIN OF STRUCT OCCURS 10,
FILDNAME(8) TYPE C,
ABPTYPE TYPE C,
LENGTH TYPE I,
END OF STRUCT.
The dynamic program source table
DATA: BEGIN OF INCTABL OCCURS 10,
LINE(72),
END OF INCTABL.
DATA: LNG TYPE I, TYPESRTING(6).
Sample dynamic internal table stucture
STRUCT-FILDNAME = 'field1'. STRUCT-ABPTYPE = 'c'. STRUCT-LENGTH = '6'.
APPEND STRUCT. CLEAR STRUCT.
STRUCT-FILDNAME = 'field2'. STRUCT-ABPTYPE = 'd'.
APPEND STRUCT. CLEAR STRUCT.
STRUCT-FILDNAME = 'field3'. STRUCT-ABPTYPE = 'i'.
APPEND STRUCT. CLEAR STRUCT.
Create the dynamic internal table definition in the dyn. program
INCTABL-LINE = 'program zdynpro.'. APPEND INCTABL.
INCTABL-LINE = 'data: begin of dyntab occurs 10,'. APPEND INCTABL.
LOOP AT STRUCT.
INCTABL-LINE = STRUCT-FILDNAME.
LNG = STRLEN( STRUCT-FILDNAME ).
IF NOT STRUCT-LENGTH IS INITIAL .
TYPESRTING(1) = '('.
TYPESRTING+1 = STRUCT-LENGTH.
TYPESRTING+5 = ')'.
CONDENSE TYPESRTING NO-GAPS.
INCTABL-LINE+LNG = TYPESRTING.
ENDIF.
INCTABL-LINE+15 = 'type '.
INCTABL-LINE+21 = STRUCT-ABPTYPE.
INCTABL-LINE+22 = ','.
APPEND INCTABL.
ENDLOOP.
INCTABL-LINE = 'end of dyntab. '.
APPEND INCTABL.
Create the code processes the dynamic internal table
INCTABL-LINE = ' '. APPEND INCTABL.
INCTABL-LINE = 'dyntab-field1 = ''aaaaaa''.'. APPEND INCTABL.
INCTABL-LINE = 'dyntab-field1 = ''19970814''.'. APPEND INCTABL.
INCTABL-LINE = 'dyntab-field1 = 1.'. APPEND INCTABL.
INCTABL-LINE = 'append dyntab.'. APPEND INCTABL.
INCTABL-LINE = ' '. APPEND INCTABL.
INCTABL-LINE = 'loop at dyntab.'. APPEND INCTABL.
INCTABL-LINE = 'write: / dyntab.'. APPEND INCTABL.
INCTABL-LINE = 'endloop.'. APPEND INCTABL.
Create and run the dynamic program
INSERT REPORT 'zdynpro'(001) FROM INCTABL.
SUBMIT ZDYNPRO.
or Just try out this simpler dynamic internal tables
DATA: itab TYPE STANDARD TABLE OF spfli,
wa LIKE LINE OF itab.
DATA: line(72) TYPE c,
list LIKE TABLE OF line(72).
START-OF-SELECTION.
*line = ' CITYFROM CITYTO '.
line = ' AIRPTO '.
APPEND line TO list.
SELECT DISTINCT (list)
INTO CORRESPONDING FIELDS OF TABLE itab
FROM spfli.
IF sy-subrc EQ 0.
LOOP AT itab INTO wa.
WRITE: / wa-cityfrom, wa-cityto.
WRITE :/ wa-airpto.
ENDLOOP.
ENDIF.
thanks & regards
pardeep kharb
Edited by: pardeep kumar on Jul 29, 2008 5:18 PM -
Dear Expers
I created a ABAP with dynamic internal table using cl_alv_table_create=>create_dynamic_table more or less according to this example here:
cl_alv_table_create=>create_dynamic_table error
Now I need a second dynamic internal table in the same program. So in a first try I just process the same code a second time (copy+paste) with new variables and new fieldsymbols. But when the program runs and the method is called a second time there is this error: "LT_GENTAB-xyz has laready been declared 7 xyz".
I believe I must free/initialize/delete/undeclare LT_GENTAB before calling the method a second time. Can anybody tell me how to do that? Or is there any other advice on how to create 2 internal tables dynamically in the same program (if possible using the same approach)?
Many thanksHi,
Here is the sample code from the link in your message :
Filling a table for field declarations :
loop at it_details into wa_details.
clear wa_it_fldcat.
wa_it_fldcat-fieldname = wa_details-name .
wa_it_fldcat-datatype = wa_details-type_kind.
wa_it_fldcat-inttype = wa_details-type_kind.
wa_it_fldcat-intlen = wa_details-length.
wa_it_fldcat-decimals = wa_details-decimals.
append wa_it_fldcat to it_fldcat .
endloop.
Call the method for dynamic creation :
call method cl_alv_table_create=>create_dynamic_table
exporting
it_fieldcatalog = it_fldcat
importing
ep_table = new_table
I meant you didn't refresh table it_fldcat as you fields declaration table.
Did u refresh this table before your second copy code? -
Cl_alv_table_create= create_dynamic_table
Hi,
When I use this method it is dumping
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
it_fieldcatalog = it_fieldcat
IMPORTING
ep_table = <new_table>.
The error What I am getting is "LOAD_PROGRAM_NOT_FOUND" "CX_SY_PROGRAM_NOT_FOUND" MESSAGE IS ' Program " " Not Found '.
Please help us in this issue
Thanks & Regards,
Sivaram KandulaDear Rich,
I am facing very similar problem to the solution you gave here, but I couldn't get through with this, Hope you can certainly help me and I am pasting my code here: pls look into it.
Awards will be rewarded for sure...
Material Field properties are set here
WA_FIELDCAT-FIELDNAME = 'MATNR'.
WA_FIELDCAT-SELTEXT = TEXT-018.
WA_FIELDCAT-INTTYPE = 'C'.
WA_FIELDCAT-INTLEN = 18.
WA_FIELDCAT-OUTPUTLEN = 18.
APPEND WA_FIELDCAT TO T_FIELDCAT.
CLEAR WA_FIELDCAT.
Material Desc properties are set here
WA_FIELDCAT-FIELDNAME = 'MAKTX'.
WA_FIELDCAT-SELTEXT = TEXT-019.
WA_FIELDCAT-INTTYPE = 'C'.
WA_FIELDCAT-INTLEN = 35.
WA_FIELDCAT-OUTPUTLEN = 35.
WA_FIELDCAT-JUST = 'X'.
APPEND WA_FIELDCAT TO T_FIELDCAT.
CLEAR WA_FIELDCAT.
*added by sarath Dt:03.08.06,Ticket#483.
IF P_BATCH = 'X' OR P_FREEST = 'X'.
WA_FIELDCAT-FIELDNAME = 'CAT_DESC'.
WA_FIELDCAT-SELTEXT = TEXT-041.
WA_FIELDCAT-INTTYPE = 'C'.
WA_FIELDCAT-INTLEN = 35.
WA_FIELDCAT-OUTPUTLEN = 35.
WA_FIELDCAT-JUST = 'X'.
APPEND WA_FIELDCAT TO T_FIELDCAT.
CLEAR WA_FIELDCAT.
ENDIF.
*end of additoin by sarath Dt:03.08.06,Ticket#483.
Plant properties are set here
WA_FIELDCAT-FIELDNAME = 'WERKS'.
WA_FIELDCAT-SELTEXT = TEXT-020.
WA_FIELDCAT-INTTYPE = 'C'.
WA_FIELDCAT-INTLEN = 4.
WA_FIELDCAT-OUTPUTLEN = 4.
APPEND WA_FIELDCAT TO T_FIELDCAT.
CLEAR WA_FIELDCAT.
Plant properties are set here
*added by sarath Dt:03.08.06,Ticket#483.
IF P_BATCH = 'X' OR P_FREEST = 'X'.
WA_FIELDCAT-FIELDNAME = 'SPART'.
WA_FIELDCAT-SELTEXT = TEXT-042.
WA_FIELDCAT-INTTYPE = 'C'.
WA_FIELDCAT-INTLEN = 35.
WA_FIELDCAT-OUTPUTLEN = 35.
WA_FIELDCAT-JUST = 'X'.
APPEND WA_FIELDCAT TO T_FIELDCAT.
CLEAR WA_FIELDCAT.
ENDIF.
*end of additoin by sarath Dt:03.08.06,Ticket#483.
WA_FIELDCAT-FIELDNAME = 'MVGR1'.
WA_FIELDCAT-SELTEXT = TEXT-026.
WA_FIELDCAT-INTTYPE = 'C'.
WA_FIELDCAT-INTLEN = 9.
WA_FIELDCAT-OUTPUTLEN = 9.
APPEND WA_FIELDCAT TO T_FIELDCAT.
CLEAR WA_FIELDCAT.
Storage Location properties are set here
IF P_STOR = 'X'.
WA_FIELDCAT-FIELDNAME = 'LGORT'.
WA_FIELDCAT-SELTEXT = TEXT-021.
WA_FIELDCAT-INTTYPE = 'C'.
WA_FIELDCAT-INTLEN = 4.
WA_FIELDCAT-OUTPUTLEN = 4.
APPEND WA_FIELDCAT TO T_FIELDCAT.
CLEAR WA_FIELDCAT.
Stock Type properties are set here
WA_FIELDCAT-FIELDNAME = 'STOCKTYP'.
WA_FIELDCAT-SELTEXT = TEXT-022.
WA_FIELDCAT-INTTYPE = 'C'.
WA_FIELDCAT-INTLEN = 15.
WA_FIELDCAT-OUTPUTLEN = 15.
APPEND WA_FIELDCAT TO T_FIELDCAT.
CLEAR WA_FIELDCAT.
ENDIF.
added by gopal for ticket#536
This is for sorting the numeric fields only
DATA: IDX TYPE SY-TABIX,
D_IND TYPE SY-TABIX.
LOOP AT T_SIZES INTO T1 WHERE SIZE CO TEXT-043.
IDX = SY-TABIX.
IF T1-SIZE < 10.
CONCATENATE '0' T1-SIZE INTO T1-SIZE.
ELSEIF T1-SIZE = '9.5'.
CONCATENATE '0' T1-SIZE INTO T1-SIZE.
ENDIF.
APPEND T1.
CLEAR T1.
DELETE T_SIZES INDEX IDX .
CLEAR : IDX.
ENDLOOP.
CLEAR : IDX.
LOOP AT T_SIZES INTO T2 WHERE SIZE CO TEXT-044.
IDX = SY-TABIX.
APPEND T2.
CLEAR T2.
DELETE T_SIZES INDEX IDX .
CLEAR : IDX.
ENDLOOP.
SORT T2 BY SIZE .
APPEND LINES OF T2[] TO T1[].
SORT T1 BY SIZE .
IF T_SIZES[] IS INITIAL.
T_SIZES[] = T1[].
ELSE.
APPEND LINES OF T_SIZES[] TO T1[].
DESCRIBE TABLE T1[].
D_IND = SY-TABIX.
DELETE T_SIZES[] FROM 1 TO D_IND.
T_SIZES[] = T1[].
ENDIF.
**end of addition by gopal for ticket#536
LOOP AT T_SIZES INTO WA_SIZES.
IF WA_SIZES-SIZE CA '.'.
DEIK905030 for Ticket#691 by harsha on 31052007
REPLACE '.' WITH '_' INTO WA_SIZES-SIZE .
**End of changes for DEIK905030.
ENDIF.
Sizes of the material field properties are set here
WA_FIELDCAT-FIELDNAME = WA_SIZES-SIZE.
WA_FIELDCAT-SELTEXT = WA_SIZES-SIZE.
WA_FIELDCAT-INTTYPE = 'I'.
WA_FIELDCAT-INTLEN = 11.
WA_FIELDCAT-DO_SUM = 'X'.
WA_FIELDCAT-OUTPUTLEN = 11.
WA_FIELDCAT-NO_ZERO = 'X'.
APPEND WA_FIELDCAT TO T_FIELDCAT.
CLEAR WA_FIELDCAT.
ENDLOOP.
Total Field properties are set here
WA_FIELDCAT-FIELDNAME = 'TOTAL'.
WA_FIELDCAT-SELTEXT = TEXT-023.
WA_FIELDCAT-INTTYPE = 'I'.
WA_FIELDCAT-INTLEN = 13.
WA_FIELDCAT-OUTPUTLEN = 13.
WA_FIELDCAT-DO_SUM = 'X'.
APPEND WA_FIELDCAT TO T_FIELDCAT.
CLEAR WA_FIELDCAT.
maximum Retail Price field properties are set here
WA_FIELDCAT-FIELDNAME = 'MRPRT'.
WA_FIELDCAT-SELTEXT = TEXT-028.
WA_FIELDCAT-INTTYPE = 'C'.
WA_FIELDCAT-DECIMALS = 2.
WA_FIELDCAT-INTLEN = 13.
WA_FIELDCAT-OUTPUTLEN = 13.
APPEND WA_FIELDCAT TO T_FIELDCAT.
CLEAR WA_FIELDCAT.
maximum Retail Price field properties are set here
WA_FIELDCAT-FIELDNAME = 'MRP'.
WA_FIELDCAT-SELTEXT = TEXT-024.
WA_FIELDCAT-DO_SUM = 'X'.
WA_FIELDCAT-INTTYPE = 'C'.
WA_FIELDCAT-DECIMALS = 2.
WA_FIELDCAT-INTLEN = 13.
WA_FIELDCAT-OUTPUTLEN = 13.
APPEND WA_FIELDCAT TO T_FIELDCAT.
CLEAR WA_FIELDCAT.
Moving Average Value properties are set here
WA_FIELDCAT-FIELDNAME = 'MAV'.
WA_FIELDCAT-SELTEXT = TEXT-025.
WA_FIELDCAT-DO_SUM = 'X'.
WA_FIELDCAT-INTTYPE = 'C'.
WA_FIELDCAT-DECIMALS = 2.
WA_FIELDCAT-INTLEN = 13.
WA_FIELDCAT-OUTPUTLEN = 13.
APPEND WA_FIELDCAT TO T_FIELDCAT.
CLEAR WA_FIELDCAT.
To create the dynamic Internal Table.
The fields of this table are obtained at runtime
CALL METHOD CL_ALV_TABLE_CREATE=>CREATE_DYNAMIC_TABLE
EXPORTING
IT_FIELDCATALOG = T_FIELDCAT
IMPORTING
EP_TABLE = T_DATA
EXCEPTIONS
GENERATE_SUBPOOL_DIR_FULL = 1
OTHERS = 2
IF SY-SUBRC <> 0.
MESSAGE E074 WITH TEXT-015. " Error Creating int table.
EXIT.
ENDIF.
ASSIGN T_DATA->* TO <FS_BATCH>.
CREATE DATA WA_NEWTAB LIKE LINE OF <FS_BATCH>. -
Field names for cl_alv_table_create= create_dynamic_table
Morning All
My client is currently implementing SAP QM at one of the labs and I have come across a situation where the fieldnames required for a dynamic table creation can potentially contain spaces and special characters. So far I have urged them to remove all such characters as the call to the cl_alv_table_create=>create_dynamic_table method will dump if they are present.
My question therefore is, is there a definitive list of characters that cannot be used as part of a fieldname? I intend to use such a list to then search and replace the special characters to enable me to match fieldnames.
For those of you that know QM, we cannot use internally assigned numbers for master characteristics (client decision) and special characters are frequently used as names in the lab. My client sees it as a limitation to remove the spaces and special characters from the names but unfortunately it causes problems for me if they don't.
I need to match the names to determine results for a report so substition seems to be the way forward - unless some else has another suggestion?
Thanks in advance
IanThere is a form called SAACHECK in module pool RDDU0001 that the data dictionary program uses to check the validity of field names. You should probably have a look at the logic.
But why use the Master characteristics as the field name anyway? Why not instead create a cross reference in an internal table and generate a simple sequence for each unique master characteristic. That way your field names are just the sequence number, but you can still match up your data with a binary read on the cross reference internal table. -
Table Type in cl_alv_table_create= create_dynamic_table
Hi guys,
The method create_dynamic_table from cl_alv_table_create has as exporting parameter a fielcatalog table. I want to insert a table type in this table, basically the field INTTYPE from LVC_S_FCAT can do that if u put the value 'h' in it. But I notice, that in method implementations all the cases are considered:
C
Character String
N
Character String with Digits Only
D
Date (Date: YYYYMMDD)
T
Time (Time: HHMMSS)
X
Byte Sequence (heXadecimal)
I
Integer number (4-byte integer with sign)
b
1-byte integer, integer number <= 254
s
2-byte integer, only for length field before LCHR or LRAW
P
Packed number
F
Floating point number to accuracy of 8 bytes
and other, but not 'h'.
Does anybody knows how create a dynamic table with a table type inside ? The table type has the structure from data dictionary lvc_t_scol.
Ionut.cl_alv_table_create=>create_dynamic_table( ) is no longer recommended to build dynamic tables.
RTTC classes are very intuitive and quite easy to maintain.
DATA:
gt_struct_fields TYPE cl_abap_structdescr=>component_table,
gwa_struct_field TYPE cl_abap_structdescr=>component.
DATA:
goref_table TYPE REF TO cl_abap_tabledescr,
gdref_table TYPE REF TO data.
FIELD-SYMBOLS <gt_dynamic> TYPE STANDARD TABLE.
TRY.
* f1 TYPE c LENGTH 10
gwa_struct_field-name = `F1`.
gwa_struct_field-type = cl_abap_elemdescr=>get_c( 10 ).
APPEND gwa_struct_field TO gt_struct_fields.
CLEAR gwa_struct_field.
* f2 TYPE bukrs
gwa_struct_field-name = `F2`.
gwa_struct_field-type ?= cl_abap_typedescr=>describe_by_name( `BUKRS` ).
APPEND gwa_struct_field TO gt_struct_fields.
CLEAR gwa_struct_field.
* f3 TYPE flighttab
gwa_struct_field-name = `F3`.
gwa_struct_field-type ?= cl_abap_typedescr=>describe_by_name( `FLIGHTTAB` ).
APPEND gwa_struct_field TO gt_struct_fields.
CLEAR gwa_struct_field.
* Use the structure object to build the table
goref_table = cl_abap_tabledescr=>get(
cl_abap_structdescr=>get( gt_struct_fields )
CREATE DATA gdref_table TYPE HANDLE goref_table.
ASSIGN gdref_table->* TO <gt_dynamic>.
CATCH ##no_handler
cx_sy_struct_creation
cx_parameter_invalid_range
cx_sy_table_creation.
ENDTRY.
BR,
Suhas -
Hi Gurus,
I have done the following code, but it is not treating <alv_table> and <alv_table_new> as different tables.
How can I create a duplicate table of <alv_table> in the below context ??
DATA : ldtab TYPE REF TO data,
ldtab_NEW TYPE REF TO data.
FIELD-SYMBOLS: <alv_table> TYPE table,
<alv_table_NEW> TYPE table.
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
it_fieldcatalog = gt_fcat
IMPORTING
ep_table = ldtab.
IF sy-subrc = 0.
ldtab_new = ldtab.
ASSIGN ldtab->* TO <alv_table>.
ASSIGN ldtab_new->* TO <alv_table_new>.
ENDIF.
Regards,
Sandip.hi,
Both field symbols i.e. <alv_table> and <alv_table_new> are pointing to same memory area because of the statements
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
it_fieldcatalog = gt_fcat
IMPORTING
ep_table = ldtab.
IF sy-subrc = 0.
ldtab_new = ldtab. <----
do not perform this step
ASSIGN ldtab->* TO <alv_table>.
ASSIGN ldtab_new->* TO <alv_table_new>.
endif.
instead write -
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
it_fieldcatalog = gt_fcat
IMPORTING
ep_table = ldtab.
IF sy-subrc = 0.
ASSIGN ldtab->* TO <alv_table>.
endif.
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
it_fieldcatalog = gt_fcat
IMPORTING
ep_table = ldtab_new.
IF sy-subrc = 0.
ASSIGN ldtab_new->* TO <alv_table_new>.
endif.
try the above mentioned code.
I hope this will resolve your issue.
Regards,
Sambaran Ray -
Hello experts:
I have a little problem, I want to create an ALV field with 4 decimales, it's a dinamic table, but when the alv report shows the fields it shows only 2 decimals, here the main code for explaining me better:
Here the code for create the field with decimals:
* Netpr
lv_cols = lv_cols + 1.
MOVE lv_cols TO wa_it_fldcat-col_pos.
MOVE 'NETPR' TO wa_it_fldcat-fieldname.
MOVE 'Net Price' TO wa_it_fldcat-scrtext_l.
MOVE 'Net Price' TO wa_it_fldcat-scrtext_m.
MOVE 'Net Pr' TO wa_it_fldcat-scrtext_s.
MOVE 'CURR' TO wa_it_fldcat-datatype.
MOVE 'P' TO wa_it_fldcat-inttype.
MOVE 11 TO wa_it_fldcat-intlen.
MOVE 4 TO wa_it_fldcat-decimals.
MOVE '' TO wa_it_fldcat-ref_field.
MOVE '' TO wa_it_fldcat-ref_table.
APPEND wa_it_fldcat TO t_fldcat.
After create more fields, here the code for create the dinamic ALV table:
* 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>.
After this method, the structure of the work area having the data type of the fields and all the atributes, the decimals of the NETPR fields just have 2 decimals =(
I hope my explanation it's clear.
Any help with this issue it's very welcome, thank you very much for your time.
MiriamHi
Xiaonan Hu is right: u need to delete the row where u transfer CURR as type:
* Netpr
lv_cols = lv_cols + 1.
MOVE lv_cols TO wa_it_fldcat-col_pos.
MOVE 'NETPR' TO wa_it_fldcat-fieldname.
MOVE 'Net Price' TO wa_it_fldcat-scrtext_l.
MOVE 'Net Price' TO wa_it_fldcat-scrtext_m.
MOVE 'Net Pr' TO wa_it_fldcat-scrtext_s.
*MOVE 'CURR' TO wa_it_fldcat-datatype.
MOVE 'P' TO wa_it_fldcat-inttype.
MOVE 11 TO wa_it_fldcat-intlen.
MOVE 4 TO wa_it_fldcat-decimals.
MOVE '' TO wa_it_fldcat-ref_field.
MOVE '' TO wa_it_fldcat-ref_table.
APPEND wa_it_fldcat TO t_fldcat.
If you transfer CURR, the method will defined a type p with 2 decimals by default, so it's useless to indicate the decimals in this case.
Infact the method calls the fm ALV_TABLE_CREATE, and here the abap code is:
- for CURR type:
elseif ls_fieldcat-datatype = 'CURR'.
concatenate 'DATA:'
ls_fieldcat-fieldname
'TYPE'
ls_fieldcat-inttype
'DECIMALS 2.'
into lt_source-line separated by space.
- for P type
if ls_fieldcat-inttype = 'P' and not ls_fieldcat-decimals is
initial.
replace '.' with 'DECIMALS' into lt_source-line.
concatenate lt_source-line ls_fieldcat-decimals '.' into
lt_source-line separated by space.
endif.
Max -
Reference comp in dynamic internal table using CL_ALV_TABLE_CREATE
Hi,
I am using CL_ALV_TABLE_CREATE to create a dynamic internal table. Everything works fine, but there is one problem with it. How can i create a component in the internal table that is actually a REF TO a certain data type. i.e. later i would like to store a reference to some dataobj in this component of the internal table.
I cannot use cl_abap_*descr classes to create internal table because of some other reasons, otherwise it would have been easy to do it.
Any kind of help would be highly appreciated.
Thanks and best regards,
GhufranHi Ghufran,
I do have an idea about the class <b>CL_ALV_TABLE_CREATE</b> , but i have writen an exmaple code to create a Dynamic Iternal table, please have a look, it may help you
*& Report Z_DYNAMIC_INTERNALTABLE *
report z_dynamic_internaltable .
data: d_ref type ref to data,
d_ref2 type ref to data ,
i_alv_cat type table of lvc_s_fcat,
ls_alv_cat like line of i_alv_cat.
types tabname like dcobjdef-name .
parameter: p_tablen type tabname.
data: begin of itab occurs 0.
include structure dntab.
data: end of itab.
field-symbols : <f_fs> type table,
<f_fs1> type table,
<f_fs2> type any,
<f_fs3> type table,
<f_fs4> type any.
refresh itab.
call function 'NAMETAB_GET'
exporting
langu = sy-langu
tabname = p_tablen
tables
nametab = itab
exceptions
no_texts_found = 1.
loop at itab .
ls_alv_cat-fieldname = itab-fieldname.
ls_alv_cat-ref_table = p_tablen.
ls_alv_cat-ref_field = itab-fieldname.
append ls_alv_cat to i_alv_cat.
endloop.
internal table build
call method cl_alv_table_create=>create_dynamic_table
exporting it_fieldcatalog = i_alv_cat
importing ep_table = d_ref .
assign d_ref->* to <f_fs>.
select * from (p_tablen) into corresponding fields of table <f_fs>.
loop at <f_fs> assigning <f_fs2>.
assign itab-fieldname to <f_fs4>.
loop at itab.
write: / <f_fs4>.
endloop.
endloop.
Thanks
Sudheer -
Issue while using SUBPARTITION clause in the MERGE statement in PLSQL Code
Hello All,
I am using the below code to update specific sub-partition data using oracle merge statements.
I am getting the sub-partition name and passing this as a string to the sub-partition clause.
The Merge statement is failing stating that the specified sub-partition does not exist. But the sub-partition do exists for the table.
We are using Oracle 11gr2 database.
Below is the code which I am using to populate the data.
declare
ln_min_batchkey PLS_INTEGER;
ln_max_batchkey PLS_INTEGER;
lv_partition_name VARCHAR2 (32767);
lv_subpartition_name VARCHAR2 (32767);
begin
FOR m1 IN ( SELECT (year_val + 1) AS year_val, year_val AS orig_year_val
FROM ( SELECT DISTINCT
TO_CHAR (batch_create_dt, 'YYYY') year_val
FROM stores_comm_mob_sub_temp
ORDER BY 1)
ORDER BY year_val)
LOOP
lv_partition_name :=
scmsa_handset_mobility_data_build.fn_get_partition_name (
p_table_name => 'STORES_COMM_MOB_SUB_INFO',
p_search_string => m1.year_val);
FOR m2
IN (SELECT DISTINCT
'M' || TO_CHAR (batch_create_dt, 'MM') AS month_val
FROM stores_comm_mob_sub_temp
WHERE TO_CHAR (batch_create_dt, 'YYYY') = m1.orig_year_val)
LOOP
lv_subpartition_name :=
scmsa_handset_mobility_data_build.fn_get_subpartition_name (
p_table_name => 'STORES_COMM_MOB_SUB_INFO',
p_partition_name => lv_partition_name,
p_search_string => m2.month_val);
DBMS_OUTPUT.PUT_LINE('The lv_subpartition_name => '||lv_subpartition_name||' and lv_partition_name=> '||lv_partition_name);
IF lv_subpartition_name IS NULL
THEN
DBMS_OUTPUT.PUT_LINE('INSIDE IF => '||m2.month_val);
INSERT INTO STORES_COMM_MOB_SUB_INFO T1 (
t1.ntlogin,
t1.first_name,
t1.last_name,
t1.job_title,
t1.store_id,
t1.batch_create_dt)
SELECT t2.ntlogin,
t2.first_name,
t2.last_name,
t2.job_title,
t2.store_id,
t2.batch_create_dt
FROM stores_comm_mob_sub_temp t2
WHERE TO_CHAR (batch_create_dt, 'YYYY') = m1.orig_year_val
AND 'M' || TO_CHAR (batch_create_dt, 'MM') =
m2.month_val;
ELSIF lv_subpartition_name IS NOT NULL
THEN
DBMS_OUTPUT.PUT_LINE('INSIDE ELSIF => '||m2.month_val);
MERGE INTO (SELECT *
FROM stores_comm_mob_sub_info
SUBPARTITION (lv_subpartition_name)) T1 --> Issue Here
USING (SELECT *
FROM stores_comm_mob_sub_temp
WHERE TO_CHAR (batch_create_dt, 'YYYY') =
m1.orig_year_val
AND 'M' || TO_CHAR (batch_create_dt, 'MM') =
m2.month_val) T2
ON (T1.store_id = T2.store_id
AND T1.ntlogin = T2.ntlogin)
WHEN MATCHED
THEN
UPDATE SET
t1.postpaid_totalqty =
(NVL (t1.postpaid_totalqty, 0)
+ NVL (t2.postpaid_totalqty, 0)),
t1.sales_transaction_dt =
GREATEST (
NVL (t1.sales_transaction_dt,
t2.sales_transaction_dt),
NVL (t2.sales_transaction_dt,
t1.sales_transaction_dt)),
t1.batch_create_dt =
GREATEST (
NVL (t1.batch_create_dt, t2.batch_create_dt),
NVL (t2.batch_create_dt, t1.batch_create_dt))
WHEN NOT MATCHED
THEN
INSERT (t1.ntlogin,
t1.first_name,
t1.last_name,
t1.job_title,
t1.store_id,
t1.batch_create_dt)
VALUES (t2.ntlogin,
t2.first_name,
t2.last_name,
t2.job_title,
t2.store_id,
t2.batch_create_dt);
END IF;
END LOOP;
END LOOP;
COMMIT;
end;
Much appreciate your inputs here.
Thanks,
MK.
(SORRY TO POST THE SAME QUESTION TWICE).
Edited by: Maddy on May 23, 2013 10:20 PMDuplicate question
-
Issue in using presentation variable as filter condition in the reports
Hi,
I have an issue in using presentation variable as filter condition in my reports the details are as follows:
Details :
We want to implement the Max and Min variables through Presentation variables only.we do not want to implement it through session variables in this case.
We have two variables MIN and MAX to be used as Presentation Variables,for a column of the report (which is a quantity),so that the user wants to see the data for this column within a particular range.i.e the Min and the Max.This part has been implemented well . The issue is when the user wants to see the full data.In that case we will not pass any values to these two Presentation Variable or in other words we are not restricting the report data so we are not passing any value to the variables,this is when the report is throwing the error. we want to leave this variables blank in that case.but this is giving error.
Please suggest how can I overcome this issue.
Thanks in Advance.
Regards,
Praveeni think you have to use guided navigation for this. create two reports first is the one you are having currently and second is the one in which remove the presentation variable from the column formula. i.e. the same report with no aggregation applied.
Now create a dummy report and make it return value only when the presentation variable value is not equal to max or min. guide the report to navigate between the first and second report based on the result of the dummy report. -
Any issues with using LDAP on LINUX for GRC 5.2 UME?
Our company is converting our LDAP servers from AIX to LINUX. The DNS name used in our UME connection should not change. Are there any issues with using LDAP on LINUX? We are currently on GRC 5.2 SP9 (in the middle of upgrading to SP12).
Also, I have been trying to connect our test UME system to a test LDAP box that has already been converted to LINUX but keep getting a 'connection failed' error when I try to test it.
Do you have to reboot the server to test changing the LDAP connections? I've been trying it by going into UME, pulling up the LDAP tab, hitting the Modify button, entering the new userid and password for test LDAP, and hitting the Test Connection button. I've verified that this userid and password is correct for test LDAP.
Is there a way to get more information about why the connection failed?
Thanks.I've been told by our LDAP Support group that none of the other configuration settings should have to be changed. I should only have to change the id and password to connect to a test version of LDAP instead of our regular connection to the production LDAP.
Can you test a connection for a different userid/password without having to reboot/restart the server? Do I need to change these two settings, save then, reboot/restart, and then do the Test Connection button?
Thanks. -
Issues with using relative links in Captivate 8
Is anyone else having issues with using relative links in Captivate 8? These links all used to work in the previous version of Captivate. And I could have sworn this was fixed already once in Captivate 8 but it's popping up again for us. Here is the situation... We have courses that are made up of multiple lessons which as separate Captivate files. Within those lessons are buttons to link to external documents (which live in a shared document folder), demonstrations, etc. We use relative links because we post these to our amazon servers and we also sell them to clients where they can post them on their own web servers or in their LMS. SO we can't put in full paths for the links or we'd have to change them constantly. So an example is that the link for a button might be "../Document/nameofdoc.pdf" This would be going to a user guide or something that is posted in the "Document" folder that lives at the same level as the lesson's folder. But now, all of the sudden, none of our bazillion links is working. And I've tried buttons, hyperlinks, and even the old click box. Nothing works with relative links. And I did check the permissions on every file and folder on our Amazon server to verify nothing changed there as well. Any suggestions?
I have the same issue with relative links using Captivate 8. I am trying to load Captivate modules into an LMS using relative links to document files within the LMS. The links work fine during a site page test so not an issue in the LMS, but from the Captivate module they aren't working....
Help? -
Issues with using the output redirection character with newer NXOS versions?
Has anyone seen any issues with using the output redirection character with newer NXOS versions?
Am receiving "Error 0x40870004 while copying."
Simply copying a file from bootflash to tftp is ok.
This occurs for both 3CDaemon and Tftpd32 softwares.
Have tried it on multiple switches - same issue.
Any known bugs?
thanks!
The following is an example of bad (NXOS4.1.1b) and good (SANOS3.2.1a)
MDS2# sho ver | inc system
system: version 4.1(1b)
system image file is: bootflash:///m9200-s2ek9-mz.4.1.1b.bin
system compile time: 10/7/2008 13:00:00 [10/11/2008 09:52:55]
MDS2# sh int br > tftp://10.73.54.194
Trying to connect to tftp server......
Connection to server Established. Copying Started.....
TFTP put operation failed:Access violation
Error 0x40870004 while copying tftp://10.73.54.194/
MDS2# copy bootflash:cpu_logfile tftp://10.73.54.194
Trying to connect to tftp server......
Connection to server Established. Copying Started.....
|
TFTP put operation was successful
MDS2#
ck-ci9216-001# sho ver | inc system
system: version 3.2(1a)
system image file is: bootflash:/m9200-ek9-mz.3.2.1a.bin
system compile time: 9/25/2007 18:00:00 [10/06/2007 06:46:51]
ck-ci9216-001# sh int br > tftp://10.73.54.194
Trying to connect to tftp server......
|
TFTP put operation was successfulPlease check with new version of TFTPD 32 server. The error may be due to older version of TFPT server, the new version available solved this error. Files are getting uploaded with no issues.
1. Download tftpd32b.zip from:
http://tftpd32.jounin.net/tftpd32_download.html
2. Copy the tftpd32b.zip file into an empty directory and extract it.
3. Copy the file you want to transver into the directory containing tftpd32.exe.
4. Run tftpd32.exe from that directory. The "Base Directory" field should show the path to the directory containing the file you want to transfer.
At this point, the tftpserver is ready to begin serving files. As devices request files, the main tftpd32 window will log the requests.
Best Regards... -
Issue with use of Function Module GUI_UPLOAD
Hi Experts,
I have an issue in using the Function Module GUI_UPLOAD for uploading the contents of an Excel file on the Presentation Server to an internal table in an ABAP Program.
My file consists of around 300 records but the FM succeeds in uploading only the first 6 lines to the Internal Table specified while calling the FM.
I dont have any idea why this happens. Any pointers in this direction will be helpful.
Thanks in advance.
Regards,
KeerthiHi,
Kindly go through this link below:
https://wiki.sdn.sap.com/wiki/pages/viewpage.action?pageId=60655105
Hope it helps you
Regards
Mansi
Maybe you are looking for
-
How to find list of internal tables while debugging
Hi Experts, I am debugging a block of an ABAP program( User Exit ). Is there any facility to see what are the internal tables, work areas are available for that particular block? Can I see it new debugger? Because I don't know from which internal t
-
Hi All, I have a perplexing problem with creating some links. I created a button using the shapes tools, I use the command/shift/4 to capture the image I created, I go to photoshop, edit it, then save it as a jpeg, put it into my site, make it a link
-
see previous ??, somehow moved files for iphoto and it now appears empty. hoping to recover, have not backup in awhile... is there not a way to restore computer to past date, say last week?
-
I seem to have lost the ability to view a grid in Photoshop. It appears as <grid> in the list. What should I do to rectify this? Thanks.
-
JNLP jar (re)download
Hello All , I might be having a fundamental misconception here ; if so , please help me put it right. I have a JNLP file which is automatically generated (automatic here actually indicates that a script will populate a particular field in the file (w