You do not need 0fiscyear in semantic key, you must only those chars that must explicitly define "group to process in one package"!! If you add a characteristics then dusring PSA extraction the system can put in different packages different values of it and each package processed separatelly and your logic will not work.
"loaded in the same day mostly" - that's bad because you have a risk that 230 loaded in 2015 and *** - in 2016 for example. And your routine cant't handle such case.
Here is the code.
CONSTANTS:
l_c_numbers TYPE c LENGTH 10 VALUE '0123456789'.
FIELD-SYMBOLS:
<prev> LIKE <source_fields>.
" by your logic we always have to detele PLN
DELETE source_package
WHERE transtype = 'PLN'.
CHECK lines( source_package ) > 1.
SORT source_package
by comp_code
asset_main
asset
transtype.
READ source_package
INDEX 1
ASSIGNING <prev>.
LOOP AT source_package FROM 2 ASSIGNING <source_fields>.
IF <prev>-asset <> <source_fields>-asset
OR <prev>-asset_main <> <source_fields>-asset_main
OR <prev>-comp_code <> <source_fields>-comp_code.
ASSIGN <source_fields> TO <prev>.
ELSE.
" you have 2 records with numeric TRANSTYPE... error ?
ASSERT <prev>-transtype CN l_c_numbers
OR <source_package>-transtype CN l_c_numbers.
IF <prev>-transtype CO l_c_numbers.
DELETE source_package INDEX sy-tabix.
IF <source_package>-transtype CO l_c_numbers.
DELETE source_package INDEX sy-tabix - 1. " not sure if expression allowed
ASSIGN <source_fields> TO <prev>.
ENDIF.
ENFIF.
ENDLOOP.