Application Development Blog Posts
Learn and share on deeper, cross technology development topics such as integration and connectivity, automation, cloud extensibility, developing at scale, and security.
cancel
Showing results for 
Search instead for 
Did you mean: 
Michael_Keller
Active Contributor
Dear community, my last blog was about how to add more semantics to a SELECT-statement. The solution presented at that time could still be improved. As a reminder, the solution from that time.
SELECT SINGLE spld AS printer,
spdb AS output_immediately,
spda AS delete_from_spool
INTO @DATA(user_print_settings)
FROM usr01
WHERE bname = @sy-uname.

In the solution above, it was already possible to see what information in the database table USR01 are important (printer settings). All without comment. The code tells the "story".

Unfortunately, the solution didn't make it clear what the meaning of database table USR01 is. This can be solved as follows. In addition, I've included a suggestion from jacques.nomssi in the new solution: The user is now part of the USER_PRINT_SETTINGS structure - many thanks to him for his suggestion 🙂
  SELECT SINGLE user_master_data~bname AS user,
user_master_data~spld AS printer,
user_master_data~spdb AS output_immediately,
user_master_data~spda AS delete_from_spool
INTO @DATA(user_print_settings)
FROM usr01 AS user_master_data
WHERE bname = @sy-uname.

With this solution it's now clear what role the database table USR01 plays. By the way, the following solution also works.
  SELECT SINGLE @sy-uname AS user,
user_master_data~spld AS printer,
user_master_data~spdb AS output_immediately,
user_master_data~spda AS delete_from_spool
INTO @DATA(user_print_settings)
FROM usr01 AS user_master_data
WHERE bname = @sy-uname.

Both approaches differ only from the data element in the "USER" column. In solution 1 the column is of data element "XUBNAME", in solution 2 it's "SYST_UNAME".

Important note: jacques.nomssi made a great addition to the topic of this blog in his comment. Please read! Highly recommended. 🙂

 

Best regards, thanks for reading and please stay healthy

Michael

 


P.S.: Please support the virtual wishing well.

P.S.S.: Not tired of reading blogs? Check this blog by murbani.


 
2 Comments