Skip to Content
0
Nov 14, 2013 at 07:28 AM

BAPI 'BAPI_OUTB_DELIVERY_CONFIRM_DEC' doesnt check quantity limit

963 Views

Hello gurus

I am using the BAPI 'BAPI_OUTB_DELIVERY_CONFIRM_DEC' to update the quantity like in VL02N.

And users can update the quantity to any value with the BAPI

whereas in VL02N it doesnt allow and gives an error message stating the total quantity has exceded!!

BAPI fails to go into this validation.

I debugged the code and noticed that

BAPı goes into the user exit but because of the flag

CHECK V50AGL-CONFIRM_CENTRAL IS INITIAL.

Here is the code!!

Why this flag is set to X and how do i fix this

*&---------------------------------------------------------------------*

*& Report ZSELTST72

*&---------------------------------------------------------------------*

REPORT ZSELTST72.

PARAMETERS P_VBELN LIKE LIKP-VBELN.

DATA LS_HEADER_DATA LIKE BAPIOBDLVHDRCON.

DATA LS_HEADER_KONTROL LIKE BAPIOBDLVHDRCTRLCON.

DATA LV_DELIVERY LIKE BAPIOBDLVHDRCON-DELIV_NUMB.

DATA LT_ITEM_DATA LIKE TABLE OF BAPIOBDLVITEMCON WITH HEADER LINE.

DATA LT_ITEM_CONTROL LIKE TABLE OF BAPIOBDLVITEMCTRLCON

WITH HEADER LINE.

DATA LT_RETURN LIKE TABLE OF BAPIRET2.

DATA LT_LIPS TYPE TABLE OF LIPS WITH HEADER LINE .

SELECT * FROM LIPS

INTO TABLE LT_LIPS

WHERE VBELN = P_VBELN.

LV_DELIVERY = P_VBELN.

LS_HEADER_DATA-DELIV_NUMB = P_VBELN.

LS_HEADER_KONTROL-DELIV_NUMB = P_VBELN.

*ls_header_kontrol-post_gi_flg = 'X'.

LOOP AT LT_LIPS.

LT_ITEM_DATA-DELIV_NUMB = LV_DELIVERY.

LT_ITEM_DATA-DELIV_ITEM = LT_LIPS-POSNR.

LT_ITEM_DATA-MATERIAL = LT_LIPS-MATNR.

LT_ITEM_DATA-DLV_QTY = LT_LIPS-LFIMG.

LT_ITEM_DATA-DLV_QTY_IMUNIT = LT_LIPS-LFIMG.

LT_ITEM_DATA-FACT_UNIT_NOM = 1.

LT_ITEM_DATA-FACT_UNIT_DENOM = 1.

APPEND LT_ITEM_DATA.

LT_ITEM_CONTROL-DELIV_NUMB = LV_DELIVERY.

LT_ITEM_CONTROL-DELIV_ITEM = LT_LIPS-POSNR.

LT_ITEM_CONTROL-CHG_DELQTY = 'X'.

APPEND LT_ITEM_CONTROL.

ENDLOOP.

CALL FUNCTION 'BAPI_OUTB_DELIVERY_CONFIRM_DEC'

EXPORTING

HEADER_DATA = LS_HEADER_DATA

HEADER_CONTROL = LS_HEADER_KONTROL

DELIVERY = LV_DELIVERY

TABLES

ITEM_DATA = LT_ITEM_DATA[]

ITEM_CONTROL = LT_ITEM_CONTROL[]

RETURN = LT_RETURN

.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

EXPORTING

WAIT = 'X'

* IMPORTING

* RETURN =

.