cancel
Showing results for 
Search instead for 
Did you mean: 

Message / Warning handling in ME_PROCESS_REQ_CUST BADI

MKM
Active Participant
0 Kudos

I am using PROCESS_ITEM Method of ME_PROCESS_REQ_CUST BADI to throw a POP UP at item level after getting material and plant.My problem is POP UP is triggering more than once per line item if user is pressing ENTER key more than once after entering material and plant.I have tried with memory ID technique with a flag variable which is not working properly for more than one line item.

is there any solution to the link which will solve my problem.

Accepted Solutions (0)

Answers (1)

Answers (1)

madhu_vadlamani
Active Contributor
0 Kudos

Hi Manoj,

INCLUDE mm_messages_mac.

DATA: it_po_line TYPE TABLE OF mepoitem,

header TYPE mepoheader,

items TYPE purchase_order_items,

is_po_line TYPE mepoitem,

is_po_line_tmp TYPE mepoitem,

line_item TYPE purchase_order_item,

wrk_tabix TYPE sy-tabix.

header = im_header->get_data( ).

items = im_header->get_items( ).

LOOP AT items INTO line_item.

is_po_line = line_item-item->get_data( ).

APPEND is_po_line TO it_po_line.

CLEAR is_po_line.

ENDLOOP.

LOOP AT it_po_line INTO is_po_line.

wrk_tabix = sy-tabix.

LOOP AT it_po_line INTO is_po_line_tmp

FROM wrk_tabix

WHERE matnr EQ is_po_line-matnr.

IF sy-subrc EQ 0.

mmpur_message 'I' '00' '39'

'Material is already in the order'

space

space

space.

ENDIF.

CLEAR is_po_line_tmp.

ENDLOOP.

CLEAR : is_po_line,

wrk_tabix.

ENDLOOP.

here i sued the method check.Check like this it will work. if there is any post.

Regards,

Madhu.

MKM
Active Participant
0 Kudos

hi,

I want in PROCESS_ITEM Method Only.Because my requirement is when user will enter material and plant and press enter,that time that POP UP will show for that line item Once.It shouldn't show until it is a new line item.means POP UP should show per line item wise once only.

madhu_vadlamani
Active Contributor
0 Kudos

Hi Manoj,

Can you paste your code.Did you check with user exit.

Regards,

Madhu.

MKM
Active Participant
0 Kudos

In below code,I have used Memory ID technique. In OPEN METHOD,I have EXPORTed ZINTFLAG MEMORY ID having lv_flag variable to 'X' which I am using in below METHOD. But for more than one line item,I am not getting how to do.


METHOD if_ex_me_process_req_cust~process_item.

  IF im_count = 1.

*    TYPE-POOLS mmmfd.
*    INCLUDE mm_messages_mac.

    TYPES : BEGIN OF gty_msg,
             text(1024),
            END OF gty_msg.

    DATA : lwa_flag TYPE lty_flag,
           lv_obj TYPE REF TO object,
           lv_attr TYPE string,
           lv_aktyp TYPE aktyp,
           git_msg TYPE TABLE OF gty_msg,
           gwa_msg TYPE gty_msg,
           l_preq TYPE mereq_item,
           lv_labst TYPE mard-labst,
           lv_labst1 TYPE char13,
           lv_flag(1).

    FIELD-SYMBOLS : <fs_lcl> TYPE ANY.

    lv_obj ?= im_item.
    MOVE 'MY_STATE->AKTYP' TO lv_attr.
    ASSIGN lv_obj->(lv_attr) TO <fs_lcl>.
    lv_aktyp = <fs_lcl>.

    IF lv_aktyp EQ 'H'.        "While creating line item"

      CLEAR l_preq.
      CALL METHOD im_item->get_data
        RECEIVING
          re_data = l_preq.

      IMPORT lv_flag TO lv_flag FROM MEMORY ID 'ZINTFLAG'.

      IF l_preq-matnr IS NOT INITIAL
         AND l_preq-werks IS NOT INITIAL
         AND sy-tcode = 'ME51N'.

        IF lv_flag IS NOT INITIAL.

          IF l_preq-lgort IS INITIAL.
            SELECT SUM( labst ) FROM mard INTO lv_labst
                                WHERE matnr = l_preq-matnr
                                AND werks = l_preq-werks.
          ELSE.
            SELECT SUM( labst ) FROM mard INTO lv_labst
                        WHERE matnr = l_preq-matnr
                        AND werks = l_preq-werks
                        AND lgort = l_preq-lgort.
          ENDIF.

          IF lv_labst <> 0.

            lv_labst1 = lv_labst.
            CONDENSE : lv_labst1.

            CONCATENATE 'Material' l_preq-matnr INTO gwa_msg-text SEPARATED BY space.
            APPEND gwa_msg TO git_msg.
            CLEAR gwa_msg.
            CONCATENATE 'Plant' l_preq-werks INTO gwa_msg-text SEPARATED BY space.
            APPEND gwa_msg TO git_msg.
            CLEAR gwa_msg.
            CONCATENATE 'Storage Location' l_preq-lgort INTO gwa_msg-text SEPARATED BY space.
            APPEND gwa_msg TO git_msg.
            CLEAR gwa_msg.
            CONCATENATE 'Valuated Unrestricted-Use Stock' lv_labst1 INTO gwa_msg-text SEPARATED BY space.
            APPEND gwa_msg TO git_msg.

            CALL FUNCTION 'LAW_SHOW_POPUP_WITH_TEXT'
              EXPORTING
                titelbar                     = 'Messages'
*              HEADER_LINES                 =
*              SHOW_CANCEL_BUTTON           = ' '
                 line_size                    = 50
*              SHOW_BUTTON_YES_TO_ALL       = ' '
*           IMPORTING
*             YES_TO_ALL                   =
              TABLES
                list_tab                     = git_msg
             EXCEPTIONS
               action_cancelled             = 1
               OTHERS                       = 2
                      .
            IF sy-subrc <> 0.
*     MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
            ENDIF.

            CLEAR lv_flag.
            EXPORT lv_flag FROM lv_flag TO MEMORY ID 'ZINTFLAG'.

          ENDIF.
        ENDIF.
      ENDIF.
    ENDIF.
  ENDIF.
ENDMETHOD.

I am wondering if for PO, the link what I have given above is there,then why SAP hasn't given that for PRQ.I have tried with all possible USER EXITs also.not working properly.

eduardo_hinojosa
Active Contributor
0 Kudos

Hi Manoj,

Please, read SAP Note 611175 - ME_PROCESS_REQ_CUST: Documentation, it tell us what is possible and what not. To show the messages use the macros as it says:


The above-mentioned macros have been defined in the
MM_MESSAGES_MAC program. Include this program into a separate
application

Regards

Eduardo