Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

LSMW...

Former Member
0 Likes
627

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!

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!

3 REPLIES 3
Read only

Former Member
0 Likes
571

Hi,

Refer the theard you may get an idea.

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

Regards

Read only

0 Likes
571

No that is basically not my problem....i.e, basically normal error handling...but I need to send a duplicate record to the error file.

Read only

Former Member
0 Likes
571

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