‎2007 Oct 05 12:24 PM
hi all ,
i need to validate each record when i upload the data through <b>LSMW</b>
and if any record is not fulfilling the requirement i want to <b>catch
the line number of the flat file</b>
so that the record can be identified easily to correct it and upload it next time.
Points will surely awarded if the answer solves my question.
Thanks and regards
JK
‎2007 Oct 05 12:30 PM
Hi,
In the 5th Step of the LSMW, just double clcik on the MOVE statment for any of the fields(Double click on the field which you want to check), then a line editor will open, there you can write the code, here you can write the code as normal as you write in SE38, then check whether this is existed/wrong value, then you can get the number of the line also, to get the line number, just create a Global field, then every time you can increase this global field to check the number of the line item, you need to increase this number where you are checking/validating the field
Regards
Sudheer
‎2007 Oct 05 12:43 PM
You can do this in the 'Maintain Field Mapping and Conversion Rules' step. In this double click on the '__BEGIN_OF_RECORD__'. This will take you to the ABAP editor and you can code the validation here.
To get the '__BEGIN_OF_RECORD__' if you do not find, take the menu Extras -> Layout and select all the check boxes.
*********************8
You can validate the fields in the LSMW in field mapping section .
For example you are loading the BOM using LSMW and you want to validate those material numbers which do not exist in the material master .
For this purpose write a select statement to check the materials existence like below :
select single matnr into v_matnr
from mara
where matnr = source-matnr .
if sy-subrc <> 0.
skip_record. " this statement will skip the record .
endif.
To get such statements to handle the records withing LSMW during data transfer .Go to the field mapping step , there in abap conversion routine step
go to ' INSERT' -> 'GLOBAL FUNCTIONS' -> ( then a pop will open offering various function options for your requirement. ) In fact SKIP_RECORD is also available there .
************************
validate fileds in lsmw can be done in field mapping step that is 5th step
there u can write the logic if u want any.... for u can validate the fields with the target structure fields so that target structure and target structure fields validated aginst each other
*************************
Regards
Vasu
‎2007 Oct 05 1:20 PM
hi ..
yes with the help of u r codes i was able to validate the records
now my need is that after doing posting for n number of records
i want to get the line number of the flat file for wich the record is not posted due to some internal errors.
‎2007 Oct 05 1:22 PM
‎2007 Oct 05 1:29 PM
hi
1. in 5 step u can see at end of the page ' END OF THE TRANSACTION'
2. click on that and write your code , as well as u can cath the error record and succesfully stroted record too.
Thanks.