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

ALV Doubt...Very Urgent...

Hi,

I want to club two field values in ALV based upon the condition,I have selected the records from two database table based upon the condition and output is displayed using ALV Grid.I am getting the output as below.

eg:

AUFNR WEMNG MENGE

10001 15 11

10001 15 4

I want output as below:

AUFNR WEMNG MENGE

10001 15 11

10001 4

Both the cells of WEMNG should be clubbed based upon the AUFNR value..Please help me..

Thanks in advance,

Thasneem.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

5 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Oct 22, 2007 at 11:12 AM

    Hi,

    you can get like this

    AUFNR WEMNG MENGE

    10001 15 11

    10001 15 4

    I want output as below:

    AUFNR WEMNG MENGE

    10001 15 11

    10001 space 4

    i mean when ever 15 is repeating it will give you space

    according you can do for aufnr also

    for this you have to use sort functionality

    eg:

    DATA: WASORT TYPE slis_sortinfo_alv,

    ITSORT TYPE slis_t_sortinfo_alv.

    form sort_fields.

    gwa_sort-spos = 1. "

    gwa_sort-fieldname = 'WEMNG'.

    gwa_sort-tabname = 'ITAB'.

    gwa_sort-up = 'X'.

    APPEND WASORTTO ITSORT.

    CLEAR waSort.

    you can do the same for as many field as you want.

    REGARDS,

    VENKATESH

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi venkatesh,

      thanks for ur answer,

      Yes I want output as below:

      AUFNR WEMNG MENGE

      10001 15 11

      10001 space 4

      whenever i am getting the same values for wemng for same aufnr.it should be clubbed as above.

      i have used sort functionality.but i am not getting the output.is there any other way to get this.

      WEMNG is a quantity field.

      thanks & regards,

      Thasneem.

      Message was edited by:

      Thasneem .

  • author's profile photo Former Member
    Former Member
    Posted on Oct 22, 2007 at 11:24 AM

    hi,

    you need to declare one more itab of same sructure say itab2 and work area wa2.

    now,

    loop at itab into wa.

    if sy-subrc = 1.

    append wa to itab2.

    move wa to wa2.

    elseif wa2-aufnr = wa-aufnr.

    wa-wemng = ' '.

    append wa to itab2.

    move wa to wa2.

    if wa-

    endloop.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Oct 22, 2007 at 11:15 AM

    Hi,

    Do u mean the value must be added.. like this?

    eg:

    AUFNR WEMNG MENGE

    10001 15 11

    10001 15 4

    output as below:

    AUFNR WEMNG MENGE

    10001 30 11

    10002 2 10

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 22, 2007 at 11:16 AM

    Wat u can do is while populating ur final internal table for ALV display

    merge the fields using AT NEW aufnr wemng.

    and then populate the fields

    Then give this table for ALV display

    Reward if helpful

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi Prashant,

      Thanks for your answer,

      already i have tried at new concept,

      but i am getting output as

      AUFNR WEMNG MENGE

      10001 15 11

      10001 0 4

      I am getting 0 in the second record instead of space.If i am using 'at end of', then it is giving 0 for WEMNG of first record

      Thanks & regrads,

      Thasneem

  • author's profile photo Former Member
    Former Member
    Posted on Oct 22, 2007 at 11:17 AM

    Hi Thasneem,

    If you are trying to check the condition and display on the same Grid it is not possible.

    Otherwise, you can devide the set of records which satisfies the condition and display in separate Grid. You can club two field values using CONCATENATE statement by looping the output table before display as below.

    loop at itab.

    condense itab-MENGE.

    condense itab-WEMNG.

    CONCATENATE itab-MENGE

    itab-WEMNG

    into itab-displayfiled.

    endloop.

    Regards

    Ali S

    Add a comment
    10|10000 characters needed characters exceeded

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.