====== Développement d'écrans SAP ======
[[abap:modal_screen:Modal screens]]
===== Gestion des touches de fonction =====
Il faut créer un [[abap:screens:statut|statut]] dans le menu painter (se41) puis appeler ce statut dans un module PBO.
MODULE set_status OUTPUT.
SET PF-STATUS 'TEST'.
ENDMODULE.
===== Gestion du titre =====
Il faut créer un "titre" dans le menu painter (se41) puis appeler ce titre dans un module PBO.
MODULE set_title OUTPUT.
SET TITLEBAR sy-dynnr.
ENDMODULE.
===== Gestion du cursor =====
**/!\ Cette commande compile également dans les modules PAI mais est ineffective ! /!\**
MODULE set_cursor OUTPUT.
SET CURSOR FIELD g_cursor.
ENDMODULE.
===== Statuts GUI =====
Les Statuts standards sont contenus dans le program pool ''SAPLKKBL''.
===== Gestion des messages d'erreur =====
**/!\ En dehors d'un écran, un message va s'afficher dans un écran vide /!\**
* Une instruction ''MESSAGE'' dans le PBO va afficher une popup.
* Une instruction ''MESSAGE'' dans le PAI va afficher un message dans la barre d'état.
* Un message de type ''E'', "erreur" interrompt le PAI et reboucle immédiatement sur le PBO du même écran. Les autres types de messages sont passants.
Le traitement PAI des erreurs se fait par module : on utilise la syntaxe ''FIELD ... MODULE ... '' pour associer un module à un champ en particulier.
On peut associer plusieurs champs à un module en utilisant l'instruction ''CHAIN''.
[[http://help.sap.com/saphelp_470/helpdata/EN/9f/dbabbd35c111d1829f0000e829fbfe/content.htm|Source]]
===== Manipulation dynamique des champs =====
[[http://help.sap.com/saphelp_banking60/helpdata/en/9f/dbab6f35c111d1829f0000e829fbfe/content.htm|Help SAP]] : Setting Attributes Dynamically. Avec notamment la table de vérité pour les champs ACTIVE, INPUT, OUTPUT, and INVISIBLE.
LOOP AT SCREEN.
IF screen-name = wgv_cur.
IF cur = line.
break user.
screen-input = 1.
MODIFY SCREEN.
ENDIF.
ENDIF.
ENDLOOP.
There are certain hierarchy rules between the components ACTIVE, INPUT, OUTPUT, and INVISIBLE. They also have different effects depending on their respective static settings.
The ACTIVE component has no equivalent in the element attributes. Instead, it changes the components INPUT, OUTPUT, and INVISIBLE.
At the beginning of the PBO, ACTIVE is always set to 1, regardless of the static attribute settings. Setting ACTIVE to 0 automatically sets INPUT = 0, OUTPUT = 0, and INVISIBLE = 1. Any other changes to the settings of INPUT; OUTPUT, and INVISIBLE to the current screen element are ignored. Conversely, setting INPUT = 0, OUTPUT = 0, and INVISIBLE = 1 automatically sets ACTIVE to 0, and any further assignment to ACTIVE for the current screen element will be ignored. The setting ACTIVE = 1 has no other effect on the attributes. The only purpose of the ACTIVE component is to allow you to make a screen field inactive through a single assignment. You should particularly note that a module call linked to a FIELD statement in the screen flow logic is always executed, even when SCREEN-ACTIVE = 0 for the field in question. If you want to prevent a module from being processed for an inactive field, you must specify the FIELD- and MODULE statements separately.
There are eight possible combinations of ACTIVE, INPUT, OUTPUT, and INVISIBLE, that have the following effect on screen fields:
^ACTIVE^INPUT^OUTPUT^INVISIBLE^Effect^
|1|1|1|0|Screen field is displayed, even if Invisible is set statically. Field contents are displayed.Ready for input, even if Input is not set statically. However, not ready for input if the Output only is set statically.|
|1|1|0|0|Screen field is displayed, even if Invisible is set statically, except when Output only is set statically. Field contents are not displayed. Ready for input, even if Input is not set statically.|
|1|0|1|0|Screen field is displayed, even if Invisible is set statically. Field contents are displayed. Not ready for input, even if Input is set statically.|
|1|0|0|0|Screen field is displayed, even if Invisible is set statically, except when Output only is set statically. Field contents are not displayed. Not ready for input, even if Input is set statically.|
|1|1|1|1|Screen field is displayed, even if Invisible is set statically, except when Output only is set statically. Field contents are not displayed. Ready for input, even if Input is not set statically. User input is masked by asterisks ( *).|
|1|1|0|1|Screen field is displayed, even if Invisible is set statically, except when Output only is set statically. Output is masked by asterisks ( *). Ready for input, even if Input is not set statically. User input is masked by asterisks ( *).|
|1|0|1|1|Screen field inactive. Screen field is not displayed, regardless of the static attributes.|
|0|0|0|1|Screen field inactive. Screen field is not displayed, regardless of the static attributes.|
If a field is statically-defined as Output only, setting INPUT = 1 has no effect. INPUT is always 0 for these fields. Masking user input by asterisks ( *) can be used for entering user passwords.
If a whole line becomes invisible when you make fields invisible, the screen is automatically made smaller. You can, however, switch off this attribute in the static screen attributes by selecting Switch off runtime compression.
**REQUIRED**
When you set REQUIRED = 1, a field that is ready for input is made mandatory. Users can only leave the screen when all mandatory fields contain an entry. Exception: Function codes of type E and modules with the AT EXIT-COMMAND addition.
**DISPLAY_3D**
When you set DISPLAY_3D = 0, the three-dimensional frame for input/output fields is removed. You cannot use DISPLAY_3D = 1 to create a three-dimensional effect for text fields or screen fields with the Output only attribute.
**VALUE_HELP**
Setting VALUE_HELP to 0 or 1 switches the input help button off and on respectively.
**INTENSIFIED**
If you set INTENSIFIED = 1, the field contents of input fields are changed from black to red. The contents of output fields are changed from black to blue.
**LENGTH**
You can set the LENGTH component to a value shorter than the statically-defined output length ( vislength) for input/output fields and Output only fields. This allows you to shorten their output length. You cannot shorten other screen elements, or lengthen any screen elements.
**REQUEST**
Setting REQUEST = 1 for a field that is ready for input has the same effect in the PAI event as if the user had changed the field contents. This means that a conditional module call using ON REQUEST or ON CHAIN-REQUEST would be executed regardless of whether the user really changed the field. REQUEST is automatically reset to 0.
===== Affichage dynamique des icônes =====
[[http://scn.sap.com/thread/201313|Sauce]]
* In this sample program, there is a button on screen 100
* which has the name of THISBUTTON, and is set as output
* only.
report zrich_0001.
type-pools: icon.
data: thisbutton(30) Type c.
call screen 100.
*&---------------------------------------------------------------------*
*& Module status_0100 OUTPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
module status_0100 output.
write icon_green_light as icon to thisbutton.
concatenate thisbutton 'This is the button' into thisbutton
separated by space.
endmodule. " status_0100 OUTPUT
*&---------------------------------------------------------------------*
*& Module user_command_0100 INPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
module user_command_0100 input.
leave program.
endmodule. " user_command_0100 INPUT
**__NB__** Si le bouton a été déclaré dans le ''screen painter'', veiller à bien cocher ''Zone d'édition'', sinon l'icône ne changera pas.
===== Affichage des décimales =====
Pour afficher les décimales, il est possible de typer les champs
===== Publication templates vers serveur ITS =====
Depuis la SE38 ou la SE80, ''Utilitaires > Autres utilitaires > Modèle Service Internet > Créer'' (function code ''ITS_TEMPLATE_CREATE'') et spécifier le service internet cible avec le thème ''99'' et le bon style de génération. Une fois le template généré, ne pas oublier de le publier.