10-22-2006 5:23 AM
Hi guys,
I am still new at ABAP and my assignment is to display company name and address from KNA1 on an ALV grid given a set of customer number.
The problem i am facing is that the addresses are not consistent(eg some contains name1 and name2, some only contains name1).
Do I create seperate columns for each field of KNA1 in the ALV, or is it possible to create a column with multiple lines to hold the address?
Please advise. sample programs with ALV that displays address would be helpful
Thanks
10-22-2006 7:01 AM
Hi
It's possible to create only one:
If ITAB is your output table, define a field NAME instead of NAME1 and NAME2 and while you're upoloading the address data concatenate those two fields in NAME.
DATA: BEGIN OF ITAB OCCURS 0,
...........
NAME1 LIKE KNA1-NAME1,
NAME2 LIKE KNA1-NAME2,
NAME(70),
END OF ITAB.
I don't know how you load the data:
DATA: LEN TYPE I.
SELECT * KNA1 WHERE KUNNR IS SO_KUNNR
LEN = STRLEN( KNA1-NAME1 ).
WRITE KNA1-NAME1(LEN) TO ITAB-NAME.
LEN = LEN + 1.
WRITE KNAM1-NAME2 TO ITAB-NAME+LEN.
APPEND ITAB.
ENDSELECT.
Max
10-22-2006 9:37 AM
lets say there is street address and country as well.
how do i force the ALV to disply them in multiple row?
fooo bar thud
1st street,
33844, town,
country
10-22-2006 10:50 AM
Hi
In the catalog table you can indicate the position and the row where every field has to be displayed.
DATA: LT_FIELDCAT TYPE SLIS_FIELDCAT_ALV,
GT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV.
LOOP AT GT_FIELDCAT INTO LT_FIELDCAT.
LT_FIELDCAT-ROW_POS = <ROW>. " output in row
LT_FIELDCAT-COL_POS = <POS>. " position of the column
MODIFY GT_FIELDCAT FROM LT_FIELDCAT.
ENDLOOP.
Max