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.
Showing results for 
Search instead for 
Did you mean: 

Validations in LSMW

Former Member
0 Kudos

Hi All,

I have to validate two fields which will be coming from Data upload file.To acheive this i have maintained the translations and in control data I have uploaed all the possible values.

Now my requirement is that in step no 5 if I have to check values only against the uploaded values else throw an error msg.I am not able to find how to write the logic for the same.

Pls let me know if require more details.




Former Member
0 Kudos

hello raghav ,

In the step number 5 in LSMW you can keep checks for all the fields in the Source fields.

that is write code line in Mapping and conversion rule that if the field is empty in the file uploaded then raise an error message.

for suppose ur file structure as ,x,y,z fileds then check if filename-x is initial. raise message.



0 Kudos

It will be ok if I want to chk if coming values are empty or not.But in case of wrong values,How can we check ? I hope U got my pt?



Active Contributor
0 Kudos

you can do this with a bit ABAP coding in step 5

double click the coding line and the ABAP editor is opening, here you can add any ABAP code you want to check whatever you need.

0 Kudos

If the check fails, you can use a simple WRITE statement to issue the error message, and also make sure you skip the record or transaction using "skip_record" or "skip_transaction", whatever applies.

You can get fancy by collecting messages into internal tables and issue as ALV in the end, or use standard application log functions in group SBAL.


Former Member
0 Kudos

For this you need to write below example logic in Step 5.

these two are wa_errortab and g_error_tab free defined from SAP.

IF NOT ymain_data-kunnr IS INITIAL.

SELECT SINGLE kunnr FROM kna1 INTO gv_kunnr

WHERE kunnr = ymain_data-kunnr.

IF sy-subrc EQ 0.

wa_errortab-msgty = gc_error.

wa_errortab-id = gc_msgclass.

wa_errortab-msgno = gc_msgno.

wa_errortab-par1 = ymain_data-kunnr.

wa_errortab-par3 = ymain_data-vtweg.

wa_errortab-par4 = ymain_data-spart.

INSERT wa_errortab INTO TABLE g_error_tab.

CLEAR wa_errortab.

skip_record. " Skips only structure but not entire record

skip_transaction. " Skips entire record


bkn00-kunnr = ymain_data-kunnr.


Former Member

Former Member
0 Kudos