What you should do and not do when implementing Smartforms...
- Do regard Smartforms as a "black box" for whatever you like to put on paper. A Smartform is about how your (paper) form is set up, with powerful layout tools. It should not be used to select data unless this data is e.g. a description with a value. The main selection for a SmartForm should be performed before the Smartform is called and the information that is passed on to the Smartform should be specified in the Smartform interface.
- Don't ignore the above "Do"... And if you do decide to ignore it, please keep all selection steps grouped together in an Abap block that is executed right up front. If I'm asked to change one of your Smartforms and you've set up selection in several parts of the Smartform, I will find you and you'll have to offer me a coffee from a proper coffee machine.
- Do check the message in
SYST
when (just after) you call your Smartform module and it does not do anything. The error is available inSY-MSGID, SY-MSGNR,
etc. - Don't use a window to put main selection steps for your Smartform. Windows can get re-used in a followup page, which means your selection logic will be executed for every page.
- Do choose clear names for your (indicator) fields. The variabele named "flag" is meaningless even though many Smartforms have it. Think about what you want to achieve and assign a proper name to your indicator like - "additional_info_required".
- Don't build any new SapScripts from scratch. Be smart and use Smartforms...
- Do fill in the names of nodes, at least on higher level.
FETCH_MATERIAL_TEXT
tells a much better tale than%CODE3
. Treat%LOOP1, %ROW2, %CELL3
and%TEXT4
as guests you have invited, but who have not yet been intruduced. Supply suitable names !