Skip to Content
author's profile photo Former Member
Former Member

How is address normally displayed in ALV

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

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • author's profile photo Former Member
    Former Member
    Posted on Oct 22, 2006 at 06: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

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      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

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.