Skip to Content
-1

I want to add extra column and fill it with default value to an ALV table

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.

2qefy.png (65.2 kB)
Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • Posted on Jul 21, 2020 at 08:15 AM

    Hello Seher Grl

    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,
    Mateusz
    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jul 21, 2020 at 08:56 AM

    Seher Grl,

    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!

    Add a comment
    10|10000 characters needed characters exceeded

    • Seher Grl,

      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!

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.