2014 Jul 08 7:55 AM
when i am execute me51n that time no value is fetched in lv_bwtty and lv_bwtar from mbew.
DATA: lw_req_item TYPE mereq_item,
lv_bwtar TYPE bwtar_d, " valuation type
lv_bwtty TYPE bwtty_d. " valuation catagory
CLEAR: lw_req_item,lv_bwtar,lv_bwtty.
* DATA:
* bwtar TYPE MBEW-bwtar,
* bwtty TYPE MBEW-bwtty.
IF im_item IS NOT INITIAL.
CALL METHOD im_item->get_data
RECEIVING
re_data = lw_req_item.
ENDIF.
IF sy-tcode EQ 'ME51N' AND lw_req_item IS NOT INITIAL.
SELECT SINGLE bwtar bwtty FROM mbew INTO (lv_bwtar , lv_bwtty)
WHERE matnr = lw_req_item-matnr AND bwkey = lw_req_item-werks.
* AND bwtty = 's' OR bwtty = 'b' OR bwtty = 'k' OR bwtty = 'z' OR bwtty = ' '.
IF sy-subrc EQ 0.
IF lv_bwtty = 'S' OR lv_bwtty = 'b' OR lv_bwtty = 'k' OR lv_bwtty = 'z' OR lv_bwtty = ' ' AND lv_bwtar <> lw_req_item-bwtar.
MESSAGE 'valuation type does not exits in Material Master' TYPE 'E'.
ENDIF.
ENDIF.
ENDIF.
ENDMETHOD.
how can i resolve that issue..
2014 Jul 08 8:13 AM
2014 Jul 08 8:48 AM
2014 Jul 08 2:00 PM
i am not changing the field BWTTY to accept lowercase characters So why do you use lowercase values in the where option, very low chance of success ('z' is not 'Z')
Also don't check sy-tcode but use IM_TRTYP but i didnt understandLook at method OPEN parameters, read parameter documentation, and store it value in an instance attribute of the implementing class.
Regards,
Raymond
2014 Jul 08 8:24 AM
Hi,
Did you check lw_req_item? was it filled?
If yes,
Confirm that mbew table has got record corresponding to the condition
matnr = lw_req_item-matnr
AND bwkey = lw_req_item-werks.
Note : Field bwkey can be Plant or Company Code.
2014 Jul 08 8:45 AM
lw_req_item is filled showing but in select query nothing is fetched
2014 Jul 08 9:11 AM
Go to se16 take table MBEW input value for matnr and bwkey, now check values corresponding to it.
If it has any data against the inputted matnr and bwkey, please give me a snap(from debugger) of values in matnr and bwkey in work area.
2014 Jul 08 8:29 AM
You are comparing plant with valuation area in your select query.
Use table T001W to read valuation area.
2014 Jul 08 8:45 AM
Hi Kaustav,
Do u use Check Method for validation?
If not Please add your code in Check Method and use conversion for Material using FM CONVERSION_EXIT_MATN1_OUTPUT and after that pass your value in MBEW. Pass Hard coded Character value in Capital Letter for BWTTY condition check .
Remaining you can check in debugging after activation where you miss the value.
Regards,
Prasenjit
2014 Jul 08 8:46 AM
2014 Jul 08 8:49 AM
Hi, Kaustav,
Check the material value is same as the mbew table content.
if not use fm CONVERSION_EXIT_ALPHA_INPUT.
try to use all key fields for select single or use into table.
SELECT SINGLE bwtar bwtty FROM mbew INTO (lv_bwtar , lv_bwtty)
WHERE matnr = lw_req_item-matnr AND bwkey = lw_req_item-werks.
check sy-subrc 0.
IF lv_bwtty = 'S' OR lv_bwtty = 'b' OR lv_bwtty = 'k' OR lv_bwtty = 'z' OR lv_bwtty = ' ' AND lv_bwtar <> lw_req_item-bwtar.
exit.
ENDIF.
endselect.
Regards,
Venkat.
2014 Jul 08 9:38 AM
Hi Kaustav,
Also use BWTAR field in where condition to get the unique record. Please check if material number require conversions. You can use FM CONVERSION_EXIT_MATN1_INPUT for material conversion.
I think the entry in MBEW is not correct as value of Valuation Area is blank there.You delete that wrong entry and test with valid test data.
Regards,
Pravin
2014 Jul 08 1:46 PM
NOW PLANT 5100 IS WORKING BUT PLANT 5200 IS NOT WORKING FOR THE SAME CODE
DATA: lw_req_item TYPE mereq_item,
lv_bwtar TYPE bwtar_d, " valuation type
lv_bwtty TYPE bwtty_d. " valuation catagory
DATA: bwtar TYPE MBEW-bwtar,
bwtty TYPE MBEW-bwtty.
CLEAR: lw_req_item,lv_bwtar,lv_bwtty.
IF im_item IS NOT INITIAL.
CALL METHOD im_item->get_data
RECEIVING
re_data = lw_req_item.
ENDIF.
IF sy-tcode EQ 'ME51N' AND lw_req_item IS NOT INITIAL and lw_req_item-werks = '5100' or lw_req_item-werks = '5200'.
SELECT single bwtar bwtty FROM mbew INTO (lv_bwtar , lv_bwtty)
WHERE matnr = lw_req_item-matnr AND bwkey = lw_req_item-werks and bwtar = lw_req_item-bwtar.
* AND bwtty = 's' OR bwtty = 'b' OR bwtty = 'k' OR bwtty = 'z' OR bwtty = ' '.
* IF lv_bwtty = 'S' OR lv_bwtty = 'b' OR lv_bwtty = 'k' OR lv_bwtty = 'z' OR lv_bwtty = ' ' AND lv_bwtar <> lw_req_item-bwtar.
IF lv_bwtar <> lw_req_item-bwtar.
MESSAGE 'valuation type does not exits in Material Master' TYPE 'E'.
ENDIF.
ENDIF.
ENDMETHOD.
HOW TO RESOLVE IT
2014 Jul 08 2:37 PM
Hi Kaustav,
Check the non initiallity of lw_req_item-matnr , lw_req_item-werks and w_req_item-bwtar before executing the select query. If all looks good then please validate with the same combination is that any entry available in MBEW table.
there might be the case where all or any of this parameter are with null value and in MBEW table with the same combination some blank entries are existing.
Since you are reading the select single might be those blank values are getting selected.Please verify in Debugging mode.
Regard's
U.Sahu