08-24-2011 6:50 AM
Hi Everybody,
I have successfully created Rebate Agreements using BAPI namely BAPI_AGREEMENTS.
Now i want to create Condition Records for created Rebate Agreements.
Is there be any Standard Function Module or BAPI available for this ?
T Code VBO1
Edited by: SAP_USER_CK on Aug 24, 2011 7:54 AM
Edited by: SAP_USER_CK on Aug 24, 2011 12:17 PM
08-24-2011 12:25 PM
" creating rebate agreement number and condition number
CALL FUNCTION 'NUMBER_GET_NEXT'
EXPORTING
nr_range_nr = '01'
object = 'BONUS'
IMPORTING
number = lv_assign_num
EXCEPTIONS
interval_not_found = 01
number_range_not_intern = 02
object_not_found = 03.
CALL FUNCTION 'NUMBER_GET_NEXT'
EXPORTING
nr_range_nr = '01'
object = 'KONH'
" Call this FM, YOU NEED TO FILL ALL THE INTERNAL TABLE
" DEBUG and check all the possible value and fill it
CALL FUNCTION 'SD_CONDITION_SAVE_EXIT'
EXPORTING
change_docs_write = lv_true
TABLES
db_time = lt_time
db_xkonh = lt_xkonh
db_ykonh = lt_ykonh
db_xkonp = lt_xkonp
db_ykonp = lt_ykonp
db_xstaf = lt_xstaf
db_ystaf = lt_ystaf
db_xkondat = lt_xkondat
db_ykondat = lt_ykondat
db_xvake = lt_xvake.
" and then call
CALL FUNCTION 'RV_KONDITION_SICHERN_V13A'
EXPORTING
change_docs_write = lv_true
use_outbound_call = lv_true
TABLES
db_time = lt_time
db_xkonh = lt_xkonh
db_ykonh = lt_ykonh
db_xkonp = lt_xkonp
db_ykonp = lt_ykonp
db_xstaf = lt_xstaf
db_ystaf = lt_ystaf
db_xkondat = lt_xkondat
db_ykondat = lt_ykondat
db_xvake = lt_xvake
EXCEPTIONS
exc_cacs_versioning_badi = 1
OTHERS = 2.
"and then call
CALL FUNCTION 'RV_KONDITION_SICHERN_BONUS'
EXPORTING
active_kona = ls_kona
old_kona = ls_kona
update_sign = iv_action
change_docs_write = lv_true
use_outbound_call = lv_true.
" THIS CODE HAS BEEN EXTRACTED AFTER DEBUGGING THE STANDARD TCODE VBO1..
" WORKS FINE
" THE ONLY PROBLEM IS YOU NEED TO DEBUG AND FILL THE APPROPROATE VALUES IN THE INTERNAL TABLES