2008 Mar 05 10:03 AM
Hello experts
i need to implement BADI - ME_REQ_POSTED to change some fields in purchase request when save,
But i have some problem to change structure IM_EBAN.
this is the code
data: l_IM_EBAN2 like line of IM_EBAN.
loop at IM_EBAN into l_im_eban2.
clear l_im_eban2-afnam.
modify im_eban from l_im_eban2.
endloop.
But i have msg:The field "IM_EBAN" cannot be changed. -
How can i change this field?
Thanks in advice
B.
2013 Jan 11 1:47 PM
Hi,
ME too getting same problem, Please suggest me.
Thanks&Regards,
Gopi .M
2013 Jan 11 2:31 PM
Hello Boris,
If you want to change the values while saving PR, its better to implement ME_PROCESS_REQ_CUST rather than ME_REQ_POSTED coz in POST method, I think you can validate but changing the values is not possible in either of the BADI's.
Check the sample following code to change values before SAVE :
Its a sample code, in this Im changing the Quantity of the PR as per the Material Characteristics
DATA : ls_citem TYPE mereq_item,
ls_pitem TYPE mereq_item,
ls_client TYPE bapi_mara_ga,
lt_units TYPE TABLE OF bapi_marm_ga,
ls_units TYPE bapi_marm_ga,
lv_answer TYPE c,
lv_menge TYPE bamng,
lv_ques TYPE string,
lv_temp1 TYPE string,
lv_temp2 TYPE string,
lt_message TYPE bssp_t_message.
** Multily Quantity with Base Quantity for Materials of type Z123
CHECK im_count EQ 1. " This need to be checked bcoz the same method will call multiple times
CALL METHOD im_item->get_data
RECEIVING
re_data = ls_citem.
CALL METHOD im_item->get_previous_data
RECEIVING
re_data = ls_pitem.
IF ls_citem-menge IS NOT INITIAL AND ls_citem-menge <> ls_pitem-menge.
CLEAR ls_client.
REFRESH lt_units.
CALL FUNCTION 'BAPI_MATERIAL_GET_ALL'
EXPORTING
material = ls_citem-matnr
comp_code = ls_citem-werks
IMPORTING
clientdata = ls_client
TABLES
unitsofmeasure = lt_units.
IF ls_client-matl_type EQ 'Z123'.
READ TABLE lt_units INTO ls_units WITH KEY alt_unit = ls_client-po_unit.
IF sy-subrc EQ '0'.
CLEAR : lv_menge, lv_ques, lv_temp1, lv_temp2.
lv_menge = ls_citem-menge * ls_units-numerator.
MOVE ls_citem-menge TO lv_temp1.
MOVE lv_menge TO lv_temp2.
CONCATENATE 'Quantity' lv_temp1 'will be converted to' lv_temp2 'as per Material Chrst.' INTO lv_ques SEPARATED BY space.
CALL FUNCTION 'KLPOPUP_TO_DISPLAY_TEXT'
EXPORTING
titel = 'Note'
textline1 = lv_ques.
ls_citem-menge = lv_menge.
CALL METHOD im_item->set_data
EXPORTING
im_data = ls_citem.
ENDIF.
ENDIF.
ENDIF.
Hopefully it helps!!!
Rgrds,
Sravan
2013 Jan 12 7:11 AM
Hi Sravan,
Is it useful to change Purchase req. quantity which are currently creating PR.
And i'm using Badi MD_PURREQ_POST.
Kindly suggest me.
Thanks&Regards,
Gopi
2013 Jan 12 7:34 AM
Hi Boris,
ME_REQ_POSTEDhas only Post method.
Use BADI ME_PROCESS_REQ - PROCESS_ITEM method from the method parameters u wcan go to another inteface there we will have SET_DATA for a item.
Hope this helps.
Let me knw if additional info is required.
Thanks,
Tooshar Bendale
2013 Jan 12 10:24 AM
Hi Boris,
Thank you for reply. In BADI ME_PROCESS_REQ may have to implement new method .
Please confirm and explain the process.
Thanks&Regards,
Gopi.
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |