切换事务码的方法

        CALL FUNCTION 'PRGN_SHOW_EDIT_AGR'   ”在新窗口显示
          STARTING NEW TASK 'PFCG'
          EXPORTING
            agr_name      = usagr-agr_name
            mode          = 'A'
            screen        = '1'
            sicht         = '1'
          EXCEPTIONS
            agr_not_found = 1
            OTHERS        = 2.
        IF sy-subrc EQ 1.
*         Role & does not exist
          MESSAGE e410(s#) WITH usagr-agr_name.
        ELSE.
*         &1 wird in neuem Modus angezeigt (in &2)
          MESSAGE s583(so) WITH usagr-agr_name.
        ENDIF.
                
        CALL FUNCTION 'PRGN_SHOW_EDIT_AGR' "在原窗口打开
          EXPORTING
            agr_name      = usagr-agr_name
            mode          = 'A'
            screen        = '1'
            sicht         = '1'
          EXCEPTIONS
            agr_not_found = 1
            OTHERS        = 2.
        IF sy-subrc EQ 1.
*         Role & does not exist
          MESSAGE e410(s#) WITH usagr-agr_name.
        ENDIF.

 

    也可以使用,只能在原窗口打开。

   SET PARAMETER ID 'ANR' FIELD SORDER-AUFNR .
 CALL TRANSACTION 'CO03' AND SKIP FIRST SCREEN.

 

   也可以用 call selection-screen 1000. 返回选择屏幕

 

    当然切换之前不要忘记权限检查:

     CALL FUNCTION 'AUTHORITY_CHECK_TCODE'
   EXPORTING
     tcode  = 'PFCG'
   EXCEPTIONS
     ok     = 0
     not_ok = 2.

   CALL FUNCTION 'PRGN_AUTH_ACTIVITY_GROUP'
   EXPORTING
     activity_group = usagr-agr_name
     action_display = 'X'
   EXCEPTIONS
     not_authorized = 1
     OTHERS         = 2.

你可能感兴趣的:(切换事务码的方法)