2009 Apr 09 10:45 AM
Hi ,
I need to get the data of any IDOC into a internal table. Now this internal table should be dynamic in nature.
How can a dynamic internal table be created?
Regards,
Harshit Rungta
Hi ,
I need to get the data of any IDOC into a internal table. Now this internal table should be dynamic in nature.
How can a dynamic internal table be created?
Regards,
Harshit Rungta
2009 Apr 09 10:47 AM
Hi,
Refer to this blog by Nimesh.
http://help-abap.blogspot.com/2008/09/dynamic-internal-table-creation.html
-Amresh
2009 Apr 09 10:47 AM
Hi,
use this method:
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
it_fieldcatalog = it_fieldcat
IMPORTING
ep_table = new_table.
2009 Apr 09 10:54 AM
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.
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>.
2009 Apr 09 11:37 AM
Hi Harshit,
Find the below code.
FIELD-SYMBOLS: <gt_table> TYPE TABLE,
<gs_line> TYPE ANY,
<gd_field> TYPE ANY.
*Field catalog for dynamic table.
DATA : gt1_fieldcat TYPE lvc_t_fcat,
gt_ex_fieldcat TYPE lvc_t_fcat.
*Fill the field catalog.
PERFORM fill_catalog_dyn USING 'PERNR' 'CHAR' 'Employee Number' '8'.
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
it_fieldcatalog = gt1_fieldcat
IMPORTING
ep_table = gt_new_table.
ASSIGN gt_new_table->* TO <gt_table>.
CREATE DATA gs_new_line LIKE LINE OF <gt_table>.
ASSIGN gs_new_line->* TO <gs_line>.
FORM FILL_CATALOG_DYN USING VALUE(P_1704)
VALUE(P_1705)
VALUE(P_1706)
VALUE(P_1707)
VALUE(P_1708).
gd_pos = gd_pos + 1.
gs1_fieldcat-fieldname = P_1704.
gs1_fieldcat-datatype = P_1705.
gs1_fieldcat-scrtext_l = P_1706.
gs1_fieldcat-outputlen = P_1707.
gs1_fieldcat-decimals = P_1708.
gs1_fieldcat-col_pos = gd_pos.
APPEND gs1_fieldcat TO gt1_fieldcat.
CLEAR gs1_fieldcat.
ENDFORM. " FILL_CATALOG_DYN
2009 Apr 09 12:33 PM
Hi,
Try this:
https://www.sdn.sap.com/irj/scn/wiki?path=/display/snippets/creatingadynamicinternaltablebasedon+data
Regards,
Deepak
2009 May 14 12:17 PM
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |