Using LSMW as a Framework for Reporting

Jimbo's picture

The ability to quickly develop, test and execute LSMW objects makes it a great tool for reporting and not just for validating source data. In many cases the need to generate a one-time-use report does not justify the time and effort of traditional report writing.

Start by making a simple LSMW object and set the Object Type to Standard Batch/Direct Input and select Long texts (0001) as the Ojbect. This is ideal because long texts require no special logical files and it creates no need to produce a recording.

Next create a dummy structure with a single dummy field. Relate this structure to both levels in the longtexts hierarchy under Maintain Structure Relations.

Create or download a dummy.txt file. Specify this as the source data and then assign the file to the dummy structure under Specify Files and Assign Files. Read the data in and that will put a single record to be process and ignored with a skip_transaction.

Finally, go into the Maintain Field Mapping and Conversion Rules section of the LSMW object and add a skip_transaction to the BEGIN_OF_TRANSACTION area.

Now the LSMW is ready to be used as a report. Put parameters and variable definitions in the GLOBAL_DATA area and then all the actual code in the BEGIN_OF_PROCESSING.