Change TCode Language Without Logout

*&---------------------------------------------------------------------*
*& Report  ZCHANGE_LANGUAGE
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT zcall_language.

*>>> Deklaration
DATA:
  gt_instlang TYPE TABLE OF t002t.

FIELD-SYMBOLS:
  <gs_instlang> TYPE t002t.

*>>> Selektionscreen
PARAMETERS:
  p_spras LIKE tcp0c-langu DEFAULT 'EN',
  p_tcode TYPE tcode OBLIGATORY.

***********************************************************************
START-OF-SELECTION.
***********************************************************************
* Lesen der installierten Sprachen
  CALL FUNCTION 'PROFILE_LANGUAGE_GET_INFO'
    TABLES
      instlang                   = gt_instlang
    EXCEPTIONS
      instlang_entries_not_found = 1
      syslang_entry_not_found    = 2
      OTHERS                     = 3.

  IF sy-subrc <> 0.
    MESSAGE i372(pu). "Fehler beim Ermitteln der installierten Sprachen
    EXIT.
  ENDIF.

  READ TABLE gt_instlang ASSIGNING <gs_instlang> WITH KEY sprsl = p_spras.
  IF sy-subrc <> 0.
    MESSAGE i091(pf) WITH p_spras. "Language & is not installed
    EXIT.
  ENDIF.

  SET LOCALE LANGUAGE p_spras.
  CALL FUNCTION 'ABAP4_CALL_TRANSACTION'
    DESTINATION 'NONE'
    EXPORTING
      tcode                   = p_tcode
    EXCEPTIONS
      call_transaction_denied = 1
      tcode_invalid           = 2
      OTHERS                  = 3.

  IF sy-subrc <> 0.

    CASE sy-subrc.
      WHEN '1'.
        MESSAGE i077(s#) WITH p_tcode. "You are not authorized to use transaction &
      WHEN '2'.
        MESSAGE i343(s#) WITH p_tcode. "Transaction & does not exist
      WHEN '3'.
        MESSAGE i127(00). "This function is not possible
    ENDCASE.

  ENDIF.



Get help for your ABAP problems
Do you have a ABAP Question?

ABAP Books
ABAP Certification, BAPI, Java, Web Programming, Smart Forms, Sapscripts Reference Books

More ABAP Tips

Best regards,
SAP Basis, ABAP Programming and Other IMG Stuff
http://www.erpgreat.com

All the site contents are Copyright © www.erpgreat.com and the content authors. All rights reserved.
All product names are trademarks of their respective companies.  The site www.erpgreat.com is in no way affiliated with SAP AG. 
Every effort is made to ensure the content integrity.  Information used on this site is at your own risk. 
 The content on this site may not be reproduced or redistributed without the express written permission of 
www.erpgreat.com or the content authors.