This document contains SAP code that is assigning values from a structure <f_mseg1> to variables and inserting those values into a table. It is checking if the serial number is already assigned to a material by selecting from other tables and displaying an error message if there is a match.
This document contains SAP code that is assigning values from a structure <f_mseg1> to variables and inserting those values into a table. It is checking if the serial number is already assigned to a material by selecting from other tables and displaying an error message if there is a match.
This document contains SAP code that is assigning values from a structure <f_mseg1> to variables and inserting those values into a table. It is checking if the serial number is already assigned to a material by selecting from other tables and displaying an error message if there is a match.
This document contains SAP code that is assigning values from a structure <f_mseg1> to variables and inserting those values into a table. It is checking if the serial number is already assigned to a material by selecting from other tables and displaying an error message if there is a match.
IF sy-subrc EQ 0. * Begin of AL001******* IF <f_mseg1>-werks = '5181' OR <f_mseg1>-werks = '5182' OR <f_mseg1>-werks = '5110' OR <f_mseg1>-werks = '5111' OR <f_mseg1>-werks = '5112' OR <f_mseg1>-werks = '5161' OR <f_mseg1>-werks = '5141' . "RV001 wa_go-sernr = sernr . wa_go-matnr = matnr. wa_go-ebeln = <f_mseg1>-ebeln. wa_go-werks = <f_mseg1>-werks. INSERT ztgoitem FROM wa_go. IF sy-subrc <> 0. SELECT SINGLE * FROM ztgoitem WHERE sernr = sernr. CONCATENATE 'Serial Number:' sernr 'is already assigned to material: ' ztgoitem-matnr INTO v_msg1 SEPARATED BY space. ENDIF. "case : same sernr matnr TYPES : BEGIN OF X_SERNR , SERNR TYPE GERNR, MATNR TYPE MATNR, OBKNR TYPE OBJKNR, END OF X_SERNR . Data : IT_sernr type TABLE OF X_sernr WITH HEADER LINE . Data : lv_werks1 type werks_d . SELECT SERNR MATNR OBKNR FROM OBJK INTO TABLE IT_SERNR WHERE SERNR EQ SERNR. * AND MATNR EQ MATNR. if IT_SERNR[] is not INITIAL. READ TABLE IT_SERNR WITH KEY SERNR = SERNR. SELECT SINGLE WERK FROM SER03 INTO LV_WERKS1 WHERE OBKNR EQ IT_SERNR-OBKNR. *IF IT_SERNR-SERNR IS NOT INITIAL. IF IT_SERNR-SERNR EQ SERNR AND IT_SERNR-MATNR EQ MATNR AND LV_WERKS1 NE <f_mseg1>-werks . ELSE. CONCATENATE 'Serial Number:' sernr 'is already assigned to material: ' IT_SERNR-matnr INTO v_msg2 SEPARATED BY space . MESSAGE v_msg2 type 'E'. ENDIF.