01-25-2007 12:17 PM
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?
01-26-2007 10:43 PM
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.
02-01-2007 11:32 PM
Yes, I know, but is requested that program reads several price condition tables, so, dynamic selection is needed.
01-27-2007 3:36 PM
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.
01-27-2007 3:53 PM
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
02-01-2007 11:34 PM