07-08-2012 9:27 AM
Hi,
I am searching for bapi for creating pricing condition records.
I found here Bapi: BAPI_PRICES_CONDITIONS
but can't find where i can insert sales organization and distribution channel.
Is there a bapi that i can insert also those fileds ?
Thanks .
07-09-2012 5:19 AM
Instead of using BAPI_PRICES_CONDITIONS, use the following fms.
In fm RV_CONDITION_COPY, you can insert the sales org and distribution channel in key_fields with data structure KOMG. See below:
DATA: lt_komg TYPE TABLE OF komg,
ls_komg LIKE LINE OF lt_komg.
....
ls_komg-vkorg = '1001'.
ls_komg-vtweg = '10'.
ls_komg-pltyp = p_pltyp.
ls_komg-matnr = p_matnr.
ls_komg-kfrst = ''.
APPEND ls_komg TO lt_komg.
....
" call FMs
CALL FUNCTION 'RV_CONDITION_COPY'
EXPORTING
....
key_fields = ls_komg " key fields
maintain_mode = 'B' " A= create
" B= change,
" C= display
" D= create
...
Regards,
Jake
07-08-2012 9:44 AM
07-08-2012 1:56 PM
07-09-2012 5:19 AM
Instead of using BAPI_PRICES_CONDITIONS, use the following fms.
In fm RV_CONDITION_COPY, you can insert the sales org and distribution channel in key_fields with data structure KOMG. See below:
DATA: lt_komg TYPE TABLE OF komg,
ls_komg LIKE LINE OF lt_komg.
....
ls_komg-vkorg = '1001'.
ls_komg-vtweg = '10'.
ls_komg-pltyp = p_pltyp.
ls_komg-matnr = p_matnr.
ls_komg-kfrst = ''.
APPEND ls_komg TO lt_komg.
....
" call FMs
CALL FUNCTION 'RV_CONDITION_COPY'
EXPORTING
....
key_fields = ls_komg " key fields
maintain_mode = 'B' " A= create
" B= change,
" C= display
" D= create
...
Regards,
Jake
07-09-2012 6:46 AM
Hi Jake,
When i create a Purchase order i have to make an automatic down payment request (F-47), i'm working with BAPI_PAYMENTREQUEST_CREATE bapi from the PO transaction. Anybody have a code example on how to use this BAPI with PO?
How to create auto trigger of down payment request from PO ??
07-09-2012 7:51 AM
Hi Jake,
Thank you for the response.
Should i use all the three FM :
Is there any sample code / program which i can use for this matter.
The requirement is that the user will give a price to material number and than in the background VK11 will work.
Thanks.
07-09-2012 8:02 AM
Hi,
Please try this.
DATA: BEGIN OF ls_komk OCCURS 10.
INCLUDE STRUCTURE komk.
DATA: END OF ls_komk.
DATA:ls_komg TYPE komg.
DATA: BEGIN OF ls_komv OCCURS 10.
INCLUDE STRUCTURE komv.
DATA: END OF ls_komv.
DATA: BEGIN OF lt_komv OCCURS 0.
INCLUDE STRUCTURE komv.
DATA: END OF lt_komv.
DATA:
komk TYPE komk ,
komp TYPE komp .
ls_komg-matnr = <material>.
ls_komg-vkorg = <sales org>.
ls_komg-vtweg = <dist chn>.
CLEAR: lt_komv,ls_komv.
ls_komv-kappl = 'V'. " Application V = Sales
ls_komv-kschl = <>. " Condition type
ls_komv-knumh = <condition record number>.
ls_komv-krech = <>. " calculation type;
ls_komv-kbetr = <>.
ls_komv-kmein = <>.
ls_komv-kpein = <>.
ls_komv-waers = <>.
ls_komv-updkz = 'I'.
APPEND ls_komv TO lt_komv.
CLEAR lt_komv.
DATA wa_pispr TYPE pispr.
wa_pispr-matnr = <>.
wa_pispr-vkorg = <>.
wa_pispr-vtweg = <>.
CALL FUNCTION 'SPR_KOMK_KOMP_FILL'
EXPORTING
pi_i_spr = wa_pispr
IMPORTING
pe_i_komk = komk
pe_i_komp = komp.
CALL FUNCTION 'RV_CONDITION_COPY'
EXPORTING
application = 'V'
condition_table = ' ' " 3 character cond. table
condition_type = ' ' " cond. type
date_from = '20120101' " valid on
date_to = '99991231' " valid to
enqueue = 'X' " lock entry
i_komk = komk
i_komp = komp
key_fields = ls_komg " key fields
maintain_mode = 'B' " A= create " B= change, " C= display " D= create
no_authority_check = 'X'
selection_date = '20120101' " valid on
keep_old_records = ' '
overlap_confirmed = 'X'
no_db_update = space
IMPORTING
e_komk = komk
e_komp = 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_selection = 5
table_not_valid = 6
no_authority_ekorg = 7
no_authority_kschl = 8.
IF sy-subrc = 0.
CALL FUNCTION 'RV_CONDITION_SAVE'.
COMMIT WORK.
CALL FUNCTION 'RV_CONDITION_RESET'.
"necessary to write data
COMMIT WORK.
WRITE:/ 'Success'.
ELSE.
WRITE: / 'Error'.
ENDIF.
Cheers
~Niranjan
07-09-2012 8:27 AM
Hi Gil,
Please don't ask for the code. This forum highly discouraged spoon feeding. Just show us what you have gone so far. Then we will try to help you. Search first for any related topics, threads, etc. Actually, there are 117 results regarding on fm RV_CONDITION_COPY by using SCN search help tool and 1540 results in google search. Just be resourceful.
Regards,
Jake
06-29-2016 3:25 PM