Skip to Content
author's profile photo Former Member
Former Member

ABAP routine for calculating QTY

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.

Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • author's profile photo Former Member
    Former Member
    Posted on Sep 18, 2007 at 06:25 PM

    Hi,

    Try this logic it should work

    data: zqty type i.

    zqty = comm_strucutre-qty

    if comm_structure-document <> 0 and

    comm_sturcutre-item <> 0 and

    comm_sturcuture-material <> ' '

    <b>comm_structure-qty<>0</b>

    zqty = zqty +qty

    endif.

    ( In this case it vl check if qty is not equal to zero then only qty will be added.)

    result = zqty.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.