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: 

please help to change this code

Former Member
0 Kudos

Hi All,

I am not abaper but i have to work on this code, currently i have this code in this code i need to exclude the the storage type belongs = 001.

Below i would like to exclude LGTYP = 001

the problem is here it is comparing the two materials and giving the error message, below for the storage type 001 it should exclude.

**************************************************************************************

IF sy-subrc EQ 0.

IF LV_MATNR NE I_LTAP-MATNR.

LV_ERR = c_x.

**************************************************************************************

*Get data.

SELECT * FROM ZWM_SINGLEMAT INTO TABLE LV_ZWM_SINGLEMAT

WHERE LGNUM = I_T331-LGNUM AND

LGTYP = I_T331-LGTYP AND

SINGLE = 'X'.

*Process data

READ TABLE LV_ZWM_SINGLEMAT.

IF sy-subrc EQ 0.

SELECT SINGLE MATNR INTO LV_MATNR FROM LQUA

WHERE LGNUM = I_T331-LGNUM AND

LGTYP = I_T331-LGTYP AND

LGPLA = I_LTAP-NLPLA.

IF sy-subrc EQ 0.

IF LV_MATNR NE I_LTAP-MATNR.

LV_ERR = c_x.

ELSE.

CLEAR LV_ERR.

ENDIF.

ENDIF.

ENDIF.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

if you want to exclude lgtyp = 001 in the loop.

just use below code.

READ TABLE LV_ZWM_SINGLEMAT.

IF sy-subrc EQ 0.

SELECT SINGLE MATNR INTO LV_MATNR FROM LQUA

WHERE LGNUM = I_T331-LGNUM AND

LGTYP <> '001' AND

LGPLA = I_LTAP-NLPLA.

IF sy-subrc EQ 0.

IF LV_MATNR NE I_LTAP-MATNR.

LV_ERR = c_x.

ELSE.

CLEAR LV_ERR.

ENDIF.

ENDIF.

ENDIF.

Regards,

venkat

5 REPLIES 5

Former Member
0 Kudos

Hi,

use for all entries in the select query.

check the modified select query below..

SELECT * FROM ZWM_SINGLEMAT INTO TABLE LV_ZWM_SINGLEMAT for all entries in i_t331

WHERE LGNUM = I_T331-LGNUM AND

LGTYP = I_T331-LGTYP AND

SINGLE = 'X'.

Regards,

venkat

Former Member
0 Kudos

Hi,

if you want to exclude lgtyp = 001 in the loop.

just use below code.

READ TABLE LV_ZWM_SINGLEMAT.

IF sy-subrc EQ 0.

SELECT SINGLE MATNR INTO LV_MATNR FROM LQUA

WHERE LGNUM = I_T331-LGNUM AND

LGTYP <> '001' AND

LGPLA = I_LTAP-NLPLA.

IF sy-subrc EQ 0.

IF LV_MATNR NE I_LTAP-MATNR.

LV_ERR = c_x.

ELSE.

CLEAR LV_ERR.

ENDIF.

ENDIF.

ENDIF.

Regards,

venkat

0 Kudos

Hi Venkat,

This is include program, so using the same variables available in this code we have to exclude the condition for the storage type 001.

please advice how we can do this.

Thanks

Murali

Former Member
0 Kudos

Hi

above the select statement add this delete statement to exclude lgty '001'.

delete I_T331 where lgtyp = '001'.

*Get data.

SELECT * FROM ZWM_SINGLEMAT INTO TABLE LV_ZWM_SINGLEMAT

WHERE LGNUM = I_T331-LGNUM AND

LGTYP = I_T331-LGTYP AND

SINGLE = 'X'.

Regards

Madhan

0 Kudos

Hi Madha,

when am trying to use ur program its giving error message I_T331 is not internal table so i could not able to use your statement Delete I_T331 where lgtype ='031'.

Please clarify I changed like below

After select statment Data is moving to LV_ZWM_SINGLEMAT later he is reading this Table and checking subrc if it is success then he is going forward

My change before reading the internal table LV_ZWM_SINGLEMAT I deleted the entry using your previous statement Delete LV_ZWM_SINGLEMAT where LGTYP = '031'..

Is it ok. please confirm.

************************************************************************************************************************

Total New code is here below

*Get data.

SELECT * FROM ZWM_SINGLEMAT INTO TABLE LV_ZWM_SINGLEMAT

WHERE LGNUM = I_T331-LGNUM AND

LGTYP = I_T331-LGTYP AND

SINGLE = 'X'.

*Change Murali Start

*Deleting the etries which are belongs to storage type 031

Delete LV_ZWM_SINGLEMAT where LGTYP = '031'.

*Change Murali End

*Process data

READ TABLE LV_ZWM_SINGLEMAT.

IF sy-subrc EQ 0.

SELECT SINGLE MATNR INTO LV_MATNR FROM LQUA

WHERE LGNUM = I_T331-LGNUM AND

LGTYP = I_T331-LGTYP AND

LGPLA = I_LTAP-NLPLA.

IF sy-subrc EQ 0.

IF LV_MATNR NE I_LTAP-MATNR.

LV_ERR = c_x.

ELSE.

CLEAR LV_ERR.

ENDIF.

ENDIF.

ENDIF.

******************************************************************************************************************

Could you please confirm

Thanks & Regards,

Murali,