Posted: Sun Mar 02, 2008 1:54 pm Post subject: Multi-line ALV using ROW_POS in field catalog
Does you business requirement needs single line item in ALV to be displayed in multiple rows/lines for better readability? You then surely need a multi-line ALV, which can be implemented by just a simple tweaking in your ALV field catalog.
You can achieve this objective using property ROW_POS of Field catalog. Just assign a value between 1 to 3 to each of the records (denoting output internal table’s columns/fields) in field catalog. That’s it. Value is restricted between 1 and 3 since ALV can handle maximum of 3 rows for 1 ALV line item.
The example followed will completely clear the usage.
Here is the code to build the field catalog of an ALV.
FORM e01_fieldcat_init USING e01_lt_fieldcat TYPE slis_t_fieldcat_alv.
DATA: ls_fieldcat TYPE slis_fieldcat_alv.
ls_fieldcat-fieldname = ‘CARRID’.
ls_fieldcat-key = ‘X’.
ls_fieldcat-ref_fieldname = ‘CARRID’.
ls_fieldcat-ref_tabname = ‘SFLIGHT’.
ls_fieldcat-row_pos = 1.
APPEND ls_fieldcat TO e01_lt_fieldcat.
CLEAR ls_fieldcat.
ls_fieldcat-fieldname = ‘CONNID’.
ls_fieldcat-key = ‘X’.
ls_fieldcat-ref_fieldname = ‘CONNID’.
ls_fieldcat-ref_tabname = ‘SFLIGHT’.
ls_fieldcat-row_pos = 1.
APPEND ls_fieldcat TO e01_lt_fieldcat.
CLEAR ls_fieldcat.
ls_fieldcat-fieldname = ‘FLDATE’.
ls_fieldcat-key = ‘X’.
ls_fieldcat-ref_fieldname = ‘FLDATE’.
ls_fieldcat-ref_tabname = ‘SFLIGHT’.
ls_fieldcat-row_pos = 1.
APPEND ls_fieldcat TO e01_lt_fieldcat.
CLEAR ls_fieldcat.
ls_fieldcat-fieldname = ‘PRICE’.
ls_fieldcat-ref_fieldname = ‘PRICE’.
ls_fieldcat-ref_tabname = ‘SFLIGHT’.
ls_fieldcat-row_pos = 2.
APPEND ls_fieldcat TO e01_lt_fieldcat.
CLEAR ls_fieldcat.
ls_fieldcat-fieldname = ‘CURRENCY’.
ls_fieldcat-ref_fieldname = ‘CURRENCY’.
ls_fieldcat-ref_tabname = ‘SFLIGHT’.
ls_fieldcat-row_pos = 2.
APPEND ls_fieldcat TO e01_lt_fieldcat.
ENDFORM.
The ALV with the above field catalog gives the following multi-lined ALV output.
All the columns with row_pos as 1 in the field catalog are appearing in 1st row where as the ones with row_pos as 2 are appearing in the 2nd row, even though they are one single line item in the ALV output internal table.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum
All product names are trademarks of their respective companies. SAPNET.RU websites are in no way affiliated with SAP AG. SAP, SAP R/3, R/3 software, mySAP, ABAP, BAPI, xApps, SAP NetWeaver and any other are registered trademarks of SAP AG. Every effort is made to ensure content integrity. Use information on this site at your own risk.