Skip to Content
avatar image
Former Member

How set data in table in one row ?

Hello all!
I have table here i have three same data in Country and company. I need set data in columns in one row. Like DE 10051 15.04.2016 14:13:02 15:04.2016 14:22:13.
How can i do this?

Thx

Capture.JPG (35.2 kB)
Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

3 Answers

  • Best Answer
    avatar image
    Former Member
    Apr 27, 2016 at 01:08 PM

    It was very simple:
    First SORT the table by keys of internal table for what deleting duplicates would be going.

    SORT lt_tables BY country company.

    Then Loop on this table with assigning for checking initial field(and not initial). And loop in the loop with WHERE , here we filter by country and company.

    LOOP AT lt_tables ASSIGNING <ls_tables>.

    IF <ls_tables>-table04 IS INITIAL.

    LOOP AT lt_tables INTO ls_tables WHERE country = <ls_tables>-country AND

    company = <ls_tables>-company AND

    table04 IS NOT INITIAL.

    and after that simple data copy (assign) for field from filtered by company and country.

    <ls_tables>-table04 = ls_tables-table04.

    and delete duplicates in table by my sorted keys.

    DELETE ADJACENT DUPLICATES FROM lt_tables COMPARING country company.

    Add comment
    10|10000 characters needed characters exceeded

  • Apr 21, 2016 at 09:28 AM

    Where is your data coming from, can't you process that after db selection, before you display ALV?

    M.

    Add comment
    10|10000 characters needed characters exceeded

    • Then you could consider lt_zgm as intermediary table with key Company and Country,

      So in your final table you do READ lt_final WITH KEy country = .. company = ..

      if found -> update

      if not found -> insert,

      and bind that lt_final to your uielement.

      This way you only have one entry per Company/Country.

  • Apr 21, 2016 at 10:19 AM

    Hi Michal,

    Is the data in 1 row where you are reading it from ?

    Add comment
    10|10000 characters needed characters exceeded