Вы находитесь на странице: 1из 6

SAP R/3 Cookbook Page - Example of Sapscript output formatting1 of

This is a collection of output that demonstrates how fields can be formatted when writing to an SapScript element.

This is the original content of the variable:


/: DEFINE &A_VARIABLE&&= 'The quick brown fox jumps over the lazy dog.'

The quick brown fox jumps over the lazy dog.

Placing an offset
&A_VARIABLE+16&

fox jumps over the lazy dog.

Substr-Functionality
&A_VARIABLE+16(3)&

fox

Output a numeric value (Type P etc.)


&rv50a-lfpmg&

12,345,678.000-

Drop the sign


&rv50a-lfpmg(S)&

12,345,678.000

Leading sign
&rv50a-lfpmg(<)&

-12,345,678.000

SAP R/3 Cookbook Page - Example of Sapscript output formatting2 of

Trailing sign
&rv50a-lfpmg(>)&

12,345,678.000-

Leading characters (Fillers)


With zeros (0): &rv50a-lfpmg(F0)&

With zeros (0):


With asterisks (*):

00012,345,678.000&rv50a-lfpmg(F*)&

With asterisks (*):


With Xes: &rv50a-lfpmg(FX)&

***12,345,678.000XXX12,345,678.000-

With Xes:

Dropping decimal places


Unmodified: &rv50a-lfpmg(.0)&

Unmodified:
Zero decimals: &rv50a-lfpmg(.0)&

12,345,678.00012,345,678&rv50a-lfpmg(.2)&

Zero decimals:
Two decimals:

Two decimals:

12,345,678.00-

Dropping leading zeros


Unmodified: &RV50A-MATNR&

Unmodified:
Compressed: &RV50A-MATNR(Z)&

123 123

Compressed:

SAP R/3 Cookbook Page - Example of Sapscript output formatting3 of

Remove extraneous or leading blanks (Compress)


Without compression ( 10.00)

Without compression
With compression (10.00)

( (10.00)

10.00)

With compression
Original &MSEG-BNBTR&

Suppress printing a zero value & rv50a-lfpmg(I) &


Original
Supress zero &MSEG-BNBTR(I)&

0.00

Supress zero (prints nothing, if zero! ;-) )

Enabling/disabling a conversion exit


(eg: CONVERSION_EXIT_MATN1_OUTPUT)
With standard conversion &RV50A-MATNR&

With standard conversion


Without conversion

123
&RV50A-MATNR(K)&

Without conversion

000000000000000123

SAP R/3 Cookbook Page - Example of Sapscript output formatting4 of

Country specific presentation


see -> T005X, T005T for country codes Default
/: SET COUNTRY 'DE '

15.06.1998 15.06.1998 06/15/1998 15.06.1998 15.06.1998

Deutschland
/: SET COUNTRY 'US '

USA
/: SET COUNTRY 'SE

Swenska
/: SET COUNTRY ' '

Back to default

Set a date mask


/: SET DATE MASK = ''

With default date mask: 15.06.1998


/: SET DATE MASK = 'Anno Domino YYYY, on the DDth day of MMM'

With date mask: Anno Domino 1998, on the 15th day of Jun

Set a time mask


/: SET TIME MASK = ' '

Time is: 15:35:12


/: SET TIME MASK = 'HH o''clock MM minutes and SS second'

With date mask: 15 o'clock 35 minutes and 12 second

SAP R/3 Cookbook Page - Example of Sapscript output formatting5 of

More Time Variables


&NAME_OF_DAY&&YEAR&&NAME_OF_MONTH&&DAY& @ &HOURS& h&MINUTES& min &SECONDS& sec

Freitag 2000 Dezember 29 @ 15 h 35 min 12 sec Day of week &NAME_OF_DAY& = Freitag (from table TTDTG) Day &DAY& = 29 Day &DAY(Z)& without leading '0': 29 Month &MONTH& = 12 Month as a text &NAME_OF_MONTH& = Dezember (from table TTDTG) Year &YEAR& = 2000 Two digit year &YEAR+2(2)& = 00 Hours &HOURS& = 15 Hours without leading '0' &HOURS(Z)& = 15 Minutes &MINUTES& = 35 Minutes without leading '0' &MINUTES(Z)& = 35 Seconds &SECONDS(Z)& = 12 Seconds without leading '0' &SECONDS(Z)& = 12

SAP R/3 Cookbook Page - Example of Sapscript output formatting6 of

Output and increase counter


/: DEFINE &SAPSCRIPT-COUNTER_1& = '1' &SAPSCRIPT-COUNTER_1(+) &(you have counters 1 to 9) Output only counter 1 &SAPSCRIPT-COUNTER_1&

Output only counter 1


Output and increase counter 1

1
&SAPSCRIPT-COUNTER_1(+)&

Output and increase counter 1 Output and increase again counter 1 Output counter 2
Output and decrease counter 1

2 3 0
&SAPSCRIPT-COUNTER_1(-)&

Output and increase again counter 1 &SAPSCRIPT-COUNTER_1(+)& Output counter 2 &SAPSCRIPT-COUNTER_2&

Output and decrease counter 1

Page Information
Total number of pages &SAPSCRIPT-FORMPAGES& = 6 Actual page number &PAGE& = 6 Next page &NEXTPAGE& will be "Page 7"(will be zero if you are on last page) Total number of pages of job &SAPSCRIPT-JOBPAGES& = 6 Output device driver &SAPSCRIPT-DRIVER& is "SWIN" Most recent SapScript return code &SAPSCRIPT-SUBRC&is " 0"

Facsimile Information
If it were a fax, following information would be passed to SAPFAX.DLL Country="&SAPSCRIPT-TELELAND&" () Dialled number=" &SAPSCRIPT-TELENUM&" () Fax Number specified="&SAPSCRIPT-TELENUME&"

Вам также может понравиться