23.1.11

SAP Note 18796 - SE54: Only client in key -> incorrect generation

Symptom:

If a maintainance dialog for a view is used in SE54 or RSVIEWGN and that dailog has only the client in the key, the coding is not generated correctly. A select statement is generated with the additional specification "where", but without a condition. This causes a syntax error.

Cause and prerequisites

Function not supported in the program.
SE54 and RSVIEWGN are both tools for generating table maintainance dialogs. A table containing only the client as a key is, in the SAP sense, not actually a table, since only one entry can be processed each time.

Solution
    1. If no view-specific functions are required (hiding columns of the table, grouping together several tables - with the exception of the text tables; these are maintained automatically when required - subset fields, read-only fields, maintenance status read only, etc.), the table itself can be used as a basis for the SE54 generation. In this case, the client handling works properly.
    2. If view-specific functions are required, you must copy the generated include containing the syntax error,
    LF00, to a new client (e.g. to
    LF99), and correct the copy. In addition, in program
    SAPL, you must deactivate the statement INCLUDE
    LF00 and insert the statement
    L<F99 (for example). Important: when later generating and enhancing new views tables in function group
    <, you must adjust the includes
    L<F00 and
    L<F99
    (for example) manually each time.

In both cases, the maintenance dialog must be generated in two levels since the overview screen does not contain any data!
In addition the blank overview screen must be prevented from being displayed.
If it cannot be guaranteed that an entry exists, a separate module must be embedded after module LISTE_INITIALISIEREN in the PBO of the overview screen using the following statement:
MODULE SUPPRESS_PBO OUTPUT.
IF MAXLINES = 0 "es existiert kein Eintrag
IF STATUS-ACTION EQ AENDERN.
OK_CODE = 'NEWL'. "Funktion Neue Einträge
EXCL_CUA_FUNCT-FUNCTION = 'PREV'. "Funktion Nächster deaktivieren


APPEND EXCL_CUA_FUNCT.
EXCL_CUA_FUNCT-FUNCTION = 'NEWL'. "Funktion Voriger deaktivieren
APPEND EXCL_CUA_FUNCT.
ELSE.
MESSAGE Ixxx 'Keine Daten vorhanden'. "eigene Message senden
SET SCREEN 0. LEAVE SCREEN.
ENDIF.
SUPPRESS DIALOG.
ENDIF.
ENDMODULE.


The program flow is as follows: If maintenance mode is called with SM30, and

  • NO entry exists, the program automatically branches off to the new entries function on the detail screen,
  • if an entry exists, the program branches off to the detail screen.

If SM30 is called with display or transport, and if

  • NO entry exists, the transaction is exited with the message,
  • if an entry exists, the program branches off to the detail screen.


Since the client is the key only, the user can enter and maintain the client entry only. For this reason, functions 'Next entry' and 'Previous entry' should be deactivated.
On the single screen, generate a separate module with the following statement before module DETAIL_PAI:
MODULE SUPPRESS_PAI.
IF OK_CODE EQ 'UEBE'.
OK_CODE = 'ENDE'.
ENDIF.
ENDMODULE.


This module ensures that with F3, F15, the overview screen is suppressed, the dialog is exited, and a confirmation prompt is displayed in case of a security-relevant change on the single screen.

Additional key words

SM30, SM31, extended table maintainance, customizing


No comments:

Post a Comment