Skip to Content
Technical Articles
Author's profile photo Jigang Zhang 张吉刚

‘No Layouts Found’ issue when program run as background job

After several months of crazy time for one tight-schedule project, finally can take a break in the next few days. Start working on regularly and issues keep coming as usual. One customized program can run successfully in the front end but keeps getting the error of ‘No layouts found’ (Message no. 0K017) when set up as a background job.

Find one similar question that provides some tips:

it was because originally when the background job was created user has defined the layout as user-specific. This has made the background job to fail as it was run by a non-personel user id.

1. The root of ‘No Layouts Found’

However, the above answer seems not to work for my case as my layout is not a user-specific one. After debugging with JBDG, the root of this error message comes from the standard program when the system tries to load the variant:

The key function module to fetch the variant is ‘LT_VARIANT_LOAD’ which will call the routine ‘LT_VARIANTS_READ_FROM_LTDX’:

The layout which has no layout found against it is coming from the LTDXD table:

  • LTDX is for Generic storage of display variants;
  • LTDXD is for Default display variants

Check the entry inside the internal table ‘lt_variants’, I found out the error entry for this layout is from:

The issue is not from the customized program at all, but from the program RM07MLBS(mapping to TCODE: MB52) submitted by this Z program. Be aware of USERNAME here when fetching entry, the filter is current user name or blank only.

2. Display options for MB52

Have to check the layout variant for MB52 which has two options: hierarchical one and non-hierarchical one.

The default layout here is populating automatically inside RM07MLBS which will call  FM ‘LT_VARIANT_LOAD‘ as well.

So the question till now is why ‘LT_VARIANT_LOAD’ fetches one entry that does not exist and how to fix this?

After comparing with other entries and finding out the difference:

  • Some layout has been created but with FLAT as HANDLE which will be used for non-hierarchical instead of hierarchical one.
  • if no layout has been created with the current user, a blank user name will be used to fetch with the default flag.

3. Conclusion

The key here is to make sure one default layout is available for background job use with the correct HANDLE. Actually, it should be there but somehow it’s been deleted for my case. To fix this issue:

  • Delete or recreate this missing variant /SHAHND for MB52 which is not available in the system;
  • Set up one variant and hardcode as inputs when submitting RM07MLBS inside this Z Program will do.

 

 

Assigned Tags

      2 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Oleg Bashkatov
      Oleg Bashkatov

      I know that you know, but just to add something 🙂

      1. Sometimes it is useful to create variant as CUS& - and they will be protected for changing in target system.
      2. When variant is created and it will be used only in background mode - it is possible to hide from user mode.

      Background%20Variant%20Option

      Background Variant Option

       

      3. Layouts could also be transported via Manage Layouts

      Transport%20Layout%20for%20ALV

      Transport Layout for ALV

       

      In that case no user specific variants and layouts would be used in background processing.

      Author's profile photo Jigang Zhang 张吉刚
      Jigang Zhang 张吉刚
      Blog Post Author

      Oleg Bashkatov

      Actually, I'm not familiar with variant CUS&.  : D  Thanks for sharing this!

      Regards