07-21-2020 9:01 AM
For example, I should add a column to ALV table and fill in the fields of this column as 'customer'.
wa_fcat-fieldname = 'TYPE'.
wa_fcat-seltext_m = 'Type'.
APPEND wa_fcat TO it_fcat.
CLEAR wa_fcat.
07-21-2020 9:15 AM
Hello shrgrl
What you did not is you've added a column to the ALV field catalog, which is responsible for presentation of ALV columns. But each of these columns have to have a value, which comes from an internal table, passed to ALV.
To populate your new column with a value you need to add TYPE column to your internal table and populate it with values for each row of the internal table.
Please provide more details about your ALV creation logic, if you need more assistance.
Kind regards,07-21-2020 12:29 PM
mateuszadamus Thanks for reply. I have an ALV table. I used it in the example here: https://answers.sap.com/comments/13097373/view.html . I want to add and fill a new column in this table. In the fields that column has, it should write 'customer' for the customer table and 'seller' for the Sales table. I filled the alv table with fieldcat, but I don't know how to add an external column.
07-21-2020 9:15 AM
What's the problem? Expand your field catalog and internal table with the data.
Sorry for the bad answer, but without a problem it is hard to help you.
07-21-2020 9:56 AM
shrgrl,
if you are expecting to default a value using the field catalog then it is not possible. You have to only use the Internal table to manipulate the data that is displayed.
Probably you can default the value either while populating or during declaration. If you can help us with more details on your requirement and object details we can help you further.
Regards!
07-21-2020 12:30 PM
satishkumarbalasubramanian Thanks for reply. I have an ALV table. I used it in the example here: https://answers.sap.com/comments/13097373/view.html . I want to add and fill a new column in this table. In the fields that column has, it should write 'customer' for the customer table and 'seller' for the Sales table. I filled the alv table with fieldcat, but I don't know how to add an external column. I new in abap. Sorry for easy questions
07-21-2020 12:50 PM
shrgrl,
After Adding the field Catalogs, modify your select queries as below:
SELECT lfa1~lifnr,
lfa1~name1,
lfa1~telfx,
lfa1~adrnr,
lfa1~telf1,
lfa1~stcd1,
lfa1~stcd2,
'Seller' AS type
FROM lfa1
INNER JOIN lfb1
ON lfa1~lifnr = lfb1~lifnr
INTO TABLE @it_satici
WHERE lfb1~bukrs IN @so_bkr_l AND
lfa1~lifnr IN @so_lifnr.
SELECT kna1~kunnr,
kna1~name1,
kna1~telfx,
kna1~adrnr,
kna1~telf1,
kna1~stcd1,
kna1~stcd2,
'Customer' AS type
FROM kna1
INNER JOIN knb1
ON kna1~kunnr = knb1~kunnr
INTO TABLE @it_musteri
WHERE knb1~bukrs IN @so_bkr_k AND
kna1~kunnr IN @so_kunnr.
Regards!
07-21-2020 12:25 PM
@ brunner I have an ALV table. I used it in the example here: https://answers.sap.com/comments/13097373/view.html . I want to add and fill a new column in this table. In the fields that column has, it should write 'customer' for the customer table and 'seller' for the Sales table. I filled the alv table with fieldcat, but I don't know how to add an external column.