02-13-2007 6:25 AM
i have created a BDC program for uploading data into VK11 & VK12 .what it does that it compares the valid from and valid to dates from the flat files
and if they already exist then for that condiotn type it goes to vk 12 and changes the prices and scalling quantity according to the falt file
and if the date range is not present then it oes to VK11 and creates the same from the flat file
now i want a bapi that works the same manner..
if any body can hel;p me
thanks in advance
02-13-2007 6:48 AM
03-16-2007 8:16 AM
Hi Ashish
Could u tell me if you were succesfull in using the BAPI - BAPI_PRICES_CONDITIONS for the scenario mentioned by you. We are facing a similar scenario and i was wondrring whether i should use a BDC for VK11 & VK12 or go for the mentioned BAPI.
Also pointers on how the BAPI should be implemented will be really helpful..
Thanks !
03-16-2007 8:36 AM
Hi Asish
Take a look at IDOC_INPUT_COND_A. You can either use the COND_A Idoc to accomplish this (quiet easy), or take a look at the logic in this FM.
and
have a look at these FMs
RV_CONDITION_RESET
RV_CONDITION_COPY
RV_CONDITION_SAVE
and check this Example
Got it to work. With the sequence :
1. RV_CONDITION_COPY
2. RV_CONDITION_SAVE
3. RV_CONDITION_RESET
4. commit
At least the key fields of the conditiontable
(here 800) must be filled in structure ls_komg.
ls_komg-vbeln = '1234567890'. " document number
ls_komg-posnr = '000010'. " item number
clear wt_komv.
ls_komv-kappl = 'V '. " Application V = Sales
ls_komv-kschl = lc_kschl. " Condition type
ls_komv-waers = 'EUR'. " Currency
ls_komv-kmein = 'ST'. " Unit of measurement
ls_komv-kpein = '1'.
ls_komv-krech = 'M'. " calculation type;
"M = Quantity - monthy price
ls_komv-kbetr = '1234.56'. " new condition value
append ls_komv to lt_komv.
call function 'RV_CONDITION_COPY'
exporting
application = 'V'
condition_table = '800' " cond. table
condition_type = lc_kschl " cond. type
date_from = '20061101' " valid on
date_to = '20061130' " valid to
enqueue = 'X' " lock entry
i_komk = ls_komk
i_komp = ls_komp
key_fields = ls_komg " key fields
maintain_mode = 'A' " A= create
" B= change,
" C= display
" D= create
with reference
no_authority_check = 'X'
keep_old_records = 'X'
overlap_confirmed = 'X'
no_db_update = space
importing
e_komk = ls_komk
e_komp = ls_komp
new_record = lv_new_record
tables
copy_records = lt_komv
exceptions
....
call function 'RV_CONDITION_SAVE'.
call function 'RV_CONDITION_RESET'.
necessary to write data
commit work.
Check data with transaction VK12
I hope it will helps you
Regards Rk
null
03-16-2007 8:54 AM
Hi Ashish..and with regards to the requirement that you have mentioned..Is this thing done so as to maintain the price change History in SAP ?
Awaiting a reply from you at the earliest..Thanks
05-11-2007 10:01 AM
sorry for relying so late .
but the requirementthat we had is for bdc and it is sucessfully working
i was seraching for a bapi just for the sake of my knowledge in case i could improve the performance of my code better
i didinot tried bapi got busy in other works
10-26-2007 2:25 AM
I am using the RV_condition_copy function the way it is described in this post, I am able to update the date but not the price in Vk12 / vk13 . I am using option D for maintain_mode (create with reference) - > this is essentially what I want to do, as we already ahve the pricing in vk13, we want to change it for year 2008.
Please advise what I must be doing wrong. I do not get any errors while running the following code. Also I am doing commit. Thanks.
Pranav
Do I have to pass any values to I_komk I_komp, i do not have anything to pass.??!$#?
ls_komg-kunnr = '0001000008'. " Cust number
ls_komg-matnr = 'PP500P3'. " Mat number
ls_komg-VKORG = 'PPC1'.
ls_komg-vtweg = 'BB'.
clear: Lt_komv,LS_KOMV.
ls_komv-kappl = 'V '. " Application V = Sales
ls_komv-kschl = 'PR00'. " Condition type
ls_komv-waers = 'USD'. " Currency
ls_komv-kmein = 'EA'. " Unit of measurement
ls_komv-kpein = '100'.
ls_komv-krech = 'C'. " calculation type;
"M = Quantity - monthy price
LS_KOMV-KAWRT = '251.00'.
ls_komv-kbetr = '121.50'. " new condition value
*LS_KOMV-KWERT_K = '251.10'.
*LS_KOMV-KNUMV ='0000008911'
append ls_komv to lt_komv.
CLEAR LT_KOMV.
call function 'RV_CONDITION_COPY'
exporting
application = 'V'
condition_table = '005' " cond. table
condition_type = 'PR00' " cond. type
date_from = '20070108' " valid on
date_to = '99991231' " valid to
enqueue = 'X' " lock entry
i_komk = ls_komk
i_komp = ls_komp
key_fields = ls_komg " key fields
maintain_mode = 'D' " A= create
" B= change,
" C= display
" D= create with reference
with reference
no_authority_check = 'X'
keep_old_records = 'X'
overlap_confirmed = 'X'
no_db_update = space
importing
e_komk = ls_komk
e_komp = ls_komp
new_record = lv_new_record
tables
copy_records = lS_komv
EXCEPTIONS
ENQUEUE_ON_RECORD = 1
INVALID_APPLICATION = 2
INVALID_CONDITION_NUMBER = 3
INVALID_CONDITION_TYPE = 4
NO_SELECTION = 5
TABLE_NOT_VALID = 6
NO_AUTHORITY_EKORG = 7
NO_AUTHORITY_KSCHL = 8.
....
call function 'RV_CONDITION_SAVE'.
call function 'RV_CONDITION_RESET'.
necessary to write data
commit work.
Message was edited by:
pranav kulkarni
09-01-2011 2:10 PM
04-11-2008 9:00 PM
Hi,
Does this FM RV_CONDITION_COPY work for multiple records. I tried it and it doesn't seem to work. It only takes the last record from the internal tables.
Can you help on this?
Thanks,
VS
05-01-2009 1:18 AM
Apparently the function module works when used once a time for condition record. So in my code I am looping on condition records as I update and commit at the end.
Regards,
Kartik N.