Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

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.

Tags:
replied

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

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question