Application Development 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: 

Lsmw error handling

Former Member
0 Kudos

Hi,

I am using LSMW to upload listing condition record. I am using Batch Input Recording for 'VB01' and the records will be updated through processing of Batch Input Session. In the file the are fields like customer, material, material group4 etc.

These fields may be empty or may have invalid values.I have to validate. where the code should be written? If incorrect value I want to send the record to error file. How to handle these errors and populate a error file?

Please provide me the steps and actions to do in details.

regards,

Tanmay

1 ACCEPTED SOLUTION

Former Member
0 Kudos

hi,

In the field mappings and conversion rules,

in the global section,define an internal table.

data : begin of it_errors occurs 0,

desc type string,

end of it_errors.

and where ever you have wrong or empty values for the fields,populate error there to the internal table.

for example, if Material no is blank,i have to give err msg

IF NOT MATMAS_MRPVIEW-MATNR IS INITIAL.

BMM00-MATNR = MATMAS_MRPVIEW-MATNR.

else.

IT_ERROR-DESC = 'Material no is empty'.

append it_error.

SKIP_RECORD. "to skip further processing of this error record.

ENDIF.

like this you populate all the error records to that IT_ERRORS internal table.

and finally download it using GUI_DOWNLOAD in the event

'__END_OF_PROCESSING__'

-


*************----


there is another way also, you can create a Session in the LSMW, and record the error records in the session then process the error records in the session

~~Guduri

5 REPLIES 5

Former Member
0 Kudos

Hi,

look at the below thread

Regards

Sudheer

Former Member
0 Kudos

hi,

In the field mappings and conversion rules,

in the global section,define an internal table.

data : begin of it_errors occurs 0,

desc type string,

end of it_errors.

and where ever you have wrong or empty values for the fields,populate error there to the internal table.

for example, if Material no is blank,i have to give err msg

IF NOT MATMAS_MRPVIEW-MATNR IS INITIAL.

BMM00-MATNR = MATMAS_MRPVIEW-MATNR.

else.

IT_ERROR-DESC = 'Material no is empty'.

append it_error.

SKIP_RECORD. "to skip further processing of this error record.

ENDIF.

like this you populate all the error records to that IT_ERRORS internal table.

and finally download it using GUI_DOWNLOAD in the event

'__END_OF_PROCESSING__'

-


*************----


there is another way also, you can create a Session in the LSMW, and record the error records in the session then process the error records in the session

~~Guduri

Former Member
0 Kudos

Hi

In step 5 'Maintain field mapping and conversion rules', you first must execute the menupath 'Extras -> display variant' and tick on all possibilities.

This opens some more entry point for you to enter in the field mapping overview. Among these, 'Global data', 'End of transaction' and more.

Here you do your normal data definition (global data) if you need variables etc., and (depending on you case) perhaps you should code your validation in the 'End of transaction' entry point (just double click to get there).

In case of error, use 'TRANSACTION_SKIP' (i think it is - or is it 'SKIP_TRANSACTION' ?) instead of 'TRANSFER_TRANSACTION' and do you file transfer to an error file.

If you use the LSMW Batch input recording method, you should probably do you coding at 'End of record', and replace 'transfer_record' with 'skip_record' (or is it...?)

If you search for 'LSMW' on the OSS (perhaps also on the SDN?) you will most likely find the free LSMW documentation made by SAP. It is very good and shows you all the possibilities you have for interacting with the standard code being generated by the 'Maintain field mapping and conversion rules' bullit point in LSMW.

Good luck.

Former Member
0 Kudos

refer this thread.

Former Member
0 Kudos

Hi,

Can you please give me the Standard program name for LSMW Direct Input method for VB01 Product lising / exclusion

Please Reply

Regards