Show TOC

 Example: Specific Form Elements in HTML Templates (SAP Design)

The part of the HTML template that is specific to the scenario begins after the statement ` SAP_ISRFormBegin()' .

You can use the following functions to define the form elements for the request.The functions are defined in the sr_library Internet Service, in the isr_template_library template.

Recommendation Recommendation

To study the functions, load the form elements in the SAP@Web-Studio, or display the SR_LIBRARY internet service in the Web Application Builder. You find the functions using the syntax check.For more information, see the SAP Library under BasisSAP Internet Applications → SAP@Web Studio or Basis → BC-ABAP Workbench → Integration of Internet Services → Web Application Builder .

End of the recommendation.

Form Elements

Note Note

The examples come from the standard scenario Room change request (SR01) . To study the examples described, call this scenario.

End of the note.

SAP_ISRGetLabel(name) This returns the name of the description of a special or general characteristic.Example: ` myLabel = SAP_ISRGetLabel(name="BUILDING_TO")` Result: The myLabel variant defined by assignment contains the text "By building".

SAP_ISRGetMaxSize(name) Returns the maximum length for the name characteristic.Example: ` myLabel = SAP_ISRGetLabel(name="BUILDING_TO")` Result: The mySize variant defined by assignment contains the value 2.

SAP_ISRAdjustMode(mode) Converts the mode for an entry field, dependent on the current processing mode (CREATE or DISPLAY).Example: ` myMode = SAP_ISRAdjustMode(mode)` Result: If you call the request in Display mode, myMode contains the value disabled. In all other cases, it contains the value transferred using the mode parameter.

SAP_ISRFieldListBegin(left, top, labelWidth=SAP_ISRdefaultLabelWidth )

and

SAP_ISRFieldListEnd( ) Defines a list of form elements that are arranged under each other in rows. The starting point of the list is defined by left (columns from the right edge of the form) and top (rows from the top of the form). labelWidth (optional parameter with the default value SAP_ISRdefaultLabelWidth = 30) determines the width of the labels for the input fields in the list. Example: ` x = 1; y = 1` ` SAP_ISRFieldListBegin( x , y , 018) ` ` SAP_ISRLabel( labelText="from office", left = x+13); ` ` SAP_ISRField( name="ISR_INITIATED_BY-BUILDING" ) ` ` SAP_ISRField( name="ISR_INITIATED_BY-FLOOR" ) ` ` SAP_ISRField( name="ISR_INITIATED_BY-ROOM_NO" ) ` ` SAP_ISRFieldListEnd( ) ` `

SAP_ISRFieldListRowBegin( )

and

SAP_ISRFieldListRowEnd( ) Defines a series of form elements in a list of form elements that was created using SAP_ISRFieldListBegin().Example: ` x = 1; y = 1` ` SAP_ISRFieldListBegin( x , y ,018) ` ` SAP_ISRField( name="ISR_INITIATED_BY-FIRSTNAME" ) ` ` SAP_ISRFieldListRowBegin( ) ` ` SAP_ISRField( name="ISR_INITIATED_BY-TEL_NUMBER" ) ` ` SAP_ISRLabel( labelText="-", left = x+23); ` ` SAP_ISRField( name="ISR_INITIATED_BY-TEL_EXTENSION", fieldLabel="noLabel", left=x+22 ) ` ` SAP_ISRFieldListRowEnd( ) ` ` SAP_ISRField( name="ISR_INITIATED_BY-E_MAIL" ) ` ` SAP_ISRField( name="ISR_INITIATED_BY-DEPARTMENT" ) ` ` SAP_ISRFieldListEnd( ) `

SAP_ISRFieldListRowEnd( ) Defines an empty row a list of form elements that was created using SAP_ISRFieldListBegin().

SAP_ISRField( id="", fieldLabel="noLabelSpec", fieldLabelWidth=0, name, mode="enabled", size=0, maxLength=0, inspectionText="",left=0, top=0) Defines an input field with a label and optional text after the input field.The individual parameters mean the following:

id optionalThe ID of the form element, if you want to work in JavaScript.

fieldLabel optionalLabel before the input field. Label="noLabel" results in no label being output.

fieldLabelWidth optionalLabel width.It is not necessary to specify a width in a field list (see above).

name Name of the characteristic for which you create the input field.

mode Optional enabled (ready for input) or disabled (not ready for input)If you define an input field as ready for input but call up the request in the display mode, then the system automatically switches to not ready for input.

size optionalOutput length of the input field. If you do not specify an output length, the system automatically determines the output length of the field.

maxLength OptionalMaximum length of the entry in the input field.If you do not specify an output length, the system automatically determines it.

inspectionText optionalText after the input field.

left optionalPosition of the input field, calculated in columns from the left edge of the form.If you use a field list, the coordinate is calculated automatically.

top optional Position of the input field, calculated in rows from the top edge of the form. If you use a field list, the coordinate is calculated automatically.

Example: ` SAP_ISRField( name="ISR_INITIATED_BY-FIRSTNAME" ) `

SAP_ISRPulldownField( id="", fieldLabel="noLabelSpec", fieldLabelWidth=0, name, key, content="", mode="enabled", size=0, maxLength=0, inspectionText="", onchange="", left=0, top=0 ) Defines a combo box with a label and optional text after the combo box. In the mode="disabled" mode, the system displays a field not ready for entry (rather than a combo box) that contains the value currently selected. The meaning of a parameter corresponds to its function in SAP_ISRField( ) . If you use a field list, the coordinate is calculated automatically.Additional parameters:

key

Name of the table containing the key values for the combo box (for example, you can create the table in BADI SCENARIO_SET_ADDITIONAL_VALUES ). Values from the key table are not issued. If you select a row in the combo box, the corresponding value from the key table is set in the characteristic as name .

content Name of the table containing the labels for the combo box (for example, you can create the table in BADI SCENARIO_SET_ADDITIONAL_VALUES ). These are issued in the combo box list.Example: ` SAP_ISRPulldownField(name="BUILDING_TO", key="BUILDING_OPTION", content="BUILDING_OPTION" ) `

SAP_ISRUserName( id="", fieldLabel="noLabelSpec", fieldLabelWidth=0, name, user, mode="enabled", size=0, maxLength=0, inspectionText="",left=0, top=0) Defines input fields for the parts of a name: ...-FIRSTNAME ...-LASTNAME ...-FULLNAMEA special feature of this function is that if you enter an ambiguous name, or a part of a name and a wild card (*), in the name field, the system generates all users that match this entry. Instead of an input field for the parts of the name, the system presents these users in a combo box, from which you make your selection. The name of the user chosen is copied to the input fields for the parts of the name. The meaning of a parameter corresponds to its function in SAP_ISRField( ). Additional parameters:

user Name of the characteristic for the UserID that belongs to the name entered in the input fields.Example: ` SAP_ISRUserName( name="ISR_INITIATED_BY-LASTNAME", user="ISR_INITIATED_BY-USER_ID")`

SAP_ISRGroupBox(left, top, width, height, groupBoxLabel ) Defines a group box by the coordinates left , top , width and height . GroupBoxLabel is the label for the box.Example: ` SAP_ISRGroupBox(001, 001, 034, 008, FRAME_INITIATED_BY.label) ` or ` SAP_ISRGroupBox(001, 001, 034, 008, „Rahmentext")` Result:Draws box for the person making request, or box with the label Rahmentext .

SAP_ISRLongTextInput( cols=80, rows=4, left=0, top=0 ) Defines the input field for the request long text by its position from the left and top, and with cols (columns) and rows .Example: ` SAP_ISRLongTextInput(cols=110, rows=5, left = 1, top = 1) `

SAP_ISRCheckBox( id="", name, mode="enabled", text="noTextSpec", left=0, top=0, labelWidth=0 )` Defines a check box for the name field by its position from the left and top, with the label text and labelWidth. If you use a field list, the coordinate is calculated automatically.Example: ` SAP_ISRCheckBox( name="CHANGE_PHONE" ) `

SAP_ISRLabel (labelText="", labelIconName="", id="" , left=0, top=0) Defines a simple text on the form.If you use a field list, the coordinate is calculated automatically.Example: ` SAP_ISRLabel( labelText="einText" ) `

SAP_ISRStandardButtons( left , top, buttonWidth=018 ) Outputs the necessary standard pushbuttons for each session in the left, top position. buttonWidth is the width of every button.Example: ` SAP_ISRStandardButtons( 1 , 20 ) `