Skip to Content

LSMW...

Hi....I am uploading condition records from legacy system using LSMW by recording. If a duplicate record exists then the record is not appended in the condition table which is ok as standard SAP behaves in this way. My requirement is to send the duplicate record to the error file. Please suggest how to do!

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

2 Answers

  • author's profile photo
    Former Member
    Posted on Sep 28, 2007 at 04:51 AM

    Hi,

    Refer the theard you may get an idea.

    https://forums.sdn.sap.com/click.jspa?searchID=5559350&messageID=2400803

    Regards

    Add comment
    10|10000 characters needed characters exceeded

  • author's profile photo
    Former Member
    Posted on Sep 28, 2007 at 11:49 AM

    Hi Roy,

    Go through this code and analyze it and apply the logic as per ur requirement

    Just write the code in the Mapping step

    go to mapping step--


    > click the variant icon--


    > u findout the pop window check the box and press enter,

    there u have to declare a variable in the Global Declaration.

    and in the Begin of Transactions u have to write the logic..

    For Eg:

    select single matnr into RLBES-MATNR from MARA

    where BISMT = BINS-MATNR.

    IF SY-SUBRC <> 0.

    RLBES-matnr = BINS-MATNR.

    MOVE-CORRESPONDING BINS TO err_file.

    MOVE 'Material not created' TO err_file-error.

    APPEND err_file.

    WRITE : 'NO MATERIAL'.

    skip_record.

    endif.

    • __END_OF_PROCESSING__

    FUNCTION 'GUI_DOWNLOAD'

    EXPORTING

    FILENAME = error_file_name

    TABLES

    DATA_TAB = err_file.

    IF SY-SUBRC <> 0.

    • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

    • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

    ENDIF.

    This example used GUI_DOWNLOAD . Ofcourse this is now not recommended so you can use the latest FMs for download.

    Thanks

    Add comment
    10|10000 characters needed characters exceeded