cancel
Showing results for 
Search instead for 
Did you mean: 

passing value to script

Former Member
0 Kudos

hi all,

need advice from you guys.

my code in SCRIPT is as below

PERFORM  AMOUNT_VALUE IN PROGRAM ZFI_CHEQUE
USING ®UH-VBLNR&
USING ®UP-BELNR&
USING ®UP-BUZEI&
USING ®UP-BUKRS&
USING ®UP-GJAHR&
CHANGING &VATAMT&
CHANGING &TAXAMT&
ENDPERFORM

amd my preform program is as below:

FORM amount_value TABLES pt_input STRUCTURE itcsy
                        pt_output STRUCTURE itcsy.
  DATA : "own declaration
"select statement and manipulation


    READ TABLE pt_output WITH KEY name = 'VATAMT'.
    IF sy-subrc EQ 0.
      pt_output-value = w_vatamt.
    ENDIF.
    MODIFY pt_output TRANSPORTING value WHERE name = 'VATAMT'.

    READ TABLE pt_output WITH KEY name = 'TAXAMT'.
    IF sy-subrc EQ 0.
      pt_output-value = w_taxamt.
    ENDIF.
    MODIFY pt_output TRANSPORTING value WHERE name = 'TAXAMT'.

but, when i pass back the value to script, the value become character, which does not have the thousand separator with it. i want it to be in currency format( with thousand separator). how am i going to do so?

please help. thanks

Accepted Solutions (1)

Accepted Solutions (1)

former_member196280
Active Contributor
0 Kudos

Yes, value will store in character format as itcsy-VALUE is character type,

To over come this do it like this...

Example1:

data: amount type p decimals 2.

data: num1(15).

data: num2(15).

num1 = '1234567.43'.

MOVE num1 to amount.

<i><b>WRITE amount to num2.</b></i>

<b>output</b>

num1 = 1234567.43

amount = 1,234,567.43

<i><b>num2 = 1,234,567.43</b></i>

EXAMPLE 2:

num1 = '1234567.43'.

MOVE num1 to amount.

<i><b>MOVE amount to num2.</b></i>

<b>output</b>

num1 = 1234567.43

amount = 1,234,567.43

<b><i>num2 = 1234567.43</i></b>

Use WRITE- TO,

I guess you understood the concept, close the thread if your question is answered.

regards,

SaiRam

Former Member
0 Kudos

OHHHH,,,,

than you so much!!!!!, you really help me solve my headdache problem........ thanksssss

Answers (1)

Answers (1)

Simha_
Employee
Employee
0 Kudos

Hi,

Country-Dependent Formatting: SET COUNTRY The formatting for certain field types depends on the country settings. These field types include, for example, date fields and number fields that include either a decimal point or the ‘thousands’ separator character. The formatting options defined in the user master record are usually the ones used here. To choose a formatting option other than the one specified in the user master record, use the SET COUNTRY control command. The country-dependent formatting options are stored in the T005X table. Syntax: /: SET COUNTRY country_key You can enter the country key either as a literal value enclosed in quotes or as a symbol.

/: SET COUNTRY 'CAN' /: SET COUNTRY &country_key& Use a blank country name to revert to the setting found in the user master record: /: SET COUNTRY ' ' This SAPscript command actually calls the corresponding ABAP command internally. This guarantees the effect of the SAPscript command to be identical with that of the ABAP command.

If the formatting turns out not to be as required, then you should check the settings in table T005X.

in ur form delare like this ..

code it as the below in ur Form

/: SET COUNTRY 'US'

/: IF &LIPS-WERKS& = '1001'

/: DEFINE &CURRENCY& = 'USD'

/: ELSE

/: DEFINE &CURRENCY& = &SO_TEXT-CURRENCY&

/ ENDIF

ZX ,,

TOTAL FOR SHIPMENT &VBDKL-VBELN&:,,¤cy&,
,,&ci2-netwr(12.2)& <>

Im using type USD format or custom format based on the plant.

hope this helps ,

Cheers,

Simha.