Skip to Content
author's profile photo Former Member
Former Member

problem with status-button in item view of ME21/22/23N

Hello ABAP,

i have to check for some conditions when a PO is saved, and due to those checks either save it or well, not.

This is working fine so far.

when you click check, or save, conditions get checked and window with errors pops up.

I´m using the normal error message procession used in SAPLMEGUI which i have to fill with thos three makros.

I just have one problem, my status button in item line doesnt get updated. i tried with a lot of metafields by now but it seems trial and error is not the way to go here.

any tips?

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Sep 07, 2010 at 07:37 AM

    Hi

    You can not issue error messages by normal processing. You need to use MMPUR macro to issue the error message.

    OSS-Note 310154 may be helpful.

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      requirement resolved.

      solution follows:

      DATA: lt_ytab             TYPE TABLE OF ysdch_vbap_idnlf,
            lt_data             TYPE TABLE OF ymmch_check_idnlf_out, "added ID (TYPE INT4) Field to structure
            lt_out              TYPE TABLE OF char80.
      
      DATA: ls_ytab             TYPE ysdch_vbap_idnlf,
            ls_mska             TYPE mska,
            ls_data             TYPE ymmch_check_idnlf_out,
            ls_out              TYPE char80,
            lv_row_end          TYPE i VALUE 10.
      
      CONSTANTS:  lc_col_start        TYPE i VALUE 10,
                  lc_col_end          TYPE i VALUE 40,
                  lc_row_start        TYPE i VALUE 10,
                  lc_title            TYPE char80 VALUE
                  'Fehler, noch Bestand zu Liquidations/Annulationsaufträgen vorhanden'.
      
      *~~~Get header data
      ls_head = im_header->get_data( ).
      *~~~Get item data
      lt_items = im_header->get_items( ).
      LOOP AT lt_items INTO lr_item.
        ls_item = lr_item-item->get_data( ).  "EKPO
      
        "select liquidations/annulations orders for supplier material nr.
        SELECT *
        FROM   ysdch_vbap_idnlf
        INTO   TABLE lt_ytab
        WHERE  /fis/idnlf = ls_item-idnlf.
      
        LOOP AT lt_ytab INTO ls_ytab.
          "now lets see which of those orders has order stock
          SELECT SINGLE kalab kaspe
          FROM   mska
          INTO   CORRESPONDING FIELDS OF ls_mska
          WHERE  vbeln = ls_ytab-vbeln
          AND    posnr = ls_ytab-posnr.
      
          IF ls_mska-kalab GT 0 OR ls_mska-kaspe GT 0.
            ls_data-vbeln       = ls_ytab-vbeln.
            ls_data-posnr       = ls_ytab-posnr.
            ls_data-/fis/idnlf  = ls_item-idnlf.
            ls_data-kalab       = ls_mska-kalab.
            ls_data-kaspe       = ls_mska-kaspe.
            ls_data-meins       = ls_item-meins.
            ls_data-ebelp       = ls_item-ebelp.
            ls_data-id          = ls_item-id. "saved ID for later processing
            APPEND ls_data TO lt_data.
          ELSE.
            CONTINUE.
          ENDIF.
        ENDLOOP.
      ENDLOOP. " lt_item
      
      
      IF NOT lt_data IS INITIAL.
        "we got annulation/liquidation orders with order stock for this material
        "so popup a error message
      
        LOOP AT lt_data INTO ls_data.
          IF NOT ls_data-vbeln IS INITIAL AND NOT ls_data-posnr IS INITIAL.
            mmpur_business_obj_id ls_data-id. "using other makro now and making use of ID
            "using mmpur_business_obj_id instead of mmpur_business_obj_it
          ENDIF.
          mmpur_metafield mmmfd_item_number.
          mmpur_message  'W' 'YMMCH' '110' ls_data-vbeln ls_data-posnr ls_data-ebelp ' '.
        ENDLOOP.
        ch_failed = 'X'.
      ENDIF.
      

      Edited by: Florian Kemmer on Sep 7, 2010 3:22 PM

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.