Translation in SAPscript

Translation in SAPscript

Here is how to call ABAP programs to translate headings and similar.
ZNFIXTEXT is a table with codes to text by language.
This way a single-language version is maintained that supports any language requested.
SAPscript...
/*   Text Shells 
/: DEFINE &CUST_TXT&          = 'CUST#'
/: DEFINE &VAT_TXT&           = 'VAT_NUM'
/*   Calculation Shells 
/: PERFORM  FIXED_TEXT IN PROGRAM ZZ_ES_SD_INVOICE
/: USING &NAST-SPRAS&
/: USING &CUST_TXT&
/: USING &VAT_TXT&
/: CHANGING &CUST_TXT&
/: CHANGING &VAT_TXT&
/: ENDPERFORM
abap:
 form fixed_text tables inttab structure itcsy
                        outtab structure itcsy.
   data:   lt_language like sy-langu,
           lt_iso      like t002-laiso,
           ln_tabix    like sy-tabix,
  read table inttab index 1.

  if sy-subrc eq 0.
    lt_iso = inttab-value.
    call function 'LANGUAGE_CODE_ISO_TO_SAP'
         exporting
              iso_code  = lt_iso
         importing
              sap_code  = lt_language
         exceptions
              not_found = 1
              others    = 2.
    if sy-subrc <> 0.
      "do nothing - it will pick up English by default
    endif.
  endif.

  describe table inttab lines ln_lines.
  if ln_lines < 2.
    exit.
  endif.
  loop at inttab from 2.
    read table outtab with key name = inttab-name.
    read table outtab with key name = inttab-name.
    if sy-subrc ne 0.
      continue.
    else.
      ln_tabix = sy-tabix.
    endif.

    perform svs_read_znfixtext using    inttab-value

    Requires Free Membership to View

    When you register, you will start receiving targeted emails from my award-winning team of editorial writers. Our goal is to keep you informed on the hottest topics and biggest challenges faced by SAP professionals today.

    Hannah Smalltree, Editorial Director

    By submitting your registration information to SearchSAP.com you agree to receive email communications from TechTarget and TechTarget partners. We encourage you to read our Privacy Policy which contains important disclosures about how we collect and use your registration and other information. If you reside outside of the United States, by submitting this registration information you consent to having your personal data transferred to and processed in the United States. Your use of SearchSAP.com is governed by our Terms of Use. You may contact us at webmaster@TechTarget.com.

lt_language changing outtab-value. modify outtab index ln_tabix. endloop. endform. " FIXED_TEXT

This was first published in November 2003

Disclaimer: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.