Skip to Content

Prepare conditional scenarios in recorded LSMW

Dear Experts,

I have an interesting but quite painful case when adjusting a recorded LSMW.

Case: I need to carry out a task in a custom tcode. The tcode itself is simple: it is just the table display of a custom table with three columns: vendor ID, vendor name (autofilled when vendor ID is entered) and a tickbox.

Task:

1. I go to this tcode

2. search for a vendor

3.1. if found, I add the tick, save and quit.

3.2. If not found, I press New Vendor tab, and enter the vendor ID, add the tick, save and quit.

The challenge: I don't know how to apply conditional scenarios.
If the vendor is already available in the list and I just add the tick and save, it would drop an error message in case of new vendor that is still not in the list.
Vice versa, the second part (adding new vendor to list) would drop an error message if I did it with an already existing vendor that was already updated in the first step.

Also the recorded fields won't be found on the screen in case of error so the process would be blocked.
How can I prevent error screens, and modify the recording to:
1. proceed with first scenario (updating existing vendor), then save and quit?
2. proceed with second scenario (entering vendor) in case of new vendor, ignoring the first scenario?

If you need any specific detail I am keen to elaborate further. I really trust your experience guys.

Thank you in advance, Laszlo

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Best Answer
    Nov 24, 2017 at 03:19 PM

    Recording is not flexible. full stop.

    You need to create individual LSMW objects, for each variation one, if you don't know an other import method than recording.

    Your flexible desired case could be done with LSMW IDoc method by adding a little bit of ABAP in the field mapping, probably as well in SAPs given Standard batch input import method.

    Add comment
    10|10000 characters needed characters exceeded

    • Hi Jürgen, thank you for your input on this topic indeed.

      Taking the consequence, I will certainly proceed with an IDoc LSMW and drop the idea of using recordings.

      Although I am going to close this question as answered, most likely you will hear about me soon when struggling with the another method (I have some experience from long years ago so first I will delve into the knowledge available here on SCN, and will ask another question if failing in finding out the way how to do it).

      Have a great day, Laszlo

  • avatar image
    Former Member
    Nov 24, 2017 at 04:31 PM

    As Jurgen said, recording is not flexible.

    Simple way would be to create a report to check the vendor in the table and to update your tick.

    Report will be very small and easy for error handling.

    Add comment
    10|10000 characters needed characters exceeded