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

solution for batch characteristics validation in MIGO_GR

Former Member
0 Likes
1,548

Hi,

In order to complete and validate the batch characteristics for Goods Receipts (t.c. MIGO_GR) I use user exit EXIT_SAPMM07M_004 from F.G. XMBC. In standard, the VALUES table is filled with 5 characteristics. In this user exit another 2 are added automatically and, via standard batch classification, the user enters another 3. In same user exit I check that the characteristic entered must not exist on another batch. For this I have created a custom FM in which I call standard FM 'CLSC_SEARCH_OBJECTS'. The problem is that if 'NO_DATA_FOUND' exception is raised (practically exactly the confirmation I need), all non standard characteristics are lost even though the parameter table VALUES still contain them all after the user exit is executed.

How can I avoid this behavior without having to write my own logic for searching batches based on their characteristics?

Regards,

Doru

Hi,

In order to complete and validate the batch characteristics for Goods Receipts (t.c. MIGO_GR) I use user exit EXIT_SAPMM07M_004 from F.G. XMBC. In standard, the VALUES table is filled with 5 characteristics. In this user exit another 2 are added automatically and, via standard batch classification, the user enters another 3. In same user exit I check that the characteristic entered must not exist on another batch. For this I have created a custom FM in which I call standard FM 'CLSC_SEARCH_OBJECTS'. The problem is that if 'NO_DATA_FOUND' exception is raised (practically exactly the confirmation I need), all non standard characteristics are lost even though the parameter table VALUES still contain them all after the user exit is executed.

How can I avoid this behavior without having to write my own logic for searching batches based on their characteristics?

Regards,

Doru

3 REPLIES 3
Read only

Former Member
0 Likes
1,026

Hi Doru,

Paste the code where you are calling the FM 'CLSC_SEARCH_OBJECTS'.

I am assuming that you are not handling the exception which is the case of the issue.

This is just a guess.

Regards,

Jovito

Read only

0 Likes
1,026

Hi Jovito,

this is the my function interface. I call this in include ZXMBCU04, f.g. XMBC.

FUNCTION zsk_batch_check.
*"----------------------------------------------------------------------
*"*"Local interface:
*"  IMPORTING
*"     VALUE(I_CLASSTYPE) LIKE  TCLA-KLART
*"     VALUE(I_CLASS) TYPE  KLASSE_D
*"  EXPORTING
*"     VALUE(E_CHARG) LIKE  MSEG-CHARG
*"     VALUE(E_COIL) TYPE  CHAR20
*"     VALUE(E_MENGE) LIKE  MSEG-MENGE
*"  TABLES
*"      I_VALUE STRUCTURE  API_VAL_I OPTIONAL
*"----------------------------------------------------------------------

here is the function call:

**  search if already exists CHARG with given characteristics
    DESCRIBE TABLE l_selection_criteria_tab LINES no_lines.
    IF no_lines > 0 .
      CALL FUNCTION 'CLSC_SEARCH_OBJECTS'
           EXPORTING
                i_classtype              = i_classtype
                i_top_class_struc        = l_top_class_struc
                i_keydate                = sy-datum
                i_language               = c_lang
                i_status_free            = ''
           TABLES
                i_selection_criteria_tab = l_selection_criteria_tab
                i_e_objects_tab          = l_e_objects_tab
           EXCEPTIONS
                no_objects_found         = 1
                inconsistent_parameters  = 2
                no_authority_classtype   = 3
                no_valid_classes         = 4
                internal_error           = 5
                OTHERS                   = 6.

      IF sy-subrc = 0.
** if exists, check quantity in movement history      
        LOOP AT l_e_objects_tab.
          CLEAR: e_menge, w_mchb.
          REFRESH: t_mseg.

          SELECT SINGLE matnr werks lgort charg clabs INTO w_mchb
          FROM mchb WHERE charg = l_e_objects_tab-object+18(10).
          IF sy-subrc = 0.
            e_charg = l_e_objects_tab-object+18(10).
            IF w_mchb-clabs = 0.
              SELECT mblnr mjahr zeile bwart lgort matnr charg shkzg
                     menge meins sgtxt kostl
              INTO TABLE t_check FROM mseg
              WHERE werks = 'AMSC'
                AND charg = l_e_objects_tab-object+18(10)
                AND bwart IN r_bwart.
              IF sy-subrc = 0.
                LOOP AT t_check INTO w_check.
                  IF w_check-shkzg = 'H'.
                    w_check-menge = w_check-menge * ( -1 ).
                  ENDIF.
                  e_menge = e_menge + w_check-menge.
                ENDLOOP.
                IF e_menge > 0.
                ENDIF.
              ENDIF.
            ELSE.
              e_menge = w_mchb-clabs.
            ENDIF.
          ENDIF.
        ENDLOOP.
      ENDIF.

    ENDIF.

No short dump is generated but if sy-subrc = 1 ("no_objects_found" exception), the VALUES paramater table form EXIT_SAPMM07M_004 user exit reverts to it's initial state containing only the first 5 standard characteristics.

Regards,

Doru

Read only

Former Member
0 Likes
1,026

I solved myself by doing the validation in a custom FM. This way no exception is raised and the UserExit parameter table VALUES keeps its values.

Regards