cancel
Showing results for 
Search instead for 
Did you mean: 

Invoice Block

lakshmi_prasad7
Contributor
0 Kudos

If i use below mentioned exit while i am doing partial l quantity in UD its not working can any body guide me how to do

way to block MIRO before UD posting is done is thru an enhancement

LMR1M001

Here you need to post following code to block MIRO in include:ZXM08U16

this code will cause an error message before UD and will allow MIRO for only qty posted to

Unrestricted stock

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

&----


*& Include ZXM08U16

&----


Declaration of variables

DATA: w_prueflos TYPE qamb-prueflos,

w_lmenge TYPE qals-lmenge01.

Declaration of Internal Tables

DATA: itab LIKE qals OCCURS 0 WITH HEADER LINE.

LOOP AT e_tdrseg WHERE selkz EQ 'X'.

Checking whether the document require Inspection

CLEAR: w_prueflos.

SELECT SINGLE prueflos

INTO w_prueflos

FROM qamb

WHERE mblnr = e_tdrseg-lfbnr

AND zeile = e_tdrseg-lfpos.

IF sy-subrc EQ 0.

CLEAR: itab[], itab.

SELECT SINGLE * INTO CORRESPONDING FIELDS OF itab

FROM qals

WHERE prueflos = w_prueflos

AND stat35 = 'X'.

IF sy-subrc EQ 0.

READ TABLE itab INDEX 1.

CLEAR: w_lmenge.

Sum of quantity (Excludes Block stock)

w_lmenge = itab-lmenge01.

IF e_tdrseg-menge GT w_lmenge.

MESSAGE ID 'ZMM' TYPE 'E' NUMBER '004' WITH w_lmenge e_tdrseg-lfbnr.

ENDIF.

ELSE.

MESSAGE ID 'ZMM' TYPE 'E' NUMBER '005' WITH e_tdrseg-lfbnr.

ENDIF.

ENDIF.

ENDLOOP.

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

Edited by: Lakshmiananda prasad on Feb 24, 2012 12:48 PM

Accepted Solutions (0)

Answers (3)

Answers (3)

lakshmi_prasad7
Contributor
0 Kudos

THANKS FOR IN YOUR INPUT

former_member184536
Active Contributor
0 Kudos

hi Laxmi

U can block invoce with the help of controk key 007 and use

QM_L_003 status profie for prevent stock posting before UD.

Manish

Former Member
0 Kudos

Dear Lakshmi,

Please try LMR1M001 Enhancement for the Invoice block. I have applied the same Enhancement.Please check and revert me back.

*&----


**& Include ZXM08U16

*&----


*

*Declaration of variables

DATA: w_prueflos TYPE qamb-prueflos,

w_lmenge TYPE qals-lmenge01.

*Declaration of Internal Tables

DATA: itab LIKE qals OCCURS 0 WITH HEADER LINE.

LOOP AT e_tdrseg WHERE selkz EQ 'X'.

*Checking whether the document require Inspection

CLEAR: w_prueflos.

SELECT SINGLE prueflos

INTO w_prueflos

FROM qamb

WHERE mblnr = e_tdrseg-lfbnr

AND zeile = e_tdrseg-lfpos.

IF sy-subrc EQ 0.

CLEAR: itab[], itab.

SELECT SINGLE * INTO CORRESPONDING FIELDS OF itab

FROM qals

WHERE prueflos = w_prueflos

AND stat35 = 'X'.

IF sy-subrc EQ 0.

READ TABLE itab INDEX 1.

CLEAR: w_lmenge.

*Sum of quantity (Excludes Block stock)

w_lmenge = itab-lmenge01.

IF e_tdrseg-menge GT w_lmenge.

MESSAGE 'Accepted Quantity is Greater than Invoiced Quantity' TYPE 'E' ." WITH 'w_lmenge e_tdrseg-lfbnr'.

ENDIF.

ELSE.

MESSAGE 'Accepted Quantity is Greater than Invoiced Quantity' TYPE 'E'.

*MESSAGE ID 'ZMM' TYPE 'E' NUMBER '005' WITH e_tdrseg-lfbnr."Please clear Quality Inspection Lot"

ENDIF.

ENDIF.

ENDLOOP.

&----


*& Include ZXM08U16

&----


**Declaration of variables

*DATA: w_prueflos TYPE qamb-prueflos,

*w_vcode TYPE qave-vcode.

*

**Declaration of Internal Tables

*

*DATA: itab LIKE qals OCCURS 0 WITH HEADER LINE.

*DATA: itab1 LIKE qave OCCURS 0 WITH HEADER LINE.

*

*LOOP AT e_tdrseg WHERE selkz EQ 'X'.

*

*

**Checking whether the document require Inspection

*

*CLEAR: w_prueflos.

*

*SELECT SINGLE prueflos

*INTO w_prueflos

*FROM qamb

*WHERE mblnr = e_tdrseg-lfbnr

*AND zeile = e_tdrseg-lfpos.

*

*IF sy-subrc EQ 0.

*

*CLEAR: itab[], itab.

*CLEAR: itab1[], itab1.

**

**SELECT SINGLE * INTO CORRESPONDING FIELDS OF itab

**FROM qals

**WHERE prueflos = w_prueflos

**AND stat35 = 'X'.

*

**IF sy-subrc EQ 0.

*CLEAR: w_vcode.

  • SELECT SINGLE vcode INTO w_vcode

*FROM qave

*WHERE prueflos = w_prueflos

*AND vcode ne ' '.

*

**READ TABLE itab1 INDEX 1.

*

*

**w_vcode = itab1-vcode.

*if w_vcode is initial.

*

**IF e_tdrseg-menge GT w_lmenge.

*MESSAGE 'Please clear Quality Inspection Lot' TYPE 'E' ." WITH 'w_lmenge e_tdrseg-lfbnr'.

*ENDIF.

*

**ELSE.

    • MESSAGE 'Please clear Quality Inspection Lot' TYPE 'E'.

***MESSAGE ID 'ZMM' TYPE 'E' NUMBER '005' WITH e_tdrseg-lfbnr.

**ENDIF.

*

*ENDIF.

*

*ENDLOOP.

Regards,

MS

Edited by: MOHAMMED SHAFI on Feb 27, 2012 11:45 AM