Skip to Content
P D

Doubt Regarding SKIP_TRANSACTION in LSMW

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.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • Posted on Dec 09, 2013 at 06:27 AM

    Hi

    Does your whole piece of code is called 12 times ? I believe yes. Each time the lv_count value will get 1 as it loose the earlier stored value.

    Do something like this So it will append it only first time.

    STATICS: LV_COUNT TYPE I .

    IF LV_COUNT = 0.

    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.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.