Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

PRICING FM

Former Member
0 Likes
477

Hi Experts,

Seeking help on using this function module.

Basically, I want to simulate the PRICING of a material by geting an existing Invoice Line Item and just changing the material.

I am getting mixed results and can't seem to get a pattern or clue. Perhaps you guys can help as I'm quite new to this FM.

I've tried setting CALTY to 'B' and 'C'. Let me know if you see something I don't. Thanks!

    
    SELECT SINGLE * INTO lwa_vbrk FROM vbrk WHERE vbeln EQ P_VBELN.
    SELECT SINGLE * INTO lwa_vbrp FROM vbrp WHERE vbeln EQ P_VBELN AND posnr EQ P_POSNR.

*   Get KOMK and KOMP, the rest are dummies.. unfortunately
    CALL FUNCTION 'RV_INVOICE_PRICING_PREPARE'
    EXPORTING
      VBRK_I         = lwa_vbrk
      VBRP_I         = lwa_vbrp
    IMPORTING
      KOMK_E         = lwa_komk
      KOMP_E         = lwa_komp
    TABLES
      XKOMFK         = li_komfk
      XVBFS          = li_vbfs
      XVBPA          = li_vbpa
      XVBRK          = li_vbrk
      XVBRP          = li_vbrp.

    lwa_komp-matnr = P_MATNR. " change material to material to be simulated

*   remove all references to be sure
    CLEAR: lwa_komk-belnr.
    CLEAR: lwa_komk-knumv.
    CLEAR: lwa_komk-Vbelv.

*   Simulate pricing
    CALL FUNCTION 'PRICING'
      EXPORTING
        CALCULATION_TYPE = P_CALTY "LC_NEW    "IMPORTANT: Carry out new pricing, default is A=>extract from existing
        COMM_HEAD_I      = lwa_komk
        COMM_ITEM_I      = lwa_komp
      TABLES
        TKOMV            = li_komv. " RESULT

1 REPLY 1
Read only

Former Member
0 Likes
359

found the problem.

Some of the documents that I am extracting from VBRK are cancelled or cancellation documents.

I tried clearing the following fields and I got results from KOMV:

fksto

sfakn

rfbsk

cpkur

I didn't do more tests so, probably, you don't need to clear all of these.