2008 Jun 03 4:44 PM
Hi fellow abapers
I need to create an internal table (dynamically) as following
begin of itab,
material
material description
operation1
machine1
operation2
machine2
..
..
operation<n>
machine<n>
end of itab.
in this,no. of occurancesof the fields - OPERATION & MACHINE will vary depending on the material (some may have 5 , some have 10 ).
how to create the internal table, populate the values in it and display in alv.
plz help, its urgent.
rewards sure.
Regards
Prabumanoharan
2008 Jun 03 5:09 PM
Hi Prabhu,
Here it is..
step1.Build an field catelog which should consist of all the fields which u want in internal table.
step2.Call the method
step3.Create work area..
Sample Code:
data: t_fieldcat TYPE lvc_t_fcat,
wa_fieldcat TYPE lvc_s_fcat.
wa_fieldcat-tabname = 'EKKO'.
wa_fieldcat-fieldname = 'EBELN'.
wa_fieldcat-datatype = 'CHAR'.
wa_fieldcat-intlen = '10'.
APPEND wa_fieldcat TO t_fieldcat.
CLEAR : wa_fieldcat.
wa_fieldcat-tabname = 'EKPO'.
wa_fieldcat-fieldname = 'MATNR'.
wa_fieldcat-datatype = 'CHAR'.
wa_fieldcat-intlen = '18'.
APPEND wa_fieldcat TO t_fieldcat.
CLEAR : wa_fieldcat.
*-----Building Dynamic internal table.
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
it_fieldcatalog = t_fieldcat
IMPORTING
ep_table = dy_table.
ASSIGN dy_table->* TO <t_paymord>.
*-----Creating work area for dynamic internal table
CREATE DATA: dy_line LIKE LINE OF <t_paymord>.
ASSIGN: dy_line->* TO <w_paymord> .
LOOP AT <t_paymord> INTO <w_paymord>.
Endloop.
Regards,
Vigneswaran S
Hi fellow abapers
I need to create an internal table (dynamically) as following
begin of itab,
material
material description
operation1
machine1
operation2
machine2
..
..
operation<n>
machine<n>
end of itab.
in this,no. of occurancesof the fields - OPERATION & MACHINE will vary depending on the material (some may have 5 , some have 10 ).
how to create the internal table, populate the values in it and display in alv.
plz help, its urgent.
rewards sure.
Regards
Prabumanoharan
2008 Jun 03 4:47 PM
hi,
chk the sample code here:
https://www.sdn.sap.com/irj/sdn/wiki?path=/display/snippets/dynamic%2binternal%2btable
/people/rich.heilman2/blog/2005/07/27/dynamic-internal-tables-and-structures--abap
2008 Jun 03 5:09 PM
Hi Prabhu,
Here it is..
step1.Build an field catelog which should consist of all the fields which u want in internal table.
step2.Call the method
step3.Create work area..
Sample Code:
data: t_fieldcat TYPE lvc_t_fcat,
wa_fieldcat TYPE lvc_s_fcat.
wa_fieldcat-tabname = 'EKKO'.
wa_fieldcat-fieldname = 'EBELN'.
wa_fieldcat-datatype = 'CHAR'.
wa_fieldcat-intlen = '10'.
APPEND wa_fieldcat TO t_fieldcat.
CLEAR : wa_fieldcat.
wa_fieldcat-tabname = 'EKPO'.
wa_fieldcat-fieldname = 'MATNR'.
wa_fieldcat-datatype = 'CHAR'.
wa_fieldcat-intlen = '18'.
APPEND wa_fieldcat TO t_fieldcat.
CLEAR : wa_fieldcat.
*-----Building Dynamic internal table.
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
it_fieldcatalog = t_fieldcat
IMPORTING
ep_table = dy_table.
ASSIGN dy_table->* TO <t_paymord>.
*-----Creating work area for dynamic internal table
CREATE DATA: dy_line LIKE LINE OF <t_paymord>.
ASSIGN: dy_line->* TO <w_paymord> .
LOOP AT <t_paymord> INTO <w_paymord>.
Endloop.
Regards,
Vigneswaran S
2009 Jun 16 8:30 AM
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |