SAP ABAP SAPSCRIPT
From SapWiki
Contents
- 1 Formato en Sapscript
- 1.1 Fill Characters
- 1.2 Sing to the Left
- 1.3 Sing to the Right
- 1.4 N° Decimals
- 1.5 Ommiting Leading Zeros
- 1.6 Ommiting Leading Sign
- 1.7 Space Compression
- 1.8 Suppresing Initial Values
- 1.9 Ignoring convertion rules
- 1.10 Offset
- 1.11 Omitting the Separator for "Thousands"
- 1.12 Output Lenght
- 1.13 Preceding and Subsequent Text
- 1.14 Right-Justified Output
- 2 Perform en Sapscript
Formato en Sapscript
Fill Characters
&symbol(Ff)&
The figure for customer sales in the KNA1-UMSAT field is $700. The Dictionary description of the field specifies an output length of eight. Symbol Result &KNA1-UMSAT& 700.00 &KNA1-UMSAT(F*)& **700.00 &KNA1-UMSAT(F0)& 00700.00
Sing to the Left
&symbol(<)&
&ITCDP-TDULPOS(<)& -100.00
Sing to the Right
&symbol(>)&
N° Decimals
&symbol(.n)&
&EKPO-MENGE(.4)& 1,234.5600
Ommiting Leading Zeros
Certain symbol values are output with leading zeros. To suppress these values use the Z option.
&symbol(Z)&
Ommiting Leading Sign
Program symbols with numeric values can have a leading sign, which usually appears at the right of the numeric value as a space for positive numbers, or as a minus sign for negative numbers. The S option ensures that the value is formatted without the sign.
&symbol(S)&
Space Compression
The symbol value is viewed as a sequence of “words,” each separated from the next by either one or a string of space characters. The C option replaces each string of space characters with a single space and shifting “words” to the left to close gaps. Leading spaces are completely removed. The results are the same as if the ABAP command CONDENSE was used.
&symbol(C)&
Suppresing Initial Values
The I option suppresses the output of symbols that still contain their initial value.
&symbol(I)&
Ignoring convertion rules
SAPscript conversion routines specified in the Dictionary are automatically recognized and used when program symbols are formatted. These conversions can be prevented with the K option. &symbol(K)&
Offset
&symbol+n&
&symbol& = '123456789' &symbol+3& = '456789'
Omitting the Separator for "Thousands"
&symbol(T)&
Output Lenght
&symbol(l)&
&symbol& = '123456789' &symbol(3)& = '123'
Preceding and Subsequent Text
&'pre-text'symbol'post text'&
&'N° Factura 'VBRK-VBELN&
Right-Justified Output
&symbol(R)&
&symbol& 1234 &symbol(8R)& 1234
Perform en Sapscript
/:PERFORM GET_DATA IN PROGRAM ZPGM1 /:USING &V_EBELN& /:CHANGING &V_NAME1& /:ENDPERFORM
this is a sample form program:
FORM GET_DATA TABLES ITAB STRUCTURE ITCSY
OTAB STRUCTURE ITCSY. DATA : V_EBELN LIKE EKKO-EBELN, V_NAME1 LIKE EKKO-ERNAM, P_NAME1 LIKE EKKO-ERNAM.
READ TABLE ITAB WITH KEY NAME = 'V_EBELN'. IF SY-SUBRC = 0. V_EBELN = ITAB-VALUE.
WHERE EBELN = V_EBELN. SELECT SINGLE ERNAM FROM EKKO INTO V_NAME1
IF SY-SUBRC = 0. READ TABLE OTAB WITH KEY NAME = 'V_NAME1'. IF SY-SUBRC = 0. OTAB-VALUE = V_NAME1. MODIFY OTAB INDEX SY-TABIX. ENDIF. ENDIF. ENDIF.