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: 

How to not select material master which has deletiion flag?

Former Member
0 Kudos
90

We have a SD add-on program to change the material number from outside company into inside company number.

The problem in this program as following:

In the material master, the materials flagged for deletion are used, therefore the disuse plant code is showed.

How can I modify the program to not select the material master flagged for deletion?

Please help, thank you.

1 ACCEPTED SOLUTION

Former Member
0 Kudos
47

Hi,

In the select query exclude the entries which are having MARA-LVORM = 'X'.

Regards,

Satish

2 REPLIES 2

Former Member
0 Kudos
48

Hi,

In the select query exclude the entries which are having MARA-LVORM = 'X'.

Regards,

Satish

0 Kudos
47

Hi,

Here is the original program coding. How can I make the coding to not to select material master which has deletion flag?

Please help. Thank you.

FORM DATA_COLLECT.

*

CLEAR ITAB_LIST.

REFRESH ITAB_LIST.

*

CLEAR:WA_MATNR,WA_KUNNR,WA_KUNWE.

SELECT VKORG KUNAG KUNWE VTWEG YYKDMAT KNUMH YYSUBMI

FROM KOTD704

INTO (ITAB_LIST-VKORG,ITAB_LIST-KUNNR,ITAB_LIST-KUNWE,ITAB_LIST-VTWEG,

ITAB_LIST-CUSMAT,ITAB_LIST-COND,ITAB_LIST-YYSUBMI)

WHERE KSCHL = 'Y001'

AND VKORG IN S_VKORG

AND VTWEG IN S_VTWEG

AND KUNAG IN S_KUNNR

AND KUNWE IN S_KUNWE

AND YYKDMAT IN S_CUSMAT

AND DATBI >= SY-DATUM.

SELECT SMATN INTO WA_MATNR

FROM KONDD

WHERE KNUMH = ITAB_LIST-COND.

*

IF S_MATNR <> ''.

CHECK WA_MATNR IN S_MATNR.

ITAB_LIST-MATNR = WA_MATNR.

*

SELECT MAKTX INTO ITAB_LIST-MAKTX

FROM MAKT

WHERE MATNR = WA_MATNR

AND SPRAS = SY-LANGU.

ENDSELECT.

APPEND ITAB_LIST.

ELSE.

ITAB_LIST-MATNR = WA_MATNR.

*

SELECT MAKTX INTO ITAB_LIST-MAKTX

FROM MAKT

WHERE MATNR = WA_MATNR

AND SPRAS = SY-LANGU.

ENDSELECT.

APPEND ITAB_LIST.

ENDIF.

ENDSELECT.

*

CLEAR WA_MATNR.

*

ENDSELECT.

*ENDLOOP.

*

*2005/1/12 UPD S

*IF ITAB_LIST-KUNNR = SPACE.

IF ITAB_LIST-MATNR = SPACE.

*2005/1/12 UPD E

MESSAGE ID 'MG' TYPE 'I' NUMBER '899'

WITH '&#35442;&#24403;&#65411;&#65438;&#65392;&#65408;&#12394;&#12375;'.

ELSE.

LOOP AT ITAB_LIST.

*

CLEAR:WA_CHOTATSU,WA_PLNNR,WA_PLNAL,WA_ARBID,

WA_ARBPL,WA_LIFNR_2,WA_LIFNR.

*

SELECT WERKS BESKZ INTO (ITAB_LIST-WERKS,WA_CHOTATSU)

FROM MARC

WHERE MATNR = ITAB_LIST-MATNR.

*

IF WA_CHOTATSU = 'E' OR

WA_CHOTATSU = 'X'.

SELECT PLNNR PLNAL FROM MAPL

INTO (WA_PLNNR, WA_PLNAL)

WHERE MATNR = ITAB_LIST-MATNR

AND PLNTY = 'N'.

SELECT COUNT(*) FROM PLKO

WHERE PLNNR = WA_PLNNR

AND PLNAL = WA_PLNAL

AND STATU = '4'.

CHECK SY-SUBRC = 0.

SELECT ARBID FROM PLPO

INTO WA_ARBID

WHERE PLNTY = 'N'

AND PLNNR = WA_PLNNR

AND STEUS = 'ZPP1'.

ENDSELECT.

IF WA_ARBID <> SPACE.

SELECT ARBPL FROM CRHD

INTO WA_ARBPL

WHERE OBJID = WA_ARBID.

ENDSELECT.

ENDIF.

ENDSELECT.

ITAB_LIST-ARBPL = WA_ARBPL.

ELSE.

SELECT LIFNR FROM EORD UP TO 1 ROWS

INTO WA_LIFNR

WHERE MATNR = ITAB_LIST-MATNR

AND WERKS = ITAB_LIST-WERKS

AND VDATU <= SY-DATUM

AND BDATU >= SY-DATUM.

ENDSELECT.

*

IF SY-SUBRC <> 0.

ITAB_LIST-ARBPL = SPACE.

ELSE.

WA_LIFNR_2 = WA_LIFNR.

ITAB_LIST-ARBPL = WA_LIFNR_2.

ENDIF.

*

ENDIF.

ENDSELECT.

ENDFORM. "DATA_COLLECT