cancel
Showing results for 
Search instead for 
Did you mean: 

Delete source_package not working ?

former_member182467
Participant
0 Kudos

Hi,

I need to delete records in the source_package while loading from 1 dso to another dso, based on the below condition. The records are not getting deleted.

Do we need to handle it through looping on the source_package ? Please advise.

Delete source_package where SO_ORDER_TYPE NE 'A'or SO_ORDER_TYPE NE 'B'.

Basically I do not want any SO's other than these 2 order type's.

Please advise how to handle this in start routine.

Thank You

DR

Accepted Solutions (1)

Accepted Solutions (1)

FCI
Active Contributor
0 Kudos

Hi Daniel,

No LOOP should be necessary. Try a AND rather than a OR:

Delete source_package where SO_ORDER_TYPE NE 'A' AND SO_ORDER_TYPE NE 'B'.


Regards,

Frederic

former_member182467
Participant
0 Kudos

Hi Cincet/Amit,

thanks for the reply. Are you sure it will work fine ? I have not yet tried, Will try on Monday and update this trail....but is it same as handling it through a loop ? I mean will a single delete, work with AND. Can you please explain, how AND can check both the values in a single field. Im not an abaper.

thanks

DR

Answers (3)

Answers (3)

Former Member
0 Kudos

I agree with @Frédéric Cincet, 'AND' will work when the logical operator is 'NE'.


Thanks

Amit

dinesh_smhdr
Participant
0 Kudos

Yes source package holds the records and you need to loop on this source package and bring the data in to an internal table to perform the deletion.

loop at source_package assigning source_fields

if <source_fields>-SO_ORDER_TYPE NE 'A'.


delete SOURCE_PACKAGE.


elsif

   <source_fields>-SO_ORDER_TYPE NE 'B'.


delete SOURCE_PACKAGE.

endif.

endif.

endloop.

former_member182467
Participant
0 Kudos

Hi Karthik/Dinesh,

If we do this it will delete the whole source_package. You are asking to add additional code to your statements, if we give a single statement delete source_package, thats et, boom.

Thanks

DR

karthik_vasudevan
Active Contributor
0 Kudos

Hi Daniel

Yes, you need to use loop. Please try this

LOOP AT SOURCE_PACKAGE ASSIGNING <SOURCE_FIELDS>.

  IF <SOURCE_FIELDS>-SO_ORDER_TYPE NE 'A'.

     delete SOURCE_PACKAGE.

  ELSEIF <SOURCE_FIELDS>-SO_ORDER_TYPE NE 'B'.

     delete SOURCE_PACKAGE.

  ENDIF.

ENDLOOP.

Regards

Karthik