Code: Alles auswählen.
*&---------------------------------------------------------------------*
*& Report ZBL_TEST_RV_IDOC2
*&---------------------------------------------------------------------*
report zbl_test_rv_idoc2.
call function 'RV_CONDITION_RESET'.
commit work and wait.
constants: c_matnr(18) value '000000000001400525'.
data:
cr like table of komv with header line, " copy_records
nr, " new record
key_fields like table of komg with header line,
komk like table of komk with header line,
komp like table of komp with header line.
key_fields-mandt = '002'. " OK
key_fields-vkorg = '0380'. " OK
key_fields-vtweg = '10'. " OK
key_fields-konda = '01'. " OK
* key_fields-werks = '1000'. " ?
* key_fields-spart = '01'. " ?
* key_fields-kunnr = '0000151935'. " ?
key_fields-matnr = c_matnr. " OK
* key_fields-kdatu = sy-datum. " ??
*********************************************************
* Neue Informationen zum Konditinssatz:
cr-mandt = '002'.
cr-kappl = 'V'. " OK
cr-kschl = 'VKP0'. " OK
cr-kbetr = '66.77'. " OK
* cr-knumh = '0000380829'.
* cr-kposn = '000000'.
*cr-stfkz = 'A'.
*cr-krech = 'B'.
*cr-konws = 'CHF'.
cr-kdatu = '20150205'. " OK
* cr-kunnr = '0000151935'. " ??
* cr-kpein = '1'. " OK
* cr-kmein = ' '. " OK
cr-kumza = 1.
cr-kumne = 1.
cr-waers = 'EUR'. " OK
cr-knumh = '1'.
cr-kopos = '01'.
append cr.
**********************************************************
* KOMK/KOMP Fuellen
data wa_pispr like table of pispr with header line.
* wa_pispr-kunnr = '0000151935'. " ??
wa_pispr-matnr = c_matnr. " OK
wa_pispr-vkorg = '0380'. " OK
wa_pispr-vtweg = '10'. " BL
append wa_pispr.
***call function 'SPR_KOMK_KOMP_FILL'
*** exporting
*** pi_i_spr = wa_pispr
*** importing
*** pe_i_komk = komk
*** pe_i_komp = komp.
* --> KOMK/KOMP werden korrekt gefüllt. Funktion i.o.
**********************************************************
komk-mandt = sy-mandt.
komk-vkorg = '0380'.
komk-vtweg = '10'.
komk-konda = '01'.
komk-erdat = sy-datum.
komk-kvorg = '01'.
komk-hwaer = 'EUR'.
komk-waerk = 'EUR'.
komk-kappl = 'V'.
* Oberen Aufruf (FuBa) ignorieren
clear komp.
komp-kposn = '000001'.
komp-matnr = c_matnr.
*komp-meins = 'ST'.
*komp-mglme = 1.
call function 'RV_CONDITION_COPY'
exporting
application = 'V' " OK
condition_table = '032' " OK
condition_type = 'VKP0' " OK
date_from = '20150105' " OK
date_to = '20150115' " OK
* date_from = '20150205' " OK
* date_to = '20150209' " OK
enqueue = 'X'
i_komk = komk
i_komp = komp
key_fields = key_fields
maintain_mode = 'A'
no_authority_check = 'X'
no_field_check = 'X'
keep_old_records = ' '
overlap_confirmed = 'X'
used_by_idoc = ' '
importing
e_komk = komk
e_komp = komp
new_record = nr
tables
copy_records = cr
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.
commit work and wait. " BL
* SET UPDATE TASK LOCAL.
call function 'RV_CONDITION_SAVE'
exporting
i_knumh = '1'
i_no_posting = 'X'.
Code: Alles auswählen.
*&---------------------------------------------------------------------*
*& Report YSD_COND_TEST
*& Example how to call RV_CONDITION_COPY
*&---------------------------------------------------------------------*
*& Comments:
*& maintain_mode:
*& A = Adding 'A'
*& B = Changing 'B'.
*& C = Displaying
*& D = Create with reference
*&
*& key_fields: check keys of the condition table and access sequence!
*&---------------------------------------------------------------------*
REPORT ysd_cond_test.
DATA:
ls_keys TYPE komg,
komk LIKE TABLE OF komk WITH HEADER LINE,
komp LIKE TABLE OF komp WITH HEADER LINE,
ls_komv TYPE komv,
lt_komv TYPE TABLE OF komv.
PARAMETER: p_matnr TYPE matnr VALUE CHECK,
p_vkorg TYPE vkorg VALUE CHECK,
p_vtweg TYPE vtweg VALUE CHECK,
p_kbetr TYPE kbetr VALUE CHECK DEFAULT '100.00',
p_waers TYPE waers VALUE CHECK DEFAULT 'EUR',
p_kmein TYPE kmein VALUE CHECK DEFAULT 'ST',
p_kpein TYPE kpein VALUE CHECK DEFAULT '1',
p_kschl TYPE kschl VALUE CHECK DEFAULT 'VKP0',
p_kotab TYPE vake-kotabnr DEFAULT '073',
p_datab TYPE datab VALUE CHECK DEFAULT '20150101',
p_datbi TYPE datbi VALUE CHECK DEFAULT '20150430'.
.
CALL FUNCTION 'RV_CONDITION_RESET'
* EXPORTING
* FREE_MEMORY =
.
ls_keys-matnr = p_matnr.
ls_keys-vkorg = p_vkorg.
ls_keys-vtweg = p_vtweg.
CLEAR ls_komv.
REFRESH lt_komv.
ls_komv-kbetr = p_kbetr.
ls_komv-waers = p_waers.
ls_komv-kpein = p_kpein.
ls_komv-kmein = p_kmein.
ls_komv-kschl = p_kschl.
APPEND ls_komv TO lt_komv.
CALL FUNCTION 'RV_CONDITION_COPY'
EXPORTING
application = 'V'
condition_table = p_kotab
condition_type = p_kschl
date_from = p_datab
date_to = p_datbi
* ENQUEUE = ' '
* I_KOMK = ' '
* I_KOMP = ' '
key_fields = ls_keys
maintain_mode = 'A'
* NO_AUTHORITY_CHECK = ' '
* NO_FIELD_CHECK = ' '
* SELECTION_DATE = '00000000'
* KEEP_OLD_RECORDS = ' '
* MATERIAL_M =
* USED_BY_IDOC = ' '
* I_KONA =
* OVERLAP_CONFIRMED = ' '
* NO_DB_UPDATE = ' '
* USED_BY_RETAIL = ' '
* IMPORTING
* E_KOMK =
* E_KOMP =
* NEW_RECORD =
* E_DATAB =
* E_DATBI =
* E_PRDAT =
TABLES
copy_records = lt_komv
* COPY_STAFFEL =
* COPY_RECS_IDOC =
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.
* Implement suitable error handling here
ENDIF.
IF sy-subrc = 0.
CALL FUNCTION 'RV_CONDITION_SAVE'.
COMMIT WORK AND WAIT.
ELSE.
WRITE:/ sy-subrc.
ENDIF.