Application Development 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: 

BOM set for Deletion is blocking other BOM to display

Former Member
0 Kudos
224

Hi,

I have created a Z BOM details report, its working fine for single value but when I run it for multiple values in a range it shows BOM is set for deletion

For Example I have set BOM - 12000007 for deletion - checked the deletion Flag in CS02

BOM  - 12000005 is a BOM without deletion Flag but when we run the report from 12000001 to 12000010 then it shows BOM is marked for Deletion while it should display BOM - 12000005

But when we run the report for only 12000005 its working correctly and showing the BOM details.

Below is the ABAP code

FORM fetch_header_data .

  *extract data from MAST table

   SELECT werks matnr stlal andat stlnr STLAN "CHANGES BY BHUPPI FOR STLAN 2 ADDING STLAN ON 10.05.2010"

        FROM  mast

        INTO  CORRESPONDING FIELDS OF TABLE git_header

        WHERE werks IN s_werks

        AND   matnr IN s_matnr

        AND   stlal IN s_stlal

        AND   andat IN s_andat.

   IF sy-subrc <> 0.

     MESSAGE e398(00) WITH 'No data found'.

   ELSE.

     IF NOT git_header[] IS INITIAL.

       SELECT stlnr stlal bmeng bmein FROM stko

           INTO CORRESPONDING FIELDS OF gwa_header

           FOR ALL ENTRIES IN git_header

           WHERE stlnr = git_header-stlnr

           AND   stlty = 'M'

           AND   stlal = git_header-stlal.

         MODIFY TABLE  git_header FROM gwa_header

                       TRANSPORTING bmeng bmein .

         CLEAR gwa_header.

       ENDSELECT.

     ENDIF.

      IF NOT git_header[] IS INITIAL.

       SELECT matnr maktx

              FROM makt

              INTO TABLE git_desc

              FOR ALL ENTRIES IN git_header

              WHERE matnr = git_header-matnr

              AND   spras = 'EN'.

       SELECT matnr bismt

              FROM mara

              INTO TABLE git_oldcode

              FOR ALL ENTRIES IN git_header

              WHERE matnr = git_header-matnr.

     ENDIF.

     LOOP AT git_header INTO gwa_header.

       gwa_desc-matnr = gwa_header-matnr.

       READ TABLE git_desc FROM gwa_desc INTO gwa_desc.

       MOVE gwa_desc-maktx TO gwa_header-maktx_mat.

       CLEAR gwa_desc.

       gwa_oldcode-matnr = gwa_header-matnr.

       READ TABLE git_oldcode FROM gwa_oldcode INTO gwa_oldcode.

       MOVE gwa_oldcode-bismt TO gwa_header-bismt_mat.

       CLEAR gwa_oldcode.

       MODIFY git_header FROM gwa_header.

     ENDLOOP.

    ENDIF.

ENDFORM.      

FORM fetch_component_data .

   LOOP AT git_header INTO gwa_header.

*fetch compopnent data using FM 'CS_BOM_EXPL_MAT_V2'

     CALL FUNCTION 'CS_BOM_EXPL_MAT_V2'

      EXPORTING

*     FTREL                       = ' '

*     ALEKZ                       = ' '

*     ALTVO                       = ' '

*     AUFSW                       = ' '

*     AUMGB                       = ' '

*     AUMNG                       = 0

*     AUSKZ                       = ' '

*     AMIND                       = ' '

*     BAGRP                       = ' '

*     BEIKZ                       = ' '

*     BESSL                       = ' '

*     BGIXO                       = ' '

*     BREMS                       = ' '

        capid                       = 'PP01'

*     CHLST                       = ' '

*     COSPR                       = ' '

*     CUOBJ                       = 000000000000000

*     CUOVS                       = 0

*     CUOLS                       = ' '

* Changes by Bala on 25.09.2006 Due to BOMs updated or changed recently were not appearing

       datuv                       = sy-datum

*      gwa_header-andat

* End of changes Bala

*     DELNL                       = ' '

*     DRLDT                       = ' '

*     EHNDL                       = ' '

*     EMENG                       = 0

*     ERSKZ                       = ' '

*     ERSSL                       = ' '

*     FBSTP                       = ' '

*     KNFBA                       = ' '

*     KSBVO                       = ' '

*     MBWLS                       = ' '

**     MKTLS                       = 'X'

*     MDMPS                       = ' '

***     MEHRS                       = 'X'

*     MKMAT                       = ' '

*     MMAPS                       = ' '

*     SALWW                       = ' '

*     SPLWW                       = ' '

*     MMORY                       = ' '

        mtnrv                       = gwa_header-matnr

*     NLINK                       = ' '

*     POSTP                       = ' '

*     RNDKZ                       = ' '

*     RVREL                       = ' '

*     SANFR                       = ' '

*     SANIN                       = ' '

*     SANKA                       = ' '

*     SANKO                       = ' '

*     SANVS                       = ' '

*     SCHGT                       = ' '

*     STKKZ                       = ' '

        stlal                       = gwa_header-stlal

      STLAN                        = gwa_header-stlan

*     STPST                       = 0

*     SVWVO                       = 'X'

        werks                       = gwa_header-werks

*     NORVL                       = ' '

*     MDNOT                       = ' '

*     PANOT                       = ' '

*     QVERW                       = ' '

*     VERID                       = ' '

*     VRSVO                       = 'X'

*   IMPORTING

*     TOPMAT                      =

*     DSTST                       =

       TABLES

         stb                         = git_stb.

*     MATCAT                      =

**    EXCEPTIONS

*     ALT_NOT_FOUND               = 1

*     CALL_INVALID                = 2

*     MATERIAL_NOT_FOUND          = 3

*     MISSING_AUTHORIZATION       = 4

**     NO_BOM_FOUND                = 5.

*     NO_PLANT_DATA               = 6

*     NO_SUITABLE_BOM_FOUND       = 7

*     CONVERSION_ERROR            = 8

*     OTHERS                      = 9

     .

     IF sy-subrc <> 0.

* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

     ENDIF.

     LOOP AT git_stb INTO gwa_stb.

       MOVE-CORRESPONDING gwa_stb TO git_output.

       MOVE-CORRESPONDING gwa_header TO git_output.

       APPEND git_output.

       CLEAR git_output.

     ENDLOOP.

   ENDLOOP.

*extract: component description from MAKT table

*         old component code from MARA table

   CLEAR: gwa_desc,git_desc,git_desc[].

   IF NOT git_output[] IS INITIAL.

     SELECT matnr maktx

            FROM makt

            INTO TABLE git_desc

            FOR ALL ENTRIES IN git_output

            WHERE matnr = git_output-idnrk

            AND   spras = 'EN'.

     SELECT matnr bismt

            FROM mara

            INTO TABLE git_oldcode

            FOR ALL ENTRIES IN git_output

            WHERE matnr = git_output-idnrk.

   ENDIF.

   LOOP AT git_output.

     gwa_desc-matnr = git_output-idnrk.

     READ TABLE git_desc FROM gwa_desc INTO gwa_desc.

     MOVE gwa_desc-maktx TO git_output-maktx_comp.

     CLEAR gwa_desc.

     gwa_oldcode-matnr = git_output-idnrk.

     READ TABLE git_oldcode FROM gwa_oldcode INTO gwa_oldcode.

     MOVE gwa_oldcode-bismt TO git_output-bismt_comp.

     CLEAR gwa_oldcode.

     MODIFY git_output.

   ENDLOOP.

ENDFORM.                    " fetch_component_data

Kindly suggest what is going wrong in it.

2 REPLIES 2

Former Member
0 Kudos
93

Hi,

While getting data from STKO in addition to selection condition add lkenz Ne 'X' ( this is a deletion indicator ).

I hope this helps,

Regaqrds

Raju Chitale

0 Kudos
93

Thanks for your reply,

I have tried but still the same problem

IF NOT git_header[] IS INITIAL.

*extract base qty and UOM from STKO table

       SELECT stlnr stlal bmeng bmein FROM stko

           INTO CORRESPONDING FIELDS OF gwa_header

           FOR ALL ENTRIES IN git_header

           WHERE stlnr = git_header-stlnr

           AND   stlty = 'M'

           AND   stlal = git_header-stlal

         AND LOEKZ NE 'X'.

         MODIFY TABLE  git_header FROM gwa_header

                       TRANSPORTING bmeng bmein .

         CLEAR gwa_header.

       ENDSELECT.

     ENDIF.