2006 May 06 11:47 AM
Hi All,
I am doing an initial stock upload using LSMW. I am
passing a file in .CSV format . How do i validate the
entries in CSV files in LSMW, so that incorrect entries
do not get processed at all.
Thanks
Nishant
2006 May 06 11:58 AM
Hi
You should insert the abap code you need in the MAPPING step.
There's a std MACRO to allow to skip the transaction: SKIP_TRANSACTION.
So for example:
SELECT SINGLE * FROM T001 WHERE BUKRS = FILE-COMPANY.
IF SY-SUBRC <> 0.
WRITE: / 'Company code is wrong'.
SKIP_TRANSACTION.
ENDIF.
In this way you can read a log after upolaading the file and the LSMW'll load only the correct record.
Max
Hi All,
I am doing an initial stock upload using LSMW. I am
passing a file in .CSV format . How do i validate the
entries in CSV files in LSMW, so that incorrect entries
do not get processed at all.
Thanks
Nishant
2006 May 06 11:58 AM
Hi
You should insert the abap code you need in the MAPPING step.
There's a std MACRO to allow to skip the transaction: SKIP_TRANSACTION.
So for example:
SELECT SINGLE * FROM T001 WHERE BUKRS = FILE-COMPANY.
IF SY-SUBRC <> 0.
WRITE: / 'Company code is wrong'.
SKIP_TRANSACTION.
ENDIF.
In this way you can read a log after upolaading the file and the LSMW'll load only the correct record.
Max
2006 May 06 12:03 PM
Hi Max,
I am new to LSMW and dont have much idea as to where this piece of coding should be done and how to read a log.Can you please elaborate on this.
Thanks in advance
Nishant
2006 May 06 12:11 PM
Hi
In the MAPPING step, you link the file fields to structures SAP fields.
After linking the fields, do a doubleclick on the field you need to check, now the system'll open and editor where you write your code.
So insert here your validation and write a log if it's wrong, use the global data G_SKIP_RECORD to skip the record (not SKIP_TRANSACTION).
All data you insert in this step, they'll be used in CONVERTION step by the system.
So:
IF ......
WRITE 'ERROR'.
G_SKIP_RECORD = 'X'.
ENDIF
Max
2006 May 06 12:14 PM
thanks MAx, that solved my problem...
i have given u full points for this....
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |