ydemo sapscript 90 formatting

6
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 formatting1 of 6

Upload: brayhan-e-contreras-reyes

Post on 24-Oct-2015

23 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: Ydemo Sapscript 90 Formatting

This is a collection of output that demonstrates how fields can be formatted whenwriting 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 formatting1 of 6

Page 2: Ydemo Sapscript 90 Formatting

Trailing sign&rv50a-lfpmg(>)&

12,345,678.000-

Leading characters (Fillers)With zeros (0): &rv50a-lfpmg(F0)&

With zeros (0): 00012,345,678.000-With asterisks (*): &rv50a-lfpmg(F*)&

With asterisks (*): ***12,345,678.000-With Xes: &rv50a-lfpmg(FX)&

With Xes: XXX12,345,678.000-

Dropping decimal placesUnmodified: &rv50a-lfpmg(.0)&

Unmodified: 12,345,678.000-Zero decimals: &rv50a-lfpmg(.0)&

Zero decimals: 12,345,678-Two decimals: &rv50a-lfpmg(.2)&

Two decimals: 12,345,678.00-

Dropping leading zerosUnmodified: &RV50A-MATNR&

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

Compressed: 123

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

Page 3: Ydemo Sapscript 90 Formatting

Remove extraneous or leading blanks (Compress)Without compression ( 10.00)

Without compression ( 10.00)With compression (10.00)

With compression (10.00)

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

Original 0.00Supress zero &MSEG-BNBTR(I)&

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

Enabling/disabling a conversion exit(eg: CONVERSION_EXIT_MATN1_OUTPUT)

With standard conversion &RV50A-MATNR&With standard conversion 123

Without conversion &RV50A-MATNR(K)&Without conversion 000000000000000123

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

Page 4: Ydemo Sapscript 90 Formatting

Country specific presentationsee -> T005X, T005T for country codesDefault 15.06.1998

/: SET COUNTRY 'DE 'Deutschland 15.06.1998

/: SET COUNTRY 'US 'USA 06/15/1998

/: SET COUNTRY 'SESwenska 15.06.1998

/: SET COUNTRY ' 'Back to default 15.06.1998

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 formatting4 of 6

Page 5: Ydemo Sapscript 90 Formatting

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 secDay of week &NAME_OF_DAY& = Freitag (from table TTDTG)Day &DAY& = 29Day &DAY(Z)& without leading '0': 29Month &MONTH& = 12Month as a text &NAME_OF_MONTH& = Dezember (from table TTDTG)Year &YEAR& = 2000Two digit year &YEAR+2(2)& = 00Hours &HOURS& = 15Hours without leading '0' &HOURS(Z)& = 15Minutes &MINUTES& = 35Minutes without leading '0' &MINUTES(Z)& = 35Seconds &SECONDS(Z)& = 12Seconds without leading '0' &SECONDS(Z)& = 12

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

Page 6: Ydemo Sapscript 90 Formatting

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 1Output and increase counter 1 &SAPSCRIPT-COUNTER_1(+)&

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

Output and increase again counter 1 3Output counter 2 &SAPSCRIPT-COUNTER_2&

Output counter 2 0Output and decrease counter 1 &SAPSCRIPT-COUNTER_1(-)&

Output and decrease counter 1 2

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

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

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