Skip to Content
0
Former Member
Sep 18, 2007 at 04:43 PM

ABAP routine for calculating QTY

25 Views

I have to introduce and calculate the qty value

The data looks like in the ODS layer

Document Order Item Contract Material

185000480 0100 001 ZL0001

185000480 0200 001 ZL0002

185000480 0200 002 ZL0002

185000480 0300 001 ZL0003

185000480 0300 002 ZL0003

185000480 0300 003 ZL0003

185000480 0300 006 ZL0003

185000480 0300 008 ZL0003

Infocube level QTY needs to be calculated based on material and line item per document like below,

Document Order Item Contract Material qty

185000480 0100 001 ZL0001 1

185000480 0200 001 ZL0002 1

185000480 0200 002 ZL0002

185000480 0300 001 ZL0003 1

185000480 0300 002 ZL0003

185000480 0300 003 ZL0003

185000480 0300 006 ZL0003

185000480 0300 008 ZL0003

I have write the ABAP code

data: zqty type i.

if comm_structure-document <> 0 and

comm_sturcutre-item <> 0 and

comm_sturcuture-material <> ' '

zqty = zqty +1

endif.

result = zqty.

ZQTY is not populating properly.

Advance Thanks for your help to correct this issue.