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

Validations in LSMW

Former Member
0 Likes
1,288

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.

Thnx,

Rag

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.

Thnx,

Rag

7 REPLIES 7
Read only

Former Member
0 Likes
1,054

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.

Regards,

Vachana.

Read only

0 Likes
1,054

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?

Thnx

Rag

Read only

JL23
Active Contributor
0 Likes
1,054

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.

Read only

0 Likes
1,054

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.

Thomas

Read only

Former Member
0 Likes
1,054

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

ELSE.

bkn00-kunnr = ymain_data-kunnr.

ENDIF.

Read only

Former Member
Read only

Former Member
0 Likes
1,054

k