Program with 2 dynamic i_tabs (cl_alv_table_create= create_dynamic_table)
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 thanks
Hi,
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?
Similar Messages
-
Dump in include LSKBHF06 of SAPLSKBH program while creating dynamic internal table.
Hello Guys,
We are facing a issue and expecting a support to resolve it.
Brief Info about the issue:
We have developed a code which downloads some specific information from database tables from client's system in excel file.
For that we have used below mentioned method to create the dynamic table.
cl_alv_table_create=>create_dynamic_table.
Now this code is successfully executing in our system and giving us the required output. But when client is running this code in their system they are getting a dump.
Dump Details:
Runtime Errors LOAD_PROGRAM_NOT_FOUND
Exception CX_SY_PROGRAM_NOT_FOUND
Occurred on 12.03.2014 at 11:01:51
Program " " not found.
What happened?
There are several possible reasons for the error:
or
The current ABAP program had to be terminated because the
ABAP processor detected an internal system error.
The current ABAP program "SAPLSKBH" had to be terminated because the ABAP
processor discovered an invalid system state.
Print out the error message (using the "Print" function)
and make a note of the actions and input that caused the
error.
To resolve the problem, contact your SAP system administrator.
You can use transaction ST22 (ABAP Dump Analysis) to view and administer
termination messages, especially those beyond their normal deletion
date.
Error analysis
An exception occurred. This exception is dealt with in more detail below
. The exception, which is assigned to the class 'CX_SY_PROGRAM_NOT_FOUND', was
neither
caught nor passed along using a RAISING clause, in the procedure
"FB_TABLE_CREATE_STRING" "(FORM)"
Since the caller of the procedure could not have expected this exception
to occur, the running program was terminated.
The reason for the exception is:
On account of a branch in the program
(CALL FUNCTION/DIALOG, external PERFORM, SUBMIT)
or a transaction call, another ABAP/4 program
is to be loaded, namely " ".
However, program " " does not exist in the library.
System environment
SAP Release.............. "620"
Application server....... "gs-sh110"
Network address.......... "10.2.95.17"
Operating system......... "Linux"
Release.................. "2.6.16.60-0.39.3-smp"
Hardware type............ "x86_64"
Character length......... 16 Bits
Pointer length........... 64 Bits
Work process number...... 1
Short dump setting....... "full"
Database server.......... "gs-sh110"
Database type............ "ORACLE"
Database name............ "H15"
Database owner........... "SAPORA"
As per the dump we have tried to find the root cause of the issue and found in debug mode that in 'SAPLSKBH' program in SE38 in include 'INCLUDE LSKBHF06' program name SAPLSKBH is converted in some random generated program by sap ex. '%_T008F0' which is passed in the perform 'TABLE_CREATE' of the program generated dynamically.
If this program name does not exists in the system then system will generate the dump
Program " " not found as show in the dump received.
Please find the short dump attached.
Please help to solve the issue.
Regards.
Abhinav Goel.Hi Abhinav,
I tried it myself in our system in debug mode. If SY_REPID is empty, l_name is set to %_T0000L (in our system) by GENERATE SUBROUTINE POOL and code line
perform (l_form) in program (l_name).
is a
perform TABLE_CREATE in program %_T0000L.
This works fine.
But in your dump field l_name is still empty. This shouldn't be after a successfully processed GENERATE SUBROUTINE POOL.
But SY-SUBRC seems to be 0 and l_message seems to be empty.
In Your client's system, please try to check it
- on a DEV system with open system settings (system client should allow changes)
- with an user, who has developer's authorities and a registered developer key in table DEVACCESS
Please tell us, if the issue remains after that.
Regards,
Klaus -
Submitting a dynamic program with layout name
Hi,
I searched many blogs and the SDN forum but couldn't find a solution.
I need to know the layout fields of an ALV report for a later usage. Let me explain it with code:
I used below code to extract data of a dynamic program.
cl_salv_bs_runtime_info=>set(
EXPORTING display = abap_false
metadata = abap_true
data = abap_true ).
Submit (program) USING SELECTION-SET variant EXPORTING LIST TO MEMORY
AND RETURN.
TRY.
cl_salv_bs_runtime_info=>get_data_ref(
IMPORTING r_data = lf_ref ).
ASSIGN lf_ref->* TO <lt_data>.
CATCH cx_salv_bs_sc_runtime_info.
MESSAGE `Unable to retrieve ALV data` TYPE 'E'.
ENDTRY.
cl_salv_bs_runtime_info=>clear_all( ).
CREATE DATA lf_ref1 LIKE LINE OF <lt_data>.
ASSIGN lf_ref1->* TO <lt_line>.
What I need is to submit program with a (known) layout. If it is not possible, how can i modify the ALV report to fit a layout's display properties. (If I can manage to get -dynamic program- layout's visible fields, it will work too.)
Thank you.Hi ,
Check this LINK you can take help from this
create dynamic varient and pass to Submit program .
[how to create a variant dynamically and get it?;
OR :
you can use function module to get layout names and reprot
ranges: lr_report for ltdx-report,
lr_handle for ltdx-handle,
lr_log_group for ltdx-log_group,
lr_username for ltdx-username,
lr_variant for ltdx-variant,
lr_type for ltdx-type.
call function 'LT_VARIANTS_READ_FROM_LTDX'
exporting
i_tool = r_tool
i_text = r_text
tables
et_variants = rt_variants
it_ra_report = lr_report
it_ra_handle = lr_handle
it_ra_log_group = lr_log_group
it_ra_username = lr_username
it_ra_variant = lr_variant
it_ra_type = lr_type
exceptions
not_found = 1
others = 2.
regards
Deepak.
Edited by: Deepak Dhamat on Jan 23, 2012 8:18 AM -
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 -
Hi gurus i have a problem i have created a dinamic internal table but the lenght of the internal table fields is 10 i need longer fields
here is my code thanks
data: begin of it_campos OCCURS 0,
campo1(12) type c,
END OF it_campos.
do n times.
clear nocamptmp.
add 1 to incont.
CONDENSE incont NO-GAPS.
cont = incont.
CONCATENATE nocamp cont into nocamptmp.
wa_campos-campo1 = nocamptmp.
append wa_campos to it_campos.
enddo .
loop at it_campos into wa_campos.
t_fieldcat_wa-col_pos = SY-TABIX.
t_fieldcat_wa-fieldname = wa_campos-campo1.
APPEND t_fieldcat_wa TO t_fieldcat.
endloop .
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
it_fieldcatalog = t_fieldcat
IMPORTING
ep_table = tabla
EXCEPTIONS
GENERATE_SUBPOOL_DIR_FULL = 1
others = 2.
ASSIGN tabla->* TO <l_table>.
CREATE DATA ep_line LIKE LINE OF <l_table>.
all is fine but the fields of <l_table> are char(10) and my data is longer than 10 how can i increase the lenght of the table fields
any idea thanksModify the fieldcatalog accordingly for e.g.,
LOOP AT it_campos INTO wa_campos.
t_fieldcat_wa-col_pos = sy-tabix.
t_fieldcat_wa-fieldname = wa_campos-campo1.
t_fieldcat_wa-inttype = 'C'. " Character Type
t_fieldcat_wa-intlen = '50'. "50 character length
APPEND t_fieldcat_wa TO t_fieldcat.
ENDLOOP .
BR,
Suhas -
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. -
Cl_alv_table_create= create_dynamic_table in ALV Grid
Hallo everybody
i have created a dynamic_table with cl_alv_table_create class. Now i want this dynamic_table integration in my ALV Grid. I try this, but without successfull
Can anybody help?
PROGRAM zliefervolu.
* Definition *
TABLES: likp, "Vertriebsbeleg: Lieferung: Kopfdaten
lips, "Vertriebsbeleg: Lieferung: Positionsdaten
kna1, "Kundenstamm (allgemeiner Teil)
marm. "Mengeneinheiten zum Material
FIELD-SYMBOLS: <fs_data> TYPE REF TO data,
<fs_1> TYPE ANY TABLE,
<fs_2>,
<fs_3>.
DATA: BEGIN OF i_vbeln OCCURS 1,
faktor(5) TYPE n,
END OF i_vbeln.
DATA: BEGIN OF v_lief OCCURS 1,
faktor TYPE string,
END OF v_lief.
DATA: BEGIN OF lieferschein OCCURS 1,
vbeln TYPE vbeln,
END OF lieferschein.
DATA: ok_code LIKE sy-ucomm, "Bildschirmbilder, Funktionscode, der PAI ausgelöst hat
v_volurech(10) TYPE n, "Volumenberechnung
volutot TYPE string,
v_debit TYPE kunnr,
v_lifg TYPE vrkme,
v_datumkl TYPE wadat,
v_datumgr TYPE wadat,
v_faktor(5) TYPE n,
v_faktors TYPE string,
v_datum TYPE string,
v_count TYPE i,
lt_fieldcatalog TYPE lvc_t_fcat,
ls_fieldcatalog TYPE lvc_s_fcat,
new_table TYPE REF TO data,
new_line TYPE REF TO data,
lt_data TYPE REF TO data,
v_datumlow(10) TYPE c,
v_datumhigh(10) TYPE c,
v_text TYPE string,
name_catolog TYPE lvc_t_fcat, "Ändern von Spaltenname
l_field LIKE LINE OF name_catolog, "Kurzspeicher für Spaltenname
g_container TYPE scrfname VALUE 'BCALV_GRID_CONTROL',
grid1 TYPE REF TO cl_gui_alv_grid, "ALV Grid Definition
creattable TYPE REF TO cl_alv_table_create,
g_custom_container TYPE REF TO cl_gui_custom_container.
DATA: i_tabledata TYPE TABLE OF zvolutable.
SELECT-OPTIONS: s_kunnr FOR likp-kunnr, "Lieferung
s_wadat FOR likp-wadat OBLIGATORY, "Geplantes Datum der Warenbewegung
s_vbeln FOR likp-vbeln. "Warenempfänger
* Main Program *
START-OF-SELECTION.
CLEAR: likp.
* Selektion Vertriebsbeleg: Lieferung: Kopfdaten
SELECT * FROM likp WHERE vbeln IN s_vbeln
AND wadat IN s_wadat
AND kunnr IN s_kunnr
ORDER BY vbeln.
* CLEAR: kna1.
** Selektion Kundenstamm (allgemeiner Teil)
* SELECT SINGLE * FROM kna1 WHERE kunnr EQ likp-kunnr.
* CONCATENATE likp-kunnr ` ` kna1-name1 INTO i_datatable-kunnr.
* CLEAR: lips.
* Selektion Vertriebsbeleg: Lieferung: Positionsdaten
SELECT * FROM lips WHERE vbeln EQ likp-vbeln.
CLEAR: marm.
* Selektion Mengeneinheiten zum Material
SELECT SINGLE * FROM marm WHERE matnr EQ lips-matnr
AND meinh EQ lips-vrkme.
CLEAR v_volurech.
v_volurech = lips-lfimg * marm-hoehe.
* Volumentotal
volutot = volutot + v_volurech.
MOVE lips-umvkz TO i_vbeln-faktor.
APPEND i_vbeln.
ENDSELECT.
MOVE likp-vbeln TO lieferschein-vbeln.
APPEND lieferschein.
ENDSELECT.
CLEAR: i_vbeln, lieferschein.
SORT i_vbeln BY faktor.
* Datumsfeld *
MOVE s_wadat-low TO v_datumkl.
v_datumlow = v_datumkl+6.
WRITE '.' TO v_datumlow+2.
WRITE v_datumkl+4(2) TO v_datumlow+3.
WRITE '.' TO v_datumlow+5.
WRITE v_datumkl(4) TO v_datumlow+6.
LOOP AT s_wadat WHERE high IS NOT INITIAL.
MOVE s_wadat-high TO v_datumgr.
ENDLOOP.
v_datumhigh = v_datumgr+6.
WRITE '.' TO v_datumhigh+2.
WRITE v_datumgr+4(2) TO v_datumhigh+3.
WRITE '.' TO v_datumhigh+5.
WRITE v_datumgr(4) TO v_datumhigh+6.
IF v_datumgr IS NOT INITIAL.
CONCATENATE v_datumlow '-' v_datumhigh INTO v_datum.
ELSE.
MOVE v_datumlow TO v_datum.
ENDIF.
CLEAR v_text.
v_text = 'DATUM'.
MOVE v_text TO v_lief-faktor.
APPEND v_lief.
* Faktorfelder *
CLEAR: v_count.
LOOP AT i_vbeln.
IF i_vbeln-faktor NE v_faktor.
MOVE i_vbeln-faktor TO v_faktor.
PACK i_vbeln-faktor TO v_faktors.
CONDENSE v_faktors.
MOVE v_faktors TO v_lief-faktor.
v_count = v_count + 1.
APPEND v_lief.
ENDIF.
ENDLOOP.
CLEAR v_text.
v_text = 'VOLUMEN'.
MOVE v_text TO v_lief-faktor.
APPEND v_lief.
CLEAR: v_lief.
* Erstellen von Dym. Struktur *
LOOP AT v_lief.
ls_fieldcatalog-fieldname = v_lief-faktor.
APPEND ls_fieldcatalog TO lt_fieldcatalog.
ENDLOOP.
ASSIGN lt_data TO <fs_data>.
IF v_count NE 0.
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
it_fieldcatalog = lt_fieldcatalog
IMPORTING
ep_table = <fs_data>
EXCEPTIONS
generate_subpool_dir_full = 1
OTHERS = 2.
* CALL METHOD cl_alv_table_create=>table_copy
* EXPORTING
* it_outtab = i_tabledata
* it_fieldcatalog = lt_fieldcatalog
* IMPORTING
* ep_table = <fs_data>.
IF sy-subrc <> 0.
ENDIF.
ASSIGN <fs_data>->* TO <fs_1>.
CREATE DATA new_line LIKE LINE OF <fs_1>.
ASSIGN new_line->* TO <fs_2>.
ELSE.
CALL FUNCTION 'POPUP_TO_DISPLAY_TEXT_LO'
EXPORTING
titel = text-tit
textline1 = text-feh
start_column = 15 "Abstand von Links
start_row = 6. "Abstand von Oben
ENDIF.
CALL SCREEN 100.
END-OF-SELECTION.
* MODULE PBO OUTPUT *
MODULE pbo OUTPUT.
SET PF-STATUS 'MAIN100'.
*** Definition von Feldkatalog
* l_field-fieldname = 'DEBITOR'.
* l_field-coltext = v_datum4.
* APPEND l_field TO name_catolog.
IF g_custom_container IS INITIAL.
CREATE OBJECT g_custom_container
EXPORTING container_name = g_container.
CREATE OBJECT grid1
EXPORTING i_parent = g_custom_container.
* ALV Methode aufruf für Ausgabe
CALL METHOD grid1->set_table_for_first_display
* EXPORTING
* i_structure_name = 'lvc_t_fcat'
CHANGING
it_outtab = <fs_1>
it_fieldcatalog = lt_fieldcatalog.
ENDIF.
ENDMODULE. "PBO OUTPUT
* MODULE PAI INPUT *
MODULE pai INPUT.
* to react on oi_custom_events:
CALL METHOD cl_gui_cfw=>dispatch.
CASE ok_code.
WHEN 'EXIT'.
PERFORM exit_program.
WHEN OTHERS.
* do nothing
ENDCASE.
CLEAR ok_code.
ENDMODULE. "PAI INPUT
* FORM EXIT_PROGRAM *
FORM exit_program.
* CALL METHOD G_CUSTOM_CONTAINER->FREE.
* CALL METHOD CL_GUI_CFW=>FLUSH.
LEAVE PROGRAM.
ENDFORM. "EXIT_PROGRAM
thx & regards paulHi,
Herewith i am sending the sample report for the dynamic report. Kindly go through it.
REPORT YMS_DYNAMICDEMO
NO STANDARD PAGE HEADING
MESSAGE-ID zcs_c2c_001.
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.
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-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.
form write_out.
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.
endform.
Thanks,
Shankar -
Creating Dynamic Internal table with a dynamic name
Hi,
I want to create dynamic internal tables with dynamic names.
For example:
Suppose I have a table with three fields.
1. Structure name
2.Fields
3.file
And the structure of the internal table is as follows:
TYPES:BEGIN OF table_type,
struct TYPE char70,
fields TYPE tt_type OCCURS 0,
File TYPE ttab_type OCCURS 0,
END OF table_type.
Suppose I have one record inside my internal table with struct as "STRUCTURE", fields have an internal table content of set of fields and File has some set of records.
Now I want to create dynamic internal table whose name will be "STRUCTURE" , the fields of the dynamic internal table structure[] will be as in fields, and the records will be as in File.
Like this if i have 100 records in my internal table then I have to create 100 dynamic internal table dynamically.
Can anyone suggest how to do this?
Edited by: Jjammy on Jul 22, 2009 7:52 AMHi,
Check the sample program and develop your program accordingly.
<font color=blue><pre>
REPORT ztest_notepad.
*& Declarations
*Type-pools
TYPE-POOLS:
slis.
*Types
TYPES:
ty_fcat TYPE lvc_s_fcat,
ty_fcatalog TYPE slis_fieldcat_alv.
*Work areas
DATA:
wa_fcat TYPE ty_fcat,
wa_fcatalog TYPE ty_fcatalog.
*Internal tables
DATA:
it_fcat TYPE STANDARD TABLE OF ty_fcat,
it_fcatalog TYPE STANDARD TABLE OF ty_fcatalog.
*Type reference
DATA:
it_dyn_tab TYPE REF TO data,
wa_newline TYPE REF TO data.
*Filed symbols
FIELD-SYMBOLS:
<gt_table> TYPE STANDARD TABLE,
<fs_dyntable>,
<fs_fldval> TYPE ANY,
<l_field> TYPE ANY.
*Variables
DATA:
l_fieldname TYPE lvc_s_fcat-fieldname,
l_tabname TYPE lvc_s_fcat-tabname,
l_fieldtext TYPE lvc_s_fcat-seltext,
l_index TYPE char2.
"Selection-screen
PARAMETERS:
p_colms TYPE i.
*& start-of-selection.
START-OF-SELECTION.
PERFORM build_fieldcat.
PERFORM create_dynamic_table.
DO 20 TIMES.
DO p_colms TIMES.
l_index = sy-index.
CONCATENATE 'FIELD' l_index INTO l_fieldname.
ASSIGN COMPONENT l_fieldname OF STRUCTURE <fs_dyntable> TO <l_field>.
<l_field> = sy-index.
ENDDO.
INSERT <fs_dyntable> INTO TABLE <gt_table>.
ENDDO.
LOOP AT it_fcat INTO wa_fcat.
PERFORM fieldcatalog1 USING: wa_fcat-fieldname
wa_fcat-tabname
wa_fcat-seltext.
ENDLOOP.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
i_callback_program = 'ZTEST_NOTEPAD'
it_fieldcat = it_fcatalog
TABLES
t_outtab = <gt_table>.
*& Form BUILD_FIELDCAT
FORM build_fieldcat .
CLEAR: l_fieldname,
l_tabname,
l_fieldtext,
l_index.
DO p_colms TIMES.
CLEAR l_index.
l_index = sy-index.
CONCATENATE 'FIELD' l_index INTO l_fieldname.
CONCATENATE 'Field' l_index INTO l_fieldtext.
l_tabname = '<GT_TABLE>'.
PERFORM fieldcatalog USING: l_fieldname
l_tabname
l_fieldtext.
ENDDO.
ENDFORM. " BUILD_FIELDCAT
*& Form CREATE_DYNAMIC_TABLE
FORM create_dynamic_table .
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
it_fieldcatalog = it_fcat
IMPORTING
ep_table = it_dyn_tab.
ASSIGN it_dyn_tab->* TO <gt_table>.
Create dynamic work area and assign to FS
CREATE DATA wa_newline LIKE LINE OF <gt_table>.
ASSIGN wa_newline->* TO <fs_dyntable>.
ENDFORM. " CREATE_DYNAMIC_TABLE
*& Form FIELDCATALOG
FORM fieldcatalog USING field table f_txt.
wa_fcat-fieldname = field.
wa_fcat-tabname = table.
wa_fcat-seltext = f_txt.
APPEND wa_fcat TO it_fcat.
CLEAR wa_fcat.
ENDFORM. " FIELDCATALOG
*& Form FIELDCATALOG1
FORM fieldcatalog1 USING field table f_txt.
wa_fcatalog-fieldname = field.
wa_fcatalog-tabname = table.
wa_fcatalog-seltext_m = f_txt.
APPEND wa_fcatalog TO it_fcatalog.
CLEAR wa_fcatalog.
ENDFORM. " FIELDCATALOG1 </pre>
</font>
Thanks
Venkat.O -
Cl_alv_table_create= create_dynamic_table error
Hi Gurus,
Method cl_alv_table_create=>create_dynamic_table
is giving dump.When i am trying to create internal table from fieldcatalog values.Program" "not found.
Please suggest some solution.
Good answers will be rewarded with points.
Thanks,
TwinkleCheck this program as reference .
report zrich_0002.
type-pools: slis.
field-symbols: <dyn_table> type standard table,
<dyn_wa>,
<dyn_field>.
data: alv_fldcat type slis_t_fieldcat_alv,
it_fldcat type lvc_t_fcat.
type-pools : abap.
data : it_details type abap_compdescr_tab,
wa_details type abap_compdescr.
data : ref_descr type ref to cl_abap_structdescr.
data: new_table type ref to data,
new_line type ref to data,
wa_it_fldcat type lvc_s_fcat.
selection-screen begin of block b1 with frame title text .
parameters: p_table(30) type c.
selection-screen end of block b1.
* Get the structure of the table.
ref_descr ?= cl_abap_typedescr=>describe_by_name( p_table ).
it_details[] = ref_descr->components[].
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.
* 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>.
* Select Data from table.
select * into corresponding fields of table <dyn_table>
from (p_table).
* 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.
Regards,
Rich Heilman -
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>. -
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 -
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 -
Table with bith dynamic and non dynamic data
Hi all,
We have a report already developed. Now we need add some fields from some table which is dynamic in feature to the final report which is already there.
I need to know how come we can include the dynamic fields into the final internal table.
I tried declaring fieldsymbols inside the data stmt of the final internal table but it shows some syntax error.
Please help me.
ThanksCheck this sample code..
REPORT ztest_dynamic_code.
DATA: BEGIN OF it_tab OCCURS 0,
abc(3),
xyz(3),
pqr(3),
item,
END OF it_tab.
DATA: it_fieldcatalog TYPE lvc_t_fcat,
wa_fieldcat TYPE lvc_s_fcat.
DATA: i_dyntab TYPE REF TO data. " To create dyn.Itab
DATA:
w_dref TYPE REF TO data,
ind(2) TYPE n,
w_data TYPE REF TO data,
w_text(5),
w_grid TYPE REF TO cl_gui_alv_grid.
DATA: grid TYPE REF TO cl_gui_alv_grid,
cont TYPE REF TO cl_gui_custom_container.
FIELD-SYMBOLS: <t_itab> TYPE STANDARD TABLE,
<fs_wa> TYPE ANY,<fs> TYPE ANY.
DATA: in TYPE i.
*Data population
it_tab-abc = 'ABC'.
it_tab-xyz = 'XYZ'.
it_tab-pqr = 'PQR'.
DO 9 TIMES.
in = in + 1.
it_tab-item = in.
APPEND it_tab.
ENDDO.
*Field cat population.
wa_fieldcat-fieldname = 'ABC'.
wa_fieldcat-outputlen = 3.
wa_fieldcat-coltext = 'abc'.
APPEND wa_fieldcat TO it_fieldcatalog.
wa_fieldcat-fieldname = 'XYZ'.
wa_fieldcat-outputlen = 3.
wa_fieldcat-coltext = 'XYZ'.
APPEND wa_fieldcat TO it_fieldcatalog.
wa_fieldcat-fieldname = 'PQR'.
wa_fieldcat-outputlen = 3.
wa_fieldcat-coltext = 'pqr'.
APPEND wa_fieldcat TO it_fieldcatalog.
wa_fieldcat-fieldname = 'COLOR'.
wa_fieldcat-outputlen = 4.
wa_fieldcat-coltext = 'col'.
APPEND wa_fieldcat TO it_fieldcatalog.
ind = 1.
DO 9 TIMES.
CONCATENATE 'ITEM' ind INTO wa_fieldcat-fieldname.
CONCATENATE 'ITEM' ind INTO wa_fieldcat-coltext.
wa_fieldcat-outputlen = 1.
APPEND wa_fieldcat TO it_fieldcatalog.
CLEAR wa_fieldcat .
ind = ind + 1.
ENDDO.
*-Dynamic Table creation
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
it_fieldcatalog = it_fieldcatalog
IMPORTING
ep_table = i_dyntab.
ASSIGN i_dyntab->* TO <t_itab>.
CREATE DATA w_data LIKE LINE OF <t_itab>.
ASSIGN w_data->* TO <fs_wa>.
SORT it_tab BY abc xyz pqr.
CLEAR ind.
ind = 4.
*-Final Internal table as per Requirement
do 10 times.
LOOP AT it_tab.
ASSIGN COMPONENT 1 OF STRUCTURE <fs_wa> TO <fs>.
<fs> = it_tab-abc.
ASSIGN COMPONENT 2 OF STRUCTURE <fs_wa> TO <fs>.
<fs> = it_tab-xyz.
UNASSIGN <fs>.
ASSIGN COMPONENT 3 OF STRUCTURE <fs_wa> TO <fs>.
<fs> = it_tab-pqr.
UNASSIGN <fs>.
ASSIGN COMPONENT 4 OF STRUCTURE <fs_wa> TO <fs>.
*-You can assign the color conditionally also..
if sy-index = 4.
<fs> = 'C400'.
else.
<fs> = 'C600'.
endif.
UNASSIGN <fs>.
ASSIGN COMPONENT ind OF STRUCTURE <fs_wa> TO <fs>.
<fs> = it_tab-item.
UNASSIGN <fs>.
ind = ind + 1.
AT END OF pqr.
APPEND <fs_wa> TO <t_itab>.
* <fs_wa>-color = 'C600'.
ind = 4.
CLEAR <fs_wa>.
ENDAT.
ENDLOOP.
enddo.
*-Display
CALL SCREEN 100.
*& Module STATUS_0100 OUTPUT
* text
MODULE status_0100 OUTPUT.
DATA: layout TYPE lvc_s_layo.
CREATE OBJECT cont
EXPORTING
container_name = 'CONT'
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5
OTHERS = 6
IF sy-subrc NE 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
CREATE OBJECT grid
EXPORTING
i_parent = cont
EXCEPTIONS
error_cntl_create = 1
error_cntl_init = 2
error_cntl_link = 3
error_dp_create = 4
OTHERS = 5
IF sy-subrc NE 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
layout-INFO_FNAME = 'COLOR'.
grid->set_table_for_first_display(
EXPORTING
is_layout = layout
CHANGING
it_outtab = <t_itab>
it_fieldcatalog = it_fieldcatalog
EXCEPTIONS
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
IF sy-subrc NE 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDMODULE. " STATUS_0100 OUTPUT -
Cl_alv_table_create= create_dynamic_table is dumping
Dear Xperts,
cl_alv_table_create=>create_dynamic_table is dumping with message "LOAD_PROGRAM_NOT_FOUND"
Pls Help:
Thanks
RajMy Code:
DATA: T_DATA TYPE REF TO DATA,
T_FIELDCAT TYPE LVC_T_FCAT,
T_HEADER TYPE SLIS_T_LISTHEADER,
T_SORT TYPE SLIS_T_SORTINFO_ALV.
Field Symbols
FIELD-SYMBOLS : <FS_DATA> TYPE STANDARD TABLE," REF TO DATA,
<FS_BATCH> TYPE STANDARD TABLE,
<FS_FREE> TYPE STANDARD TABLE,
<FS_STOR> TYPE STANDARD TABLE,
<FS_WA_FREE>,
<FS_WA_STOR>,
<FS_WA_BATCH>,
<FS_VAR>,
<FS_VAL> TYPE KONP-KBETR .
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>. -
Search Help doesn't work with a dynamically created internal table
Hi Gurus,
I have a custom report that will display the output through edittable ALV.
My issue is, even though I've already did the FOREIGN KEY assisgnment to each fields of my custom table,
when I run my report,some fields F$ functionality aint working.
In my report, I've declared the table to be passed to ALV display dynamically as below:
*_Create dynamic internal tables for the Final INTERNAL TABLE
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
it_fieldcatalog = gt_fldcatfin
IMPORTING
ep_table = gp_fintab
EXCEPTIONS
generate_subpool_dir_full = 1
OTHERS = 2.
ASSIGN gp_fintab->* TO <i_xfintab>.
Where gt_fldcatfin is a modified fieldcatalog (combination of the cutom table fields and 1 column for CELLCOLOR)
Please help me with this. Thanks a lot.This is one way.
Import photo into illustrator.
Draw box around photo, no fill ,no stroke colour and place on top of photo.
Menu - Object - Envelope Distort - Make with Warp - (warp option will appear)
Use ‘Direct Selection Tool’ (white arrow)
Select/click on anchor points to alter, you can also use the rotation tool to turn to required position.
Hope this info' is of help.
Maybe you are looking for
-
Fax won't take one page at a time
I have an HP Officejet L7580 all in on when I try tfax the machine take 2 papers at a time or may be more. How do I fix it so it will take one sheet at atime?
-
Weight and volume calculation in sales order
Hi, I have one requirement to populate weight of line item material in the sales order based of plant. When the processing of sales order is trigerred the value in the reference characteristic will be available in the User Exit MV45AFZZ through t
-
How to burn movie to dvd from imovie?
How to I burn a home movie from imovie theater to dvd?
-
Photoshop Elements organizer 8 Vista Crash
I have just installed Photoshop elements 8. The editor works fine, but the organizer will not even open, just get the crash report. I have done everything in the Troubleshooting section except take out my RAM Sims. I am bypassing the Welcome screen:
-
i am trying to get database name and server details of service application(SPServiceApplication) Basically i need to get properties of Service applications pro-grammatically. Which we can find on selecting service and properties in the ribbon in cent