Application Development 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: 

Price conditions selection

Former Member
0 Kudos

Hello,

I just want to read some price conditions from SD.

I see that there is FM RV_T681_SELECT_AND_GENERATE that geenrates (if needed) a dynamic standard program for data selection, I see in this generated program that some subroutines are for external execution (FILL_COMM_AREA_FROM_VAKEY, ...) and it seems that by passing VAKEY field with required data for selection, standard program is able to make a selection in to respective DataBase.

Does anyone know how to use this external subroutines from this dinamic program for reading conditions?

5 REPLIES 5

Jelena
Active Contributor
0 Kudos

Wouldn't it be easier to find in which table the condition of interest is stored (the table names are in T681) and do a SELECT on it? There are also quite a few FMs specifically for pticing (try PRIC in SE37).

Which price are you looking for exactly? As far as I know, pricing conditions for a specific SD document can be found in KONV table.

Former Member
0 Kudos

Yes, I know, but is requested that program reads several price condition tables, so, dynamic selection is needed.

former_member182371
Active Contributor
0 Kudos

Hi,

have alook at the following blog:

/people/aditya.palekar/blog/2006/12/03/how-to-carry-out-pricing-using-abap-function-module-pricing

Best regards.

Clemenss
Active Contributor
0 Kudos

Hi Jorge,

this is taken from an IS-Media order print program:


    CONCATENATE ls_jhaga-pos_nr ls_jhaga-gruppabrnr INTO lv_vbdpaposnr.
    CLEAR ls_komk.
    ls_komk-mandt                         = sy-mandt.
    ls_komk-kalsm                         = ls_jhaga-kalsm.
    ls_komk-kappl                         = 'JA'.
    ls_komk-waerk                         = ls_jhaga-waerg.
    ls_komk-knumv                         = ls_jhak-knumv.
    ls_komp-kposn                         = lv_vbdpaposnr.

    CALL FUNCTION 'RV_PRICE_PRINT_REFRESH'
      TABLES
        tkomv                             = lt_komv.

    CALL FUNCTION 'RV_PRICE_PRINT_ITEM'
      EXPORTING
        comm_head_i                       = ls_komk
        comm_item_i                       = ls_komp
        language                          = nast-spras
      IMPORTING
        comm_head_e                       = ls_komk
        comm_item_e                       = ls_komp
      TABLES
        tkomv                             = lt_komv
        tkomvd                            = lt_komvd.

It should work for you with some minor changes: Find out what is the calculation scheme and application. knumv is in the document header; kposn might be a little tricky. In our case it is concatenated item and invoice grouping number; this might be different. You can set a breakpoint on function module RV_PRICE_PRINT_ITEM because it is used in many transactions to select conditions. If your transaction runs into the breakpoint you can check the parameter values.

The best will be to run the function in test environment SE37, but: You have to start transaction all over again after one try; in program you have to call 'RV_PRICE_PRINT_REFRESH' before (or after) calling because RV_PRICE_PRINT_ITEM stores internal data hurting subsequent calls.

The resulting tables

tkomv will have ALL conditions

tkomvd the conditions to be printed.

Regards,

Clemens

Former Member
0 Kudos

Thanks, but I already know this FM.