cancel
Showing results for 
Search instead for 
Did you mean: 

How to delete column duplicates in report

former_member456271
Participant
0 Kudos

Hello All,

Duplicates are popping up in alv report in Project Description Cloumn. as shown in image.

Only for required wbs element only it should fetch short description.

Delete adjacent statement was not working, i.e, lot of records getting deleted it should not be done.

former_member196331
Active Contributor
0 Kudos

Have us used sort before using Delete adjacent statement

ArthurParisius
Contributor
0 Kudos

With your delete adjacent, have you tried indicating which fields need to be checked and did you sort your table on those fields first?

former_member456271
Participant
0 Kudos

Yes I do used.

former_member456271
Participant
0 Kudos

Yes I do sorted as with field indiaction also but no use.

bala_sikkal
Explorer
0 Kudos

Project description is based on the project no, so try to do sort with project no and delete the adjacent duplicates based on project no. I hope single project has only one description.

SimoneMilesi
Active Contributor
0 Kudos

Expand a bit your analysis!

It's clear there are other keys, not just the project, probably some kind of document (value column change).

bala_sikkal
Explorer
0 Kudos

Two things,

1. If you want to remove the duplicate of line items, you can remove by project id so that the respective description lines also deleted.

2. If you need all the line items, then update the description only for the first line item of the project id.

former_member185414
Active Contributor
0 Kudos

As asked please explain a bit about how your table is getting prepared.

former_member456271
Participant
0 Kudos

    SELECT   pernr

             reinr

             zort1

             zland

             hrgio

             kunde

             datv1

             datb1 FROM ptrv_head INTO TABLE it_ptrv_head WHERE

                    pernr IN s_pernr AND reinr IN s_reinr AND datv1 IN s_begda AND datb1 IN s_endda.


    IF  sy-subrc = 0.
      SORT it_ptrv_head.
    ENDIF.


SELECT pspnr post1 FROM prps INTO TABLE it_prps WHERE pspnr IN s_posnr.
  IF sy-subrc = 0.
    SORT it_prps.
  ENDIF.


  SELECT pernr reinr posnr FROM ftpt_req_account INTO TABLE it_wbs WHERE pernr IN s_pernr AND posnr IN s_posnr AND reinr IN s_reinr.
  IF  sy-subrc = 0.
    SORT it_wbs BY posnr.
  ENDIF.

  LOOP AT it_ptrv_head INTO wa_ptrv_head.
      READ TABLE it_wbs       INTO wa_wbs       WITH KEY reinr = wa_ptrv_head-reinr.

      READ TABLE it_prps      INTO wa_prps      WITH KEY pspnr = wa_wbs-posnr.

endloop.


MOVE wa_wbs-posnr TO wa_final-posnr.

MOVE wa_prps-post1 TO wa_final-post1.

The above was the code which i was written.

Note there is no table to link posnr and pspnr( Wbs Element) and post1(Project).

Any suggestions please.
former_member456271
Participant
0 Kudos
    SELECT   pernr

             reinr

             zort1

             zland

             hrgio

             kunde

             datv1

             datb1 FROM ptrv_head INTO TABLE it_ptrv_head WHERE

                    pernr IN s_pernr AND reinr IN s_reinr AND datv1 IN s_begda AND datb1 IN s_endda.


    IF  sy-subrc = 0.
      SORT it_ptrv_head.
    ENDIF.

SELECT pspnr post1 FROM prps INTO TABLE it_prps WHERE pspnr IN s_posnr.
 IF sy-subrc = 0.
 SORT it_prps.
 ENDIF.
 SELECT pernr reinr posnr FROM ftpt_req_account INTO TABLE it_wbs WHERE pernr IN s_pernr AND posnr IN s_posnr AND reinr IN s_reinr.
 IF sy-subrc = 0.
 SORT it_wbs BY posnr.
 ENDIF.

 LOOP AT it_ptrv_head INTO wa_ptrv_head.
     READ TABLE it_wbs INTO wa_wbs WITH KEY reinr = wa_ptrv_head-reinr.

 READ TABLE it_prps INTO wa_prps WITH KEY pspnr = wa_wbs-posnr.

endloop.
MOVE wa_wbs-posnr TO wa_final-posnr.

MOVE wa_prps-post1 TO wa_final-post1.

The above was the code which i was written.

Note there is no table to link posnr and pspnr( Wbs Element) and post1(Project).

Any suggestions please.
former_member456271
Participant
0 Kudos

2. If you need all the line items, then update the description only for the first line item of the project id.

How this can be achieved Please explain me.

SimoneMilesi
Active Contributor
0 Kudos

Are you sure about this affirmation?

Note there is no table to link posnr and pspnr( Wbs Element) and post1(Project).

You are using the link instead...

And i do not understand what you are trying to achieve with this code (you also read it_prps without checking if IT_WBS read is successful)

 LOOP AT it_ptrv_head INTO wa_ptrv_head.
     READ TABLE it_wbs INTO wa_wbs WITH KEY reinr = wa_ptrv_head-reinr.
     READ TABLE it_prps INTO wa_prps WITH KEY pspnr = wa_wbs-posnr.
endloop.
MOVE wa_wbs-posnr TO wa_final-posnr.
MOVE wa_prps-post1 TO wa_final-post1.
former_member456271
Participant
0 Kudos

Simone Milesi

Yes there is no link "Note there is no table to link posnr and pspnr( Wbs Element) and post1(Project)."

As you can see in above image for WBS element respective Project description should be displayed.

But there is no table that links project number, project description and wbs element.

That is the reason i'm using below code.

 LOOP AT it_ptrv_head INTO wa_ptrv_head.
     READ TABLE it_wbs INTO wa_wbs WITH KEY reinr = wa_ptrv_head-reinr.
     READ TABLE it_prps INTO wa_prps WITH KEY pspnr = wa_wbs-posnr.
endloop.
MOVE wa_wbs-posnr TO wa_final-posnr.
MOVE wa_prps-post1 TO wa_final-post1.
former_member456271
Participant
0 Kudos

Please suggest me how to achieve it.

SimoneMilesi
Active Contributor
0 Kudos

POST1 is not the project, it's the WBS description!

In PRPS you have PSPHI as Project number!
And still i do not understand which duplicates you want to remove, since it's clear to me that the keys of your table are Employee (PERNR) and Trip Number (REINR).

It's perfect logic that the same person, with different trips has costs assigned to the same WBS!

Which are the duplicates you think they are wrong? And why do you thing they are wrong?


As side note: why don't you put these tables in join?

former_member456271
Participant
0 Kudos

My Apologies,
Yes POST1 is WBS description.

Here for wbs element respective description is coming but it was continuing till next wbs element appear.

SimoneMilesi
Active Contributor

So... it's not a matter of duplicate data, but a matter of "dirty" output.

A little suggestion: put a clear after the append of your internal table or, better, before filling your wa_... structure.

Accepted Solutions (0)

Answers (2)

Answers (2)

SimoneMilesi
Active Contributor

It's clear there is another key field (at least!) you are not showing in your picture: you should investigate which is the aim of this report and which are the actual output fields.

From the little snapshot, i doubt removing rows will be a wise solution.

By the way, you want to remove rows and not columns!


matt
Active Contributor

But they're duplicating inside a column... 😉

SimoneMilesi
Active Contributor

Oh yeah! Sorry!
Dumb me!

former_member456271
Participant
0 Kudos

Thanks for suggestion SimonMilesi.

issue got solved.

Yes problem with clearing work area.

Thanks for all for your valuable suggestions.

SimoneMilesi
Active Contributor

Another suggestion: if you explained the issue like you did in your last reply, everybody would have been able to help you in zero time.