I have seen many people had question about creating scales prices using the function module RV_CONDITION_COPY. However I did not find the answer.
The below sample code will help you load the sales prices including scales. Hope this hepls :smile: .
***********************************************************************************
* This sample program can create sales price including scales.
* Author: Murali Mikkili
REPORT zz_apct_upload_new_cond_fm.
*- Data
DATA: cr LIKE TABLE OF komv WITH HEADER LINE,
key_fields LIKE TABLE OF komg WITH HEADER LINE,
ls_komk TYPE komk,
ls_komp TYPE komp,
copy_staffel LIKE TABLE OF condscale WITH HEADER LINE,
lt_knumh TYPE STANDARD TABLE OF knumh_comp,
t_komv_idoc LIKE TABLE OF komv_idoc WITH HEADER LINE.
*- Fill Key fields
CALL FUNCTION 'SD_CONDITION_KOMG_FILL'
EXPORTING
p_kotabnr = '304'
p_kvewe = 'A'
p_vakey = '100010F-01'
IMPORTING
p_komg = key_fields.
*- Fill KOMK
MOVE-CORRESPONDING key_fields TO ls_komk.
ls_komk-mandt = sy-mandt.
*- Fill KOMP
MOVE-CORRESPONDING key_fields TO ls_komp.
ls_komp-kposn = '000001'.
*- Fill KOMV_IDOC
t_komv_idoc-kznep = 'X'.
APPEND t_komv_idoc.
*- Fill KOMV
cr-kappl = 'V'.
cr-kschl = 'PR00'.
cr-kbetr = '21'. " Unit Price
cr-krech = 'C'.
cr-kpein = '1'.
cr-kmein = 'EA'.
cr-waers = 'EUR'.
cr-knumh = '$000000001'.
cr-mandt = sy-mandt.
* Bellow are the important fields in KOMV for scales.
cr-kopos = 1.
cr-kzbzg = 'C'.
cr-konms = 'EA'.
cr-stfkz = 'A'.
APPEND cr.
* - Fill Scales
*- Scale Item 1
copy_staffel-klfn1 = '0001'.
copy_staffel-kopos = '01'.
copy_staffel-kstbm = '1'.
copy_staffel-kbetr = '21'. " Scale Price
copy_staffel-kzbzg = 'C'.
copy_staffel-rv13akonwa = 'EUR'.
copy_staffel-konpkmein = 'EA'.
copy_staffel-konpkonms = 'EA'.
APPEND copy_staffel.
*- Scales item 2
copy_staffel-klfn1 = '0002'.
copy_staffel-kopos = '01'.
copy_staffel-kstbm = '10'.
copy_staffel-kbetr = '18'. " Scale Price
copy_staffel-kzbzg = 'C'.
copy_staffel-rv13akonwa = 'EUR'.
copy_staffel-konpkmein = 'EA'.
copy_staffel-konpkonms = 'EA'.
APPEND copy_staffel.
*- Scales item 3
copy_staffel-klfn1 = '0003'.
copy_staffel-kopos = '01'.
copy_staffel-kstbm = '10'.
copy_staffel-kbetr = '14'. " Scale Price
copy_staffel-kzbzg = 'C'.
copy_staffel-rv13akonwa = 'EUR'.
copy_staffel-konpkmein = 'EA'.
copy_staffel-konpkonms = 'EA'.
APPEND copy_staffel.
CALL FUNCTION 'RV_CONDITION_COPY'
EXPORTING
application = 'V'
condition_table = '304'
condition_type = 'PR00'
date_from = '20131101'
date_to = '99991231'
enqueue = 'X'
i_komk = ls_komk
i_komp = ls_komp
key_fields = key_fields
maintain_mode = 'A'
no_authority_check = 'X'
* keep_old_records = 'X'
used_by_idoc = 'X' " when suppling scales prices, this flag must be X else price will be created with Zero price.
overlap_confirmed = 'X'
TABLES
copy_records = cr
copy_staffel = copy_staffel
copy_recs_idoc = t_komv_idoc
EXCEPTIONS
enqueue_on_record = 01
invalid_application = 02
invalid_condition_number = 03
invalid_condition_type = 04
no_authority_ekorg = 05
no_authority_kschl = 06
no_authority_vkorg = 07
no_selection = 08
table_not_valid = 09.
BREAK-POINT.
CALL FUNCTION 'RV_CONDITION_SAVE'
TABLES
knumh_map = lt_knumh.
CALL FUNCTION 'RV_CONDITION_RESET'.
COMMIT WORK AND WAIT.