Skip to Content
0
Former Member
Jul 12, 2012 at 05:56 PM

Help with RV_CONDITION_COPY

776 Views

Hi,

I have a strange problem with RV_CONDITION_COPY function module..

I did research in forum but no useful.

Actually i am trying to create condition record from VK11 T.code

with key combination of SALESAREA / Customer.

I have passed all required parameters but record is not creating and sy-subrc also ZERO.

Can anybody have a look on my code and sugget me if there is any modifications.

CONSTANTS : lc_kschl TYPE t685a-kschl VALUE 'ZPDT'.

DATA : ls_komk TYPE komk,

ls_komp TYPE komp,

ls_keyfields TYPE komg,

lv_new_record TYPE c,

ls_komv TYPE komv,

ls_pispr TYPE pispr,

lt_komv TYPE STANDARD TABLE OF komv.

CLEAR ls_keyfields.

ls_keyfields-vkorg = '1000'.

ls_keyfields-vtweg = '20'.

ls_keyfields-auart = 'ZOR'.

ls_keyfields-kunnr = '0000050013'.

ls_keyfields-kdatu = sy-datum.

CLEAR: ls_komv,lt_komv.

ls_komv-kappl = 'V '. " Application V = Sales

ls_komv-kschl = lc_kschl. " Condition type

ls_komv-kdatu = '20990709'.

ls_komv-kunnr = '0000050013'.

ls_komv-krech = 'A'. " calculation type;

ls_komv-kbetr = '-5.000'.

* ls_komv-konwa = '%'. " Currency OR percentage

* ls_komv-kmein = 'ST'. " Unit of measurement

* ls_komv-kpein = '1'.

APPEND ls_komv TO lt_komv.

 

ls_pispr-kunnr = '0000050013'.

ls_pispr-matnr = 'KPARTS'.

ls_pispr-vkorg = '1000'.

ls_pispr-vtweg = '20'.

CALL FUNCTION 'SPR_KOMK_KOMP_FILL'

EXPORTING

pi_i_spr = ls_pispr

IMPORTING

pe_i_komk = ls_komk

pe_i_komp = ls_komp.

CALL FUNCTION 'RV_CONDITION_COPY'

EXPORTING

application = 'V'

condition_table = '937'

condition_type = lc_kschl

date_from = sy-datum

date_to = '20990709'

enqueue = 'X'

i_komk = ls_komk

i_komp = ls_komp

key_fields = ls_keyfields

maintain_mode = 'A'

no_authority_check = 'X'

no_field_check = 'X'

keep_old_records = 'X'

* overlap_confirmed = 'X'

* no_db_update = space

selection_date = sy-datum

IMPORTING

e_komk = ls_komk

e_komp = ls_komp

new_record = lv_new_record

TABLES

copy_records = lt_komv

EXCEPTIONS

enqueue_on_record = 1

invalid_application = 2

invalid_condition_number = 3

invalid_condition_type = 4

no_authority_ekorg = 5

no_authority_kschl = 6

no_authority_vkorg = 7

no_selection = 8

table_not_valid = 9

no_material_for_settlement = 10

no_unit_for_period_cond = 11

no_unit_reference_magnitude = 12

invalid_condition_table = 13

OTHERS = 14.

IF sy-subrc <> 0.

* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

CALL FUNCTION 'RV_CONDITION_SAVE'.

COMMIT WORK.

CALL FUNCTION 'RV_CONDITION_RESET'.

COMMIT WORK.

Thanks,

Palvadi