2009 Sep 24 2:07 PM
Hi experts
I need change the pricing of an exiting order.
I would do this using the FM CRM_ORDER_MAINTAIN but it doesn't work....
Can anybody show me the right code for change princing using this FM??
best regards
Marco
2009 Sep 24 2:51 PM
Hi try this and let me know if fulfills your needs
ls_pridoc_tab-stunr = ln_cond-stunr.
ls_pridoc_tab-zaehk = ln_cond-zaehk.
ls_pridoc_tab-waers = ln_cond-waers.
ls_pridoc_tab-kbetr = '70'.
INSERT ls_pridoc_tab INTO TABLE lt_pridoc_tab.
ls_pridoc-ref_guid = ln_cond-kposn.
ls_pridoc-cond_change = lt_pridoc_tab.
INSERT ls_pridoc INTO TABLE lt_pridoc.
ls_input_field-ref_guid = ln_cond-kposn.
ls_input_field-ref_kind = 'B'.
ls_input_field-objectname = 'PRIDOC_COM'.
ls_field_name-fieldname = 'KBETR'.
INSERT ls_field_name INTO TABLE lt_field_name.
INSERT ls_input_field INTO TABLE lt_input_field.
REFRESH lt_field_name.
*
CALL FUNCTION 'CRM_ORDER_MAINTAIN'
EXPORTING
it_pridoc = lt_pridoc
CHANGING
ct_input_fields = lt_input_field.
IF sy-subrc EQ 0.
ls_header_guid = guid.
APPEND ls_header_guid TO lt_header_guid.
CALL FUNCTION 'CRM_ORDER_SAVE'
EXPORTING
it_objects_to_save = lt_header_guid
IMPORTING
et_saved_objects = gt_saved_objects.
COMMIT WORK.
ENDIF.
Bye
Il gemello disperso
Hi experts
I need change the pricing of an exiting order.
I would do this using the FM CRM_ORDER_MAINTAIN but it doesn't work....
Can anybody show me the right code for change princing using this FM??
best regards
Marco
2009 Sep 24 2:15 PM
Hello Mark
Are u looking for changing of a sales order, If so
Using fm BAPI_SALESORDER_CHANGE, we can change the pricing of a sales order.
Please let me know abt order type which u are looking for.
Regards.
2009 Sep 24 2:16 PM
hi BSVASU
Thanks for you reply
yes i'm trying to change a sales order, you can help me??
Marco
2009 Sep 24 2:37 PM
Hi Marc,
With the below pseudo code u can modify existing pricing of an order.
wa_cond-itm_number = Item no
wa_cond-cond_type = cond typel. " which u want to add up
wa_konv-kbetr = " The discount % value or the amount.
wa_cond-cond_value = .
APPEND wa_cond TO i_cond.
wa_condx-itm_number = 'xxx'
wa_condx-cond_type = 'xxxx'.
wa_condx-updateflag = 'X'.
wa_condx-cond_value = 'X'.
APPEND wa_condx TO i_condx.
CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
EXPORTING
salesdocument = " Order no
order_header_in = " heade
order_header_inx = " header
TABLES
return = li_return1
order_item_in = li_bapisditm
order_item_inx = li_bapisditmx
CONDITIONS_IN = i_cond
CONDITIONS_INX = i_condx.
Regards.
2009 Sep 24 2:51 PM
Hi try this and let me know if fulfills your needs
ls_pridoc_tab-stunr = ln_cond-stunr.
ls_pridoc_tab-zaehk = ln_cond-zaehk.
ls_pridoc_tab-waers = ln_cond-waers.
ls_pridoc_tab-kbetr = '70'.
INSERT ls_pridoc_tab INTO TABLE lt_pridoc_tab.
ls_pridoc-ref_guid = ln_cond-kposn.
ls_pridoc-cond_change = lt_pridoc_tab.
INSERT ls_pridoc INTO TABLE lt_pridoc.
ls_input_field-ref_guid = ln_cond-kposn.
ls_input_field-ref_kind = 'B'.
ls_input_field-objectname = 'PRIDOC_COM'.
ls_field_name-fieldname = 'KBETR'.
INSERT ls_field_name INTO TABLE lt_field_name.
INSERT ls_input_field INTO TABLE lt_input_field.
REFRESH lt_field_name.
*
CALL FUNCTION 'CRM_ORDER_MAINTAIN'
EXPORTING
it_pridoc = lt_pridoc
CHANGING
ct_input_fields = lt_input_field.
IF sy-subrc EQ 0.
ls_header_guid = guid.
APPEND ls_header_guid TO lt_header_guid.
CALL FUNCTION 'CRM_ORDER_SAVE'
EXPORTING
it_objects_to_save = lt_header_guid
IMPORTING
et_saved_objects = gt_saved_objects.
COMMIT WORK.
ENDIF.
Bye
Il gemello disperso
2009 Sep 24 2:54 PM
Hi
now it work....thanks for your help.....
best Regards Marco
2009 Nov 03 7:19 AM
Hi Pierluigi,
Can you please kindly give an rough example for adding one condition line?
Thanks a lot
Figured out by myself~
-Closed
Edited by: Shane Chen on Nov 3, 2009 9:21 AM
2009 Nov 03 9:20 AM
Hi Shane for add a condition use the code below
ls_cond_add-kschl = ln_product-kschl.
ls_cond_add-kbetr = ln_product-kbetr.
INSERT ls_cond_add INTO TABLE lt_cond_add.
ls_pridoc-ref_handle = counter.
ls_pridoc-cond_add = lt_cond_add.
INSERT ls_pridoc INTO TABLE lt_pridoc.
ln_field-ref_handle = counter.
ln_field-ref_kind = 'B'.
ln_field-objectname = 'PRIDOC_COM'.
ln_fname-fieldname = 'KBETR'.
INSERT ln_fname INTO TABLE tb_fname.
ln_fname-fieldname = 'WAERS'.
INSERT ln_fname INTO TABLE tb_fname.
ln_fname-fieldname = 'ZAEHK'.
INSERT ln_fname INTO TABLE tb_fname.
ln_fname-fieldname = 'STUNR'.
INSERT ln_fname INTO TABLE tb_fname.
ln_field-field_names = tb_fname.
INSERT ln_field INTO TABLE tb_field.
and call funciton
CALL FUNCTION 'CRM_ORDER_MAINTAIN'
EXPORTING
it_schedlin_i = tb_sched
it_partner = tb_part
it_orgman = tb_org
it_activity_i = tb_acti
it_status = tb_status
it_product_i = tb_prd
it_pridoc = lt_pridoc
* it_survey = tb_svy
* it_activity_i = tb_acti
CHANGING
ct_orderadm_h = tb_ordh
ct_orderadm_i = tb_ordi
ct_input_fields = tb_field
i hope it help you
Marco
| User | Count |
|---|---|
| 6 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |