cancel
Showing results for 
Search instead for 
Did you mean: 

How set data in table in one row ?

Former Member
0 Kudos

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

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

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.

Answers (2)

Answers (2)

former_member190321
Participant
0 Kudos

Hi Michal,

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

Szczerbowski
Active Participant
0 Kudos

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

M.

Former Member
0 Kudos

It is not ALV Simple table.
I make Select with assigning, and after that loop, where with If i choosing color for cells and set date in columns. My code example:


SELECT * FROM zbw... INTO CORRESPONDING FIELDS OF TABLE lt_zgm...

   LOOP AT lt_zgm.. ASSIGNING <ls_zgm...> .

     IF <ls_zgm_...>-tabname = 'ZGM_M...'.

       ls_tables-country = <ls_zgm_mmv_status>-country.
      ....

IF ls_tables-country IS NOT INITIAL.

         ls_tables-celldesign = cl_wd_table_column=>e_cell_design-calendar_blue.

       ENDIF.


The same for others tab.
And in the end: append into table and bind it

Szczerbowski
Active Participant
0 Kudos

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.