Skip to Content
0
Jul 04, 2016 at 06:47 PM

ABAP Routine to summarization values

1344 Views

Hello Experts,

I've an issue that I need to solve concerning a ABAP Routine in my BW transformation rule (ODS 1 to ODS2)

This is my ODS1 data (example):

Item Tax Code Value 1 02 R$ 10,00 2 02 R$ 15,00 3 03 R$ 23,00 4 02 R$ 58,00 5 05 R$ 213,00 ... ... ... TOTAL R$ 319,00

In ODS 1, I've a lot of registers of "Itens" with its specifics "Tax Codes" and "Values".

I'll send all this information to one InfoObject in my ODS 2 through my transfer rule, that a pretend to manipulate these data and gimme the result that I expect.

So, this is the scenario: I've to use ONLY Tax Code 02 and make a SUM of all Values with this Code and show as result only in one summarizated row. I can ignore the Item in this step and foward.

Result (in my InfoObject in ODS 2 I just need the Value):

Item Tax Code Value 1 02 R$ 83,00

How is this part of my simple abap code:

Example:

Item: Z_CODITEM

Tax Code: Z_CODTAX

Value: Z_VALUES

IF Z_CODTAX EQ '02'.

Z_VALUES = SUM(Z_VALUES). [here is my issue, its generating a dump error]

ELSE . Z_VALUES = Z_VALUES.

ENDIF.

Could you please help me?

I want a simple code, not a table with loops or something like that, but if I really have to use a table, make it simple please.

Thanks,

Flávio Thomazetti