2006 Nov 13 7:06 AM
hi all
have a requirement such that i to have display the material in the colunm dynamically ...ie., if the sale order contains some 5 material that has to be displayed in the colunm dynamically ..... how to do that ...
my required layout is
customer,invoice no,mat1, mat2 ,mat3...(depends on no. of material in sale order)
and in the customer filed i should get this below said 3 in each row ... ex,
customer name______ row 1.1
city _______________row 1.2
incoterms __________ row 1.3
is this layout possible in alv
thanks in advnce
lokesh
hi all
have a requirement such that i to have display the material in the colunm dynamically ...ie., if the sale order contains some 5 material that has to be displayed in the colunm dynamically ..... how to do that ...
my required layout is
customer,invoice no,mat1, mat2 ,mat3...(depends on no. of material in sale order)
and in the customer filed i should get this below said 3 in each row ... ex,
customer name______ row 1.1
city _______________row 1.2
incoterms __________ row 1.3
is this layout possible in alv
thanks in advnce
lokesh
2006 Nov 13 1:53 PM
Hi,
You can create column in internal table dynamically and display it as ALV report.
Here the samlpe code:
REPORT Z_JRQ012R .
TYPE-POOLS: slis.
data: IS_LVC_CAT type LVC_S_FCAT,
IT_LVC_CAT type LVC_T_FCAT,
IS_FIELDCAT type SLIS_FIELDCAT_ALV,
IT_FIELDCAT type SLIS_T_FIELDCAT_ALV,
IS_LAYOUT type SLIS_LAYOUT_ALV,
new_table TYPE REF TO data,
new_line TYPE REF TO data.
FIELD-SYMBOLS: <l_table> TYPE TABLE,
<l_line> TYPE ANY,
<l_field> TYPE ANY.
* create fieldscatalog for create table dynamicly
IS_LVC_CAT-fieldname = 'PERNR'.
IS_LVC_CAT-ref_field = 'PERNR'.
IS_LVC_CAT-ref_table = 'PA0001'.
APPEND IS_LVC_CAT TO IT_LVC_CAT.
IS_LVC_CAT-fieldname = 'BEGDA'.
IS_LVC_CAT-ref_field = 'BEGDA'.
IS_LVC_CAT-ref_table = 'PA0001'.
APPEND IS_LVC_CAT TO IT_LVC_CAT.
IS_LVC_CAT-fieldname = 'ENDDA'.
IS_LVC_CAT-ref_field = 'ENDDA'.
IS_LVC_CAT-ref_table = 'PA0001'.
APPEND IS_LVC_CAT TO IT_LVC_CAT.
* create fieldscatalog for display data in ALV
IS_FIELDCAT-fieldname = 'PERNR'.
IS_FIELDCAT-ref_fieldname = 'PERNR'.
IS_FIELDCAT-ref_tabname = 'PA0001'.
APPEND IS_FIELDCAT TO IT_FIELDCAT.
IS_FIELDCAT-fieldname = 'BEGDA'.
IS_FIELDCAT-ref_fieldname = 'BEGDA'.
IS_FIELDCAT-ref_tabname = 'PA0001'.
APPEND IS_FIELDCAT TO IT_FIELDCAT.
IS_FIELDCAT-fieldname = 'ENDDA'.
IS_FIELDCAT-ref_fieldname = 'ENDDA'.
IS_FIELDCAT-ref_tabname = 'PA0001'.
APPEND IS_FIELDCAT TO IT_FIELDCAT.
* Create a new Table
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
it_fieldcatalog = IT_LVC_CAT
IMPORTING
ep_table = new_table.
* Create a new Line with the same structure of the table.
ASSIGN new_table->* TO <l_table>.
CREATE DATA new_line LIKE LINE OF <l_table>.
ASSIGN new_line->* TO <l_line>.
* Test it...add value for every fields
DO 3 TIMES.
ASSIGN COMPONENT 'PERNR' OF STRUCTURE <l_line> TO <l_field>.
<l_field> = 123456789.
ASSIGN COMPONENT 'BEGDA' OF STRUCTURE <l_line> TO <l_field>.
<l_field> = '99991231'.
ASSIGN COMPONENT 'ENDDA' OF STRUCTURE <l_line> TO <l_field>.
<l_field> = '20030101'.
INSERT <l_line> INTO TABLE <l_table>.
ENDDO.
* Layout
IS_LAYOUT-COLWIDTH_OPTIMIZE = 'X'.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
IS_LAYOUT = IS_LAYOUT
IT_FIELDCAT = IT_FIELDCAT
TABLES
T_OUTTAB = <l_table>.
Regards,
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |