Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

purchase requsition enhancement problem

Former Member
0 Likes
2,381

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..

13 REPLIES 13
Read only

RaymondGiuseppi
Active Contributor
0 Likes
2,318
  • Try using parentheses in your where clauses .
  • Did you change the field BWTTY to accept lowercase characters ?
  • Also don't check sy-tcode but use IM_TRTYP.


Regards,

Raymond

Read only

0 Likes
2,318
  • i am not changing the field BWTTY to accept lowercase characters
  • Also don't check sy-tcode but use IM_TRTYP but i didnt understand
Read only

0 Likes
2,318
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 understand

Look at method OPEN parameters, read parameter documentation, and store it value in an instance attribute of the implementing class.


Regards,

Raymond

Read only

former_member202818
Active Contributor
0 Likes
2,318

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.

Read only

0 Likes
2,318

lw_req_item is filled showing but in select query nothing is fetched

Read only

0 Likes
2,318

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.

Read only

Former Member
0 Likes
2,318

You are comparing plant with valuation area in your select query.

Use table T001W to read valuation area.

Read only

Former Member
0 Likes
2,318


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

Read only

0 Likes
2,318

can you explain or send me for the check method code

Read only

VenkatRamesh_V
Active Contributor
0 Likes
2,318

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.

Read only

Former Member
0 Likes
2,318

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

Read only

Former Member
0 Likes
2,318

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

Read only

0 Likes
2,318

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