Skip to Content
0
P D
Dec 09, 2013 at 06:21 AM

Doubt Regarding SKIP_TRANSACTION in LSMW

35 Views

Hi Experts,

I am using LSMW technique for data uploading and I am using the global function skip_transaction. The problem I am facing is when populating the error table. My Uploading file is having 12 coloumns of data. ie 12 items in one line. So when a line item data does not get validated it has to populate the error table with the message. But in my scenario it is showing 12 error lines for one invalid line data eventhough I am using skip_transaction code.

Here is my code.

DATA: LV_COUNT TYPE I VALUE '1'.

CONCATENATE ZVK11_STRUCT-VKORG ZVK11_STRUCT-VTWEG ZVK11_STRUCT-MATNR

INTO VAKEY.

SELECT SINGLE MATNR VKORG VTWEG FROM MVKE INTO GW_MVKE WHERE

MATNR = ZVK11_STRUCT-MATNR AND VKORG = ZVK11_STRUCT-VKORG AND

VTWEG = ZVK11_STRUCT-VTWEG.

IF GW_MVKE IS NOT INITIAL.

SELECT KNUMH KSCHL VAKEY DATAB DATBI FROM KONH INTO TABLE GT_KONH

WHERE

KSCHL EQ ZVK11_STRUCT-KSCHL AND

VAKEY EQ VAKEY.

IF GT_KONH IS NOT INITIAL.

LOOP AT GT_KONH INTO GW_KONH.

IF ZVK11_STRUCT-DATAB BETWEEN GW_KONH-DATAB AND GW_KONH-DATBI

OR ZVK11_STRUCT-DATBI BETWEEN GW_KONH-DATAB AND GW_KONH-DATBI.

SELECT SINGLE KMEIN FROM KONP INTO GW_KONP WHERE KNUMH = GW_KONH-KNUMH

AND KMEIN = ZVK11_STRUCT-KMEIN.

IF SY-SUBRC = 0.

IF LV_COUNT = 1.

GW_ERROR-KSCHL = ZVK11_STRUCT-KSCHL.

GW_ERROR-VKORG = ZVK11_STRUCT-VKORG.

GW_ERROR-VTWEG = ZVK11_STRUCT-VTWEG.

GW_ERROR-MATNR = ZVK11_STRUCT-MATNR.

GW_ERROR-ERROR_TEXT = 'MATERIAL FALLS BETWEEN EXISTING PERIODS'.

APPEND GW_ERROR TO GT_ERROR.

LV_COUNT = LV_COUNT + 1.

CLEAR: GW_KONP, GW_ERROR,GW_KONH, GW_ERROR.

SKIP_TRANSACTION.

ENDIF.

ENDIF.

ENDIF.

ENDLOOP.

ENDIF.

ELSE.

GW_ERROR-MATNR = ZVK11_STRUCT-MATNR.

GW_ERROR-ERROR_TEXT = 'MATERIAL DOES NOT BELONG TO SALES ORG/DISCHNNL'.

APPEND GW_ERROR TO GT_ERROR.

CLEAR: GW_ERROR.

SKIP_TRANSACTION.

ENDIF.

CLEAR: LV_COUNT.

BR.