Skip to Content
avatar image
Former Member

Script Decimal Notation

Hi,

I have to print date format and currency format in the script according the Bill to Party Country .

Example : If the Country of the Bill to party is U.K , then the Decimal notation should change to U.K.format .

and the Same date format also and address also.

Is there any function module to do this or is there any another way to acheive this.

Thanks,

Satya.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Best Answer
    avatar image
    Former Member
    Oct 19, 2008 at 12:42 PM

    Hi Satya,

    Code which i have shown will print the date format according to the country.

    Copy paste and execute the code.

    DATA: D8(20),

    WA_MASK LIKE DD01D-CONVEXIT,

    MONTH_NAMES LIKE T247 OCCURS 12 WITH HEADER LINE.

    TABLES: T005. "Countries

    PARAMETERS: DATE LIKE SY-DATUM DEFAULT SY-DATLO.

    SELECT-OPTIONS S_LAND FOR T005-LAND1 NO INTERVALS.

    PARAMETERS: P_LANGU AS CHECKBOX DEFAULT 'X'.

    ----


    START-OF-SELECTION.

    D8 = DATE.

    DESCRIBE FIELD DATE EDIT MASK WA_MASK.

    WRITE: 'MASK IS :- ''', WA_MASK NO-GAP, '''' NO-GAP.

    SKIP.

    PERFORM WRITE_DATE.

    LOOP AT S_LAND.

    • BREAK-POINT.

    SET COUNTRY S_LAND-LOW.

    SKIP.

    ULINE.

    WRITE: / 'COUNTRY SET TO', S_LAND-LOW COLOR 2.

    IF P_LANGU IS INITIAL.

    PERFORM WRITE_DATE.

    ELSE.

    SELECT SPRAS INTO T005-SPRAS FROM T005

    WHERE LAND1 = S_LAND-LOW.

    CATCH SYSTEM-EXCEPTIONS

    TEXTENV_INVALID = 1

    TEXTENV_KEY_INVALID = 2

    • TEXTENV_LANGUAGE_NOT_ALLOWED = 3

    TEXTENV_CODEPAGE_NOT_ALLOWED = 4.

    SET LOCALE LANGUAGE T005-SPRAS.

    ENDCATCH.

    IF SY-SUBRC <> 0.

    ULINE.

    WRITE: / 'Language (T005)', T005-SPRAS,

    'is not valid for output'.

    PERFORM WRITE_DATE.

    CONTINUE.

    ENDIF.

    REFRESH MONTH_NAMES.

    CALL FUNCTION 'MONTH_NAMES_GET'

    EXPORTING

    LANGUAGE = T005-SPRAS

    • IMPORTING

    • RETURN_CODE =

    TABLES

    MONTH_NAMES = MONTH_NAMES

    EXCEPTIONS

    MONTH_NAMES_NOT_FOUND = 1

    OTHERS = 2.

    IF SY-SUBRC <> 0.

    • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

    • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

    ENDIF.

    • READ TABLE MONTH_NAMES INDEX DATE+4(2).

    READ TABLE MONTH_NAMES WITH KEY MNR = DATE+4(2).

    ULINE.

    WRITE: / 'Month name is', MONTH_NAMES-KTX, MONTH_NAMES-LTX,

    'Language (T005) is', T005-SPRAS, '(SYST)', SY-LANGU.

    PERFORM WRITE_DATE.

    ENDSELECT.

    IF SY-SUBRC <> 0.

    PERFORM WRITE_DATE.

    ENDIF.

    ENDIF.

    ENDLOOP.

    SET COUNTRY SPACE.

    SET LOCALE LANGUAGE SPACE.

    REFRESH MONTH_NAMES.

    CALL FUNCTION 'MONTH_NAMES_GET'

    EXPORTING

    LANGUAGE = SY-LANGU

    • IMPORTING

    • RETURN_CODE =

    TABLES

    MONTH_NAMES = MONTH_NAMES

    EXCEPTIONS

    MONTH_NAMES_NOT_FOUND = 1

    OTHERS = 2.

    IF SY-SUBRC <> 0.

    • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

    • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

    ENDIF.

    • READ TABLE MONTH_NAMES INDEX DATE+4(2).

    READ TABLE MONTH_NAMES WITH KEY MNR = DATE+4(2).

    SKIP.

    ULINE.

    WRITE: / 'COUNTRY SET TO', 'SPACE' COLOR 2,

    / 'Month name is', MONTH_NAMES-KTX, MONTH_NAMES-LTX.

    PERFORM WRITE_DATE.

    ----


    • Form WRITE_DATE *

    ----


    • text *

    ----


    FORM WRITE_DATE.

    WRITE:

    / DATE DD/MM/YYYY, 22 'DD/MM/YYYY',

    / DATE MM/DD/YYYY, 22 'MM/DD/YYYY',

    / DATE DD/MM/YY , 22 'DD/MM/YY',

    / DATE MM/DD/YY , 22 'MM/DD/YY',

    / DATE DDMMYY , 22 'DDMMYY',

    / DATE MMDDYY , 22 'MMDDYY',

    / DATE YYMMDD , 22 'YYMMDD'.

    SKIP.

    WRITE:

    / D8 USING EDIT MASK '==LDATE', 'LDATE',

    / D8 USING EDIT MASK '==SDATE', 'SDATE',

    / D8 USING EDIT MASK '==IDATE', 'IDATE',

    / D8 USING EDIT MASK '==D3DAT', 'D3DAT',

    / D8 USING EDIT MASK '==PDATE', 'PDATE',

    / D8 USING EDIT MASK '==INVD1', 'INVD1',

    / D8 USING EDIT MASK '==INVDT', 'INVDT',

    / D8 USING EDIT MASK '==MODAT', 'MODAT',

    / D8 USING EDIT MASK '==ESDAT', 'ESDAT',

    / D8 USING EDIT MASK '==JPDAT', 'JPDAT',

    / D8 USING EDIT MASK '==BEGDA', 'BEGDA',

    / D8 USING EDIT MASK '==ENDDA', 'ENDDA',

    / D8 USING EDIT MASK '==PCDAT', 'PCDAT',

    / D8 USING EDIT MASK '==REDAT', 'REDAT'.

    ENDFORM. " WRITE_DATE

    Cheers!!

    Balu

    Edited by: Balu CH on Oct 19, 2008 6:12 PM

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Oct 19, 2008 at 12:15 PM

    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 u2018thousandsu2019 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.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Dec 06, 2010 at 04:25 PM

    answered

    Add comment
    10|10000 characters needed characters exceeded