Skip to Content
0
Former Member
Mar 19, 2009 at 09:09 PM

Trying to append or insert a record based on classification

33 Views

Hello Gurus,

I have a need to update sales or based on sales classification within BI at customer level.

If classifi = Z1 then sales org is 1000, if classif = Z4 then I need it shld create two values of sales or for the same customer.

Ex - Customer Sales Org Classification

10000001 1000 Z1

10000002 1000 Z4

10000002 3000 Z4

Iam getting a ABAP dump at the append line when writing the records to a DSO. Any better way of achieving these results ?

My code looks like this so far -

DATA: W_RESULT_PACKAGE LIKE LINE OF RESULT_PACKAGE.

LOOP AT RESULT_PACKAGE INTO W_RESULT_PACKAGE.

IF W_RESULT_PACKAGE-CUST_CLASS EQ 'Z1'.

W_RESULT_PACKAGE-SALESORG = '1000'.

MODIFY RESULT_PACKAGE FROM W_RESULT_PACKAGE TRANSPORTING

SALESORG.

ELSEIF W_RESULT_PACKAGE-CUST_CLASS EQ 'Z4'.

W_RESULT_PACKAGE-SALESORG = '1000'.

MODIFY RESULT_PACKAGE FROM W_RESULT_PACKAGE TRANSPORTING

SALESORG.

W_RESULT_PACKAGE-SALESORG = '3000'.

Append w_result_package to RESULT_PACKAGE.

ENDIF.

ENDLOOP.

Thanks,

PB