cancel
Showing results for 
Search instead for 
Did you mean: 

Calculate open quantity for pending contracts in VA45

pranay_suyash
Explorer
0 Kudos

Hi Experts,

I wanted to get the open quantity for contracts. In VA45, i got the following code written:

LOOP AT lvbmtv ASSIGNING <fs_lvbmtv>.

         CLEAR:lv_menge.

         LOOP AT lit_vbfa INTO lwa_vbfa WHERE vbelv = <fs_lvbmtv>-vbeln.

           READ TABLE git_vbap_n INTO lwa_vbap_n WITH KEY vbeln = lwa_vbfa-vbeln.

           IF sy-subrc = 0.

             lv_menge = lv_menge + lwa_vbap_n-kwmeng.

           ENDIF.

         ENDLOOP.

         CLEAR:lv_menge_n.

         READ TABLE git_vbap INTO lwa_vbap WITH KEY vbeln = <fs_lvbmtv>-vbeln.

         IF sy-subrc = 0.

           lv_menge_n lwa_vbap-zmeng - lv_menge.

         ENDIF.

         <fs_lvbmtv>-zmeng = lv_menge_n.

       ENDLOOP.

       MOVE lv_menge_n TO lvbmtv-zmeng.


Now, this works fine if a contract has been referenced by sales orders with single line items. But in case of multiple line items, the code only calculates the open quantity for the first line and not for the others. My ABAP consultant has been unable to get the line items included.

Could you please help me out.


Thanks

Pranay

Accepted Solutions (0)

Answers (4)

Answers (4)

Jelena
Active Contributor
0 Kudos

Line item is available in VA45, it's in VBAP and in VBFA. What exactly is the problem with writing the correct ABAP code?

Are you an ABAP developer? If so, you should understand what the code does. If not - get a qualified ABAP developer to write the code.

Lakshmipathi
Active Contributor
0 Kudos

This standard transaction itself has the option "Open Contracts"  to populate the report.  Have you not seen this?

G. Lakshmipathi

pranay_suyash
Explorer
0 Kudos

Dear Lakshmipathi,

VA45 does not show the open quantities which the client is asking for and hence we have added a field which calculates the same. The problem we are having is that the above calculation is not working for multiple line items.

Thanks

Former Member
0 Kudos

Hello Pranay,

To verify open quantities in contracts there is a standard function which will work depending of your configuration, does that interest you?

If your configuration is correct, you can check the pending quantity on the menu -> Environment -> Status Overview

pranay_suyash
Explorer
0 Kudos

The client is able to see that in the status overview but wants to see that in a report.

siva_vasireddy2
Active Contributor
0 Kudos

Hi,

what might be the reason to write the code

pranay_suyash
Explorer
0 Kudos

Hi,

For pending contract, the client wants to see the open quantities which is not available in any standard report. They do not want to open each contract and go to status overview to check the open quantities.

Thus, the code was required.

Thanks