Regarding Error message in ME_PROCESS_PO_CUST badi for validation.

hi Friends,
I am Using ME_PROCESS_PO_CUST badi for validation in Purchase order (ME21N),
For that I implemented PROCESS_ITEM method which fires during each row now i  add another validation in same implementation for plant  should be same through out the all line item. Now following code is woking fine but when for second line item user changese plant then it shows error message as per logic which is fine but even after changing plant to correct one the error message is still coming why is it so?
following is my current validation code
method IF_EX_ME_PROCESS_PO_CUST~PROCESS_ITEM.
  DATA:ls_poitem TYPE mepoitem,
       ls_poitem_set TYPE mepoitem.
  DATA:ls_poheader TYPE MEPOHEADER.
  DATA:lm_poheader TYPE ref to IF_PURCHASE_ORDER_MM.
  DATA:w_mara TYPE mara.
  DATA:IT_ZMMTBL039 TYPE STANDARD TABLE OF ZMMTBL039 ,
       WA_ZMMTBL039 TYPE ZMMTBL039 .
  DATA:ls_poitem1 TYPE mepoitem.
  DATA:V_KUNNR1 TYPE KNA1-KUNNR.
  DATA:V_KUNNR2 TYPE KNA1-KUNNR.
  DATA:W_WERKS(4),
       w_werks_tmp(4),
       w_flag(1).
  ls_poitem = im_item->get_data( ).
  lm_poheader = im_item->GET_HEADER( ).
  ls_poheader = lm_poheader->GET_DATA( ).
  IF ls_poitem-werks IS NOT INITIAL.
    w_werks = ls_poitem-werks.
    import w_flag to w_flag from MEMORY ID 'FLAG'.
    if w_flag is initial.
      w_flag = 'X'.
      EXPORT w_werks_tmp FROM w_werks TO MEMORY ID 'MEMO1'.
      export w_flag from w_flag to MEMORY ID 'FLAG'.
      clear: w_flag.
    endif.
  ENDIF.
  IMPORT w_werks_tmp TO w_werks FROM MEMORY ID 'MEMO1'.
break swaroopb.
  IF ls_poitem-werks NE w_werks.
      MESSAGE E010(zparts) with 'Different plants are not allowed in single PO.'.
  ENDIF.
  CLEAR: WA_ZMMTBL039,w_mara.
  REFRESH:IT_ZMMTBL039[] .
  SELECT *
    INTO TABLE IT_ZMMTBL039
    FROM ZMMTBL039
   WHERE bsart EQ ls_poheader-bsart.
  IF sy-subrc EQ 0.
    CLEAR: WA_ZMMTBL039,w_mara.
    SELECT SINGLE *
      INTO w_mara
      FROM mara
     WHERE matnr EQ ls_poitem-MATNR.
    IF SY-SUBRC EQ 0.
      READ TABLE IT_ZMMTBL039 INTO WA_ZMMTBL039 WITH KEY  bsart = ls_poheader-bsart
                                                          mtart = w_mara-mtart
                                                          spart = w_mara-spart.
      IF SY-SUBRC NE 0.
        MESSAGE E009(zparts) WITH ls_poitem-MATNR w_mara-spart ls_poheader-bsart .
      ENDIF.
    ENDIF.
  ENDIF.
end method

Hello Swarup
Since you want to compare all items together (having the same plant) I would suggest to implement this logic either in method CHECK or POST of the interface.
However, if you want to make your checks within the PROCESS_ITEM method then you should change your logic.
It does not make sense to work with the ABAP memory within a BAdI implementing class because the class itself is your "memory".
I would use the following logic to implement your validation:
  lo_poheader = im_item->get_header( ).  " retrieve header instance
  lt_items = lo_poheader->get_items( ).   " retrieve all items
  ls_detail_x = im_item->get_detail( ).  " details of currently processed item
  LOOP AT lt_items INTO ls_item.
    ls_detail = ls_item-item->get_detail( ).
    IF ( ls_detail-werks NE ls_detail_x-werks ).  " validation failed
    " do something...
   ENDIF.
  ENDLOOP.
However, I would prefer to do this kind of validation in CHECK or POST method.
Regards,
  Uwe

Similar Messages

  • I have OSX 10.7 Lion I set up a separate email account for my wife.  Now when she tries to enter a website we get the following error message:  Java Script: Not Null validator already loaded.  The website never opens and it is difficult to get out of:

    I have OSX 10.7 Lion.  I set up a separate email account for my wife.  All of a sudden when she tries to enter and website from email we get the following error message.  JavaScript;  The notnull validator has already been loaded.  From there we can't seem to go any where.  When you hit OK it just keeps appearing and the only way to get out of it is to quit Safai.  If you try and got directly to Safari you get the same error message and can't go any further.  Please help.

    What you are experiencing is 100% related to Malware.
    Sometimes a problem with Firefox may be a result of malware installed on your computer, that you may not be aware of.
    You can try these free programs to scan for malware, which work with your existing antivirus software:
    * [http://www.microsoft.com/security/scanner/default.aspx Microsoft Safety Scanner]
    * [http://www.malwarebytes.org/products/malwarebytes_free/ MalwareBytes' Anti-Malware]
    * [http://support.kaspersky.com/faq/?qid=208283363 TDSSKiller - AntiRootkit Utility]
    * [http://www.surfright.nl/en/hitmanpro/ Hitman Pro]
    * [http://www.eset.com/us/online-scanner/ ESET Online Scanner]
    [http://windows.microsoft.com/MSE Microsoft Security Essentials] is a good permanent antivirus for Windows 7/Vista/XP if you don't already have one.
    Further information can be found in the [[Troubleshoot Firefox issues caused by malware]] article.
    Did this fix your problems? Please report back to us!

  • When I try and download app updates via wi-fi to my Ipad I get an error message "Your account is not valid for use in the Australian Store. You must switch to the US store before purchasing."  I am in the US how do I switch?

    When I try and download app updates via wi-fi to my Ipad I get an error message "Your account is not valid for use in the Australian store. Your must switch t the US store before purchasing. I am currently in the US on wi-fi. How do I switch

    Change App Store
    1. Tap "Settings"
    2. Tap "iTunes & App Stores"
    3. Tap on your Apple ID
    4.Tap "View Apple ID"
    5. Enter your user name and password.
    6. Tap "Country/Region."
    7. Tap "Change Country/Region"
    8. Select the country/region where you are located.
    9. Tap "Done".
    Note: If the change doesn't take effect, sign out of account and sign in again.

  • How to exclude "Blocked for Purchase" error message in PO creation for particular Order Type

    In Article master some times we used to set Site-Specific Article Status = '01'. (MARC-MMSTA)
    01
    Blocked for Purchase
    02
    Blocked for Purchase/Sale
    My requirement is that when Creating PO in ME21N for a particular Order Type (Purchasing). This check need to be removed.
    Now if we try creating the PO we will be getting the below error message.
    Status "Blocked for Purchase" of article XXXXXX does not allow external procurement.
    Is there any exit or BADI where i can put logic to remove this check.

    Hi ,
    You can use BADI ME_PROCESS_PO_CUST or customer exist EXIT_SAPMM06E_013
    Regards,
    Pravin

  • Me_process_po_cust badi for generating internal number range in me21n tcode

    Hi all,
    I have requirement while creating purchase order my client want to generate internal number range based on company code,document type and plant.here, we are making one custom table to hold compny code,plant,doc.type and Number range number.I am using me_process_po_cust badi for the same.I got the po header and item data from this badi.my problem is how i can pass this number range number in me21n to respective fields.
    Regards,
    Sleela Patil

    Hi,
    Thank u both of you..I tried that exit.following is the code I have written for that exit.
    TABLES: T001K,NRIV,EKKO,ZVS_MM_RANGE.
    DATA: WA_TAB TYPE ZVS_MM_RANGE,
          WERKS LIKE T001W-WERKS.
    GET PARAMETER ID 'WRK' FIELD WERKS.
    SELECT SINGLE * FROM T001K
                    WHERE BUKRS EQ NEKKO-BUKRS.
    IF SY-SUBRC EQ 0.
      SELECT SINGLE * FROM ZVS_MM_RANGE
                      INTO WA_TAB
                      WHERE BUKRS EQ NEKKO-BUKRS
                      AND WERKS EQ WERKS    "T001K-BWKEY
                      AND BSART EQ NEKKO-BSART.
      IF SY-SUBRC EQ 0.
        MOVE: NEKKO-EBELN TO NUMBER,
              WA_TAB-NRRANGENR TO RANGE.
      ELSE.
        MESSAGE 'Please maintain Number range in table zvs_mm_range' TYPE 'E'.
      ENDIF.
    ENDIF.
    Here, I am getting data as I needed but problem is client having multiple plant for single company code.I am not able to capture plant in this exit.as, it is in item level.so,later on tried to do it using me_process_po_cust badi.
    Now my problem is that how to pass this number range number in me23n tansaction.
    Regards,
    Sheela Patil

  • Get error message  e auth bad device key or pkcs12

    windows 8 os   did a system restore    then when I tried to download a book from my library I get error message
    e auth bad device key or pkcs12
    It was working fine before the restore

    How To Change the Authorized Adobe ID
    http://www.adobe.com/go/digital-editions-createID
    What do you do if your copy of Adobe Digital Editions is authorized with the wrong Adobe ID? This can happen if you’ve started using a different Adobe ID or you somehow messed up the authorization in the past.
    If you’re trying to open an ebook when Adobe Digital Editions is authorized with the wrong Adobe ID, you’ll get an error message like: “License fulfilled by a different user” or something similar referencing licensing or authorization.
    Important note: If you have some ebooks that do require your current authorization, those will become unreadable if you authorize with a different Adobe ID.
    deauthorize
    The first thing to do is deauthorize Adobe Digital Editions. This will remove your current authorization.
    1. Open Adobe Digital Editions
    2. On your keyboard, simultaneously press the Ctrl, Shift, and D buttons (if on Windows) or the Cmd, Shift, and D buttons (if on a Mac)
    3. Click the “Deauthorize” button
    After this you should close Adobe Digital Editions, and then open it again.
    re-authorize
    If you’ve followed the steps above, your copy of Adobe Digital Editions is no longer authorized.
    Open Adobe Digital Editions
    Adobe Digital Editions will behave as if you’ve just installed it, and will prompt you to enter your login information for your Adobe ID. Use the Adobe ID account information that you want to use to authorize Adobe Digital Editions.

  • HT1923 When attempting a reinstall of iTunes, I cant delete the file C\Program Files\Common Files\Apple\Internet Services\Shellstream.resources due to same error message as described above for iPod file; however i can't find it anywhere in the Task Manage

    When attempting a reinstall of iTunes, I cant delete the file C\Program Files\Common Files\Apple\Internet Services\Shellstream.resources due to same error message as described above for iPod file; however i can't find it anywhere in the Task Manager

    That one's consistent with disk/file damage. The first thing I'd try with that is running a disk check (chkdsk) over your C drive.
    XP instructions in the following document: How to perform disk error checking in Windows XP
    Vista instructions in the following document: Check your hard disk for errors
    Windows 7 instructions in the following document: How to use CHKDSK (Check Disk)
    Select both Automatically fix file system errors and Scan for and attempt recovery of bad sectors, or use chkdsk /r (depending on which way you decide to go about doing this). You'll almost certainly have to schedule the chkdsk to run on startup. The scan should take quite a while ... if it quits after a few minutes or seconds, something's interfering with the scan.
    Does the chkdsk find/repair any damage? If so, can you get an install to go through properly afterwards?

  • I am getting this error message, " The URL is not valid and cannot be loaded" when I try to go to Firefox home. I have uninstalled add-ons, uninstaleed and reinstalled a fresh new firefox which did not help

    I am getting the following error message, " The URL is not valid and cannot be loaded" when I try to go to firefox home. I uninstalled add-ons , uninstalled Firefox and then installed a fresh version. Still have the problem.
    Thanks for the help

    That issue can be caused by a corrupted or incomplete Visual C++ installation (multiple versions can be installed side-by-side; SxS) that is missing some runtime components (Redistributable Packages) that Firefox depends on (problem with an embedded manifest file that specifies a specific runtime version).
    You need to install the missing components (e.g. VisualC++ 2005 Redistrbutable).
    * https://www.microsoft.com/download/en/details.aspx?id=5638
    *[[/questions/908165]] The URL is not valid and cannot be loaded
    *[https://bugzilla.mozilla.org/show_bug.cgi?id=713167 bug 713167] - Microsoft.VC80.CRT SideBySide errors, browsercomps.dll

  • Mac OS X 10.6.8, receiving error message "Failed to check for updates. The operation couldn't be completed. Operation not permitted." How to fix?

    When I try to update my software, I'm receiving the error message "Failed to check for updates. The operation couldn't be completed. Operation not permitted."
    I'm using Safari 4.0.3. Yes, I know this is an old version of Safari - I can't update it, or any other software on my MacBook. Should I just wait for the Lion OS, or is there any kind of fix a non-technical Mac user like me can attempt without screwing up her laptop?
    I've tried clearing my cache and resetting Safari already - doesn't help. I've also tried to update after disabling my (Norton) antivirus software, thinking that might be interfering. None of these help.
    I don't know if it's a related problem, but also I can't download .pdf files from the internet, although I used to be able to.

    You should use the NortonAV uninstaller to uninstall it. Disabling the dreadful thing in the past hasn't always been sufficient for it to cease creating system havoc. The Mac NortonAV version has a long and well-earned reputation for doing truly seriously nasty things to OS X. Shame on Comcast for inflicting NortonAV on its Mac customers. It's not a matter of if NortonAV will mess up OS X but when and how badly. I can't help but wondering if some setting in your Norton AV has decided that NortonAV, rather than you, will be making executive decisions about what you are allowed to install on your computer and is keeping that fact a secret.
    After you are done uninstalling Norton use the finder to search for any Norton files that the uninstaller might have missed. Add the option to search for invisible files.
    After you have removed all the Norton bits and pieces restart in safe mode by holding down the shift key right after the startup chime. Keep holding down the shift key until you see the Apple logo and spinning gear. Safe mode does some maintenance tasks which means a much longer than normal startup time. Use Disk Utility to repair permission
    If your Mac works normally in safe mode restart. If things still aren't fixed you might want to give another shot at reinstalling Snow Leopard from the install DVD and applying the Mac OS X 10.6.8 Update Combo before taking your Mac to the Apple Store.
    If you feel the need to run AV software on your Mac use ClamXav in manual mode. It's donationware and doesn't seem to cause the litany of weird problems that are associated with other AV software.

  • Please help. Error message "Document is licensed for a different user account"

    I purchased a ebook on B and N and saved to my PC. I added this ebook to the library in Adobe Digital Editions and it is displayes. Whena I click on it to open I receive the error message"Document is licensed for a different user account". Please let me know what to do?
    Thank you.

    Hi,
    In order to fix this you need to contact B&N support and ask them to reset download link of the books and then download same book once again.
    Regards
    Rizwan.

  • Itunes error message, account disabled not for security reasons

    Just received an itunes error message, account disable not for security reasons. How do I enable the itunes account? This is a valid account that has been used for during the last six months.

    All you can do is contact iTunes since resetting the PW did not work.
    Apple - Support - iTunes - Contact Us

  • IPhone 4S, the last two versions of IOS: I receive an text, reply, get error message instructing me to use valid 10 digit number. Only this person. I've deleted and re-entered her contact info - still cant send txt. What's up?

    Seems I entered question in subject field? Here's the question:
    iPhone 4S, the last two versions of IOS: I receive a text, in iMessage, reply, get error message instructing me to use valid 10 digit number. Only this person. I've deleted and re-entered her contact info - still cant send txt. What's up? ATT says they've never seen this. I have previously texted successfully with this person and she's changed nothing on her end.

    The fix for this problem is easy and is set out here: http://edctips.blogspot.com/2014/09/fixing-iphone-texting-problem.html

  • Error Message ABC is not a valid Windows 32 application

    I have an error message “ABC is not a valid Windows 32 application even the games are not working properly. This always occurs when open a file or program. Please suggest way to manage it. My systems configurations are Windows 7, 1GHz 32 Bit processor, 1
    GB RAM. 
    Help required.

    If this occurs for a certain executable, this indicates a corruption of the file, redownload or reinstall it. Perform a chkdsk.
    If this occurs on multiple executables,causes might include disk corruption/failure, memory corruption, malware infection,...
    Check if the issue also occurs in safe mode. http://windows.microsoft.com/en-us/windows/start-computer-safe-mode#start-computer-safe-mode=windows-7 
    Run chkdks on the affected drive(s) ,run antivirus/antimalware and do (from an elevated prompt) sfc /scannow to scan for and repair system files.
    MCP/MCSA/MCTS/MCITP

  • When I try to download CC or PS I get an error message. I paid for CC two days ago; rebooted,etc.

    When I try to download CC or PS I get an error message. I paid for CC two days ago and am still getting this. I rebooted several times with same result.
    This is the message:
    We're sorry. Something seems to be wrong on our end. Please try again later. If this continues to fail, please contact Customer Support.

    Hi zelsha,
    Please try to download from the direct link: http://prodesigntools.com/adobe-cc-direct-download-links.html.
    Kindly follow the very important instructions before download.
    Regards,
    Romit Sinha

  • I have an older Macbook with OS/X. Tried to download iTunes 10 a few times now, but when installing I always get the same error message: Run Preinstall Script for Apple Mobile Device Support. What can I do to finalise the installation?

    I have an older Macbook with OS/X. Tried to download iTunes 10 a few times now, but when installing I always get the same error message: Run Preinstall Script for Apple Mobile Device Support. What can I do to finalise the installation?

    Thanks. Short of the sort of "generic" suggestions of restaring your system, if you haven't, and repairing disk permissions and verifying the disk, I don't have any advice right now. I'll do some research and see if I can come across anything. Meanwhile, someone else may have an idea.
    Regards.

Maybe you are looking for