cancel
Showing results for 
Search instead for 
Did you mean: 

deleting duplicate datas in start routine

Former Member
0 Kudos

Hi Gurus,

i want to delete duplicate records in transfer structure. i don't have too much ABAP knowledge.

I read the related subjects in the forum and wrote this but it doesn't work .

Can you please check it.

Points will be asigned..

(ZVK008 is technical name of my data source)

PROGRAM CONVERSION_ROUTINE.

  • Type pools used by conversion program

TYPE-POOLS: RS, RSARC, RSARR, SBIWA, RSSM.

  • Declaration of transfer structure (selected fields only)

TYPES: BEGIN OF TRANSFER_STRUCTURE ,

  • Record number to be filled in case of adding row(s)

  • to enable 'error handling'

record TYPE rsarecord,

  • InfoObject 0MAT_PLANT: CHAR - 000018

MATNR(000018) TYPE C,

  • InfoObject : CHAR - 000040

TEXT_ZSTRSTOK001(000040) TYPE C,

  • InfoObject 0PLANT: CHAR - 000004

BWKEY(000004) TYPE C,

  • InfoObject ZGS0066: QUAN - 000013

LBKUM(000007) TYPE P

DECIMALS 000003,

  • InfoObject : UNIT - 000003

MEINS(000003) TYPE C,

  • InfoObject ZGS0020: CURR - 000013

SALK3(000007) TYPE P

DECIMALS 000002,

  • InfoObject 0CURRENCY: CUKY - 000005

WAERS(000005) TYPE C,

  • InfoObject 0FISCPER3: NUMC - 000003

LFMON(000003) TYPE N,

  • InfoObject 0FISCYEAR: NUMC - 000004

LFGJA(000004) TYPE N,

END OF TRANSFER_STRUCTURE .

  • Declaration of Datapackage

TYPES: TAB_TRANSTRU type table of TRANSFER_STRUCTURE.

  • Global code used by conversion rules

$$ begin of global - insert your declaration only below this line -

  • TABLES: ...

  • DATA: ...

$$ end of global - insert your declaration only before this line -

FORM STARTROUTINE

USING G_S_MINFO TYPE RSSM_S_MINFO

CHANGING DATAPAK type TAB_TRANSTRU

G_T_ERRORLOG TYPE rssm_t_errorlog_int

ABORT LIKE SY-SUBRC. "set ABORT <> 0 to cancel datapackage

$$ begin of routine - insert your code only below this line -

  • DATA: l_s_datapak_line type TRANSFER_STRUCTURE,

  • l_s_errorlog TYPE rssm_s_errorlog_int.

Case I_DATASOURCE.

when 'ZVK008'.

Sort E_T_DATA by MATNR BWKEY.

DELETE ADJACENT DUPLICATES FROM E_T_DATA COMPARING by MATNR and BWKEY.

endcase.

  • abort <> 0 means skip whole data package !!!

ABORT = 0.

$$ end of routine - insert your code only before this line -

ENDFORM.

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Hayrettin,

- I think that you do not have access to the name of Datasource ie I_DATASOURCE

In the available structure g_s_minfo you only have e.g. Infosource G_S_MINFO-ISOURCE

- There is no 'AND' between MATNR and BWKEY

CASE g_s_minfo-isource.

WHEN ....

SORT datapak BY MATNR BWKEY.

DELETE ADJACENT DUPLICATES FROM datapak COMPARING MATNR BWKEY.

ENDCASE.

please try.

JG

Former Member
0 Kudos

thank you very much johann and rajesh .

i ll assign your points.

Former Member
0 Kudos

Hi,

If you are writing the code in the start routine in transfer rules...

use DATAPAK in place of e_t_data.

also check delete adjacent duplicates from datapak comparing by matnr bwkey.

hope this helps.

regards

Rajesh

Former Member
0 Kudos

i have changed the code to ;

Case I_DATASOURCE.

when 'ZVK008'.

Sort DATAPAK by MATNR BWKEY.

DELETE ADJACENT DUPLICATES FROM DATAPAK COMPARING by MATNR and BWKEY.

endcase.

but it is still giving error. is there any syntax error?

Former Member
0 Kudos

Hi,

Use only this code

Sort DATAPAK by MATNR BWKEY.

DELETE ADJACENT DUPLICATES FROM DATAPAK COMPARING MATNR BWKEY.

No need to check for the datasource.

regards

Rajesh