云服务器价格_云数据库_云主机【优惠】最新活动-搜集站云资讯

谷歌云_网站的建设费用_返现

小七 141 0

谷歌云_网站的建设费用_返现

In all custom reports developed for MM (Material Management) and SCM (Supply Chain Management) modules encompassing material range as a selection criteria we face problem with converting the range. The external material range entered by user is converted into internal material number and this is taken as range. This results in incorrect data selection.

As a solution to this problem we will have to fetch all the material numbers in case of a range and then convert them to internal number and continue, then it will work.

Clarifying the issue with below example:

Let the material range entered on selection screen be as given belowMaterial Number from 332A31-3061-01 to 332A31-3061-04

It shows the output for materials different than the range entered (332A31-3061-01 to 332A31-3061-04), this is because it is taking the range as 000000010000124767 (internal number for 332A31-3061-01) to 000000010000124781 (internal number for 332A31-3061-04).

The report should have fetched data only for the below 4 materials.

In order to overcome this we will fetch all the material numbers in case of a range and then convert them to internal number. Will be including the below logic AT SELECTION-SCREEN event of the report.

TYPES: BEGIN OF ty_matnr_linetype,               matnr TYPE mara-matnr,           END OF ty_matnr_linetype.TYPES: lt_imatnr_tab TYPE STANDARD TABLE OF ty_matnr_linetype WITH NON-UNIQUE KEY matnr.

*- Declare a range for selection screen materialRANGES: lt_range FOR s_matnr.DATA: l_ieq             TYPE c VALUE ‘X’,          l_plines         TYPE i,                               "Count of original entries          l_outlen        TYPE i,                               "Output length of material          l_slines         TYPE i,                               "Count of selected entries          lwa_range     LIKE LINE OF lt_range,        "Range work area          lwa_imatnr    TYPE ty_matnr_linetype,            lt_matnr_int  TYPE lt_imatnr_tab,          lt_imatnr       TYPE lt_imatnr_tab WITH HEADER LINE.

*- Converting the material entered by the user into internal material number and taking the internal material number as range

*- Count the number of entries in selection screen  DESCRIBE TABLE s_matnr LINES l_plines.  IF NOT l_plines IS INITIAL.*- Calculate Output length of material number fields    CALL FUNCTION ‘MATNR_GET_OUTLEN’      IMPORTING        ev_outlen      = l_outlen      EXCEPTIONS        no_customizing = 1        OTHERS         = 2.

IF l_outlen > 18.

LOOP AT s_matnr TRANSPORTING NO FIELDS           WHERE sign EQ ‘I’ AND option NE ‘EQ’.        CLEAR l_ieq.        EXIT.      ENDLOOP.*- Edit Ranges from external to internal representation      IF l_ieq IS INITIAL.        CALL FUNCTION ‘MATNR_CONV_RANGES’          EXPORTING            selopt_name = ‘S_MATNR[]’          TABLES            range       = s_matnr[].      ELSE.*- Populate the range        LOOP AT s_matnr INTO lwa_range.          lwa_imatnr-matnr = lwa_range-low.          APPEND lwa_imatnr TO lt_imatnr.        ENDLOOP.*- Fetch the internal number         SELECT matnr_int FROM materialid  INTO TABLE lt_matnr_int        FOR ALL ENTRIES IN lt_imatnr        WHERE matnr_int EQ lt_imatnr-matnr.*- Get the count of original and selected material        DESCRIBE TABLE lt_imatnr LINES l_plines.         "original matnr        DESCRIBE TABLE lt_matnr_int LINES l_slines.      "selected matnr*- Populate the select option with internal numbers        IF l_slines > 0 AND l_plines l_slines.          REFRESH lt_range.          CLEAR lwa_range.          REFRESH s_matnr.          CLEAR s_matnr.          lwa_range-sign    = ‘I’.          lwa_range-option  = ‘EQ’.          LOOP AT lt_matnr_int INTO lwa_imatnr.            lwa_range-low = lwa_imatnr-matnr.            APPEND lwa_range TO s_matnr.          ENDLOOP.        ENDIF.

ENDIF.    ENDIF.  ENDIF.

After implementing the changes please find below the report output.We are fetching all the material numbers in case of a range and then convert them to internal number.

Thus the report only return output for these materials.

Hope this helps.

Thanks for this article. Maybe, could you add a screen capture of what we get (an incorrect list of materials) when this special code is not implemented, to illustrate "This results in incorrect data selection.".