Displaying Fields That Refer to Currencies or Quantities


In the ABAP Dictionary, you can assign a currency or quantity field to a table field if the table field contains a currency or quantity value. When printing these fields, SAP Smart Forms can take into account the assigned currency or unit:

  • If the value field is in the same table as the assigned currency or quantity field, SAP Smart Forms automatically recognizes this and, during output, formats the value field according to the currency or unit in the assigned field.
  • If the value field and the assigned currency or quantity field are stored in different tables, SAP Smart Forms cannot automatically recognize the relationship.

In the second case, you must inform SAP Smart Forms about the relationship.


As mentioned above, you only have to perform the following steps if a value field that is to be displayed in a table (for example, VALTAB) has a relationship to a currency or quantity field in another table (for example, CURTAB). In this case, you have to specify the relationship explicitly:

  1. In the form, define a global field of the same type as the table in which the currency or quantity field is stored, for example WA_CURTAB. Also define a work area for the output of your value field, for example WA_VALTAB.

    If you use a table with a header line, you do not need to define a work area. Instead, you work through the following steps with the header line of the relevant table. In the following step, for example, you would specify the field VALTAB-VALUE instead of WA_VALTAB-VALUE under Field Name.

  2. Create the relationship to the currency field by switching to the Currency/Quantity fields of the Global Definitions node and entering the following values:
    • Field name: WA_VALTAB-VALUE if this is the value field of VALTAB that is to be output
    • Reference field: WA_CURTAB-CURRENCY, therefore the currency field of CURTAB
  1. Use the work area WA_VALTAB on the data tab page of your table node or loop node.
  2. Create a program lines node before the event at which the value field is printed.
  3. In the program lines node, assign the currency or unit in which you want to format the value field WA_VALTAB-VALUE to the currency or quantity field of the global field WA_CURTAB-CURRENCY. You have to either select the value of WA_CURTAB-CURRENCY afterwards or have already passed it to the form interface.
  4. Display or print the value field WA_VALTAB-VALUE.


During output, SAP Smart Forms formats the value field WA_VALTAB-VALUE according to the value assigned to the currency or quantity field of the global variable WA_CURTAB_CURRENCY.