Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Problem while creating Transaction Code

Former Member
0 Likes
1,847

hi experts,

I m new to abap and I've been given to copy a standard program to make some changes in it.

But before i could do changes i thought of first copying the standard program and creating a transaction for it to see if it works as standard or not.

Now when i run the report usig this transaction it gives error "Transaction code not defined".

On clicking on its help the detail error says: "You have called up the program without defining a corresponding transaction code. This is probably beacause variant maintenance has been called up using se38. It is not possible to create variants using this transaction."

The standard program is RKAEP000. and only its transaction cpb1 needs to be copied with screen 120 which should be assigned to the transaction as in standard.

how should i handle it?

Please help.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,640

hi experts

please help as m not getting any direction to it.

9 REPLIES 9
Read only

Former Member
0 Likes
1,640

Create a Z-(or Y-) transaction using SE93 t-code.

Steps are

1. Put the proposed name of the t-code(must start with Z or Y) and click on "Create".

2. Give a "Short Text". Select Start Object "Program and Selection Screen(Report Transaction)"

3. Enter the program name.

Read only

Former Member
0 Likes
1,640

when you copied the program from standard one you have to see that which is the main screen or youare using the selection screen.

after u got that screen no you have to mention the screen no in that creation of the t-code.

hope it will help you malhotra.

Read only

Former Member
0 Likes
1,640
Read only

Former Member
0 Likes
1,640

i've checked that screen 120 is of type selection screen but when i copy this to my z program its type changes from selection screen to normal screen. And moreover it doesnot allow me to change its type. as the radiobutton of seletion screen is disabled.

please help.

Read only

uwe_schieferstein
Active Contributor
0 Likes
1,640

Hello Annie

If you look at the coding of report RKAEP000 you see that at event

AT SELECTION-SCREEN OUTPUT.

the routine <b>TRANSACTION_INIT</b> is called.

FORM transaction_init
*&---------------------------------------------------------------------*
USING    value(v_tcode) LIKE p_tcode
*&---------------------------------------------------------------------*
CHANGING c_item_group   TYPE kaep_item_group
         c_rep_object   TYPE kaep_rep_object
         c_update       TYPE kaep_flag
         c_sign_apc     LIKE rkact_cl-sign_ap
         c_title        LIKE rsmpe-titcode.
*----------------------------------------------------------------------*

  CLEAR gd.

  IF sy-batch IS INITIAL OR c_item_group IS INITIAL.       "note 193499
    "parameters must be filled in batch mode

    CALL FUNCTION 'K_LINE_ITEM_LOGICAL_KEY_GET'
      EXPORTING
        i_tcode            = v_tcode
      IMPORTING
        e_item_group       = c_item_group
        e_rep_object       = c_rep_object
        e_update           = gd-update
      EXCEPTIONS
        unknow_transaction = 1.

<b> IF sy-subrc = 1.

MESSAGE e496(kb).

ENDIF.</b>

    CALL FUNCTION 'K_LINE_ITEM_APC_SIGN_GET'
      EXPORTING
        i_item_group = c_item_group
      IMPORTING
        e_sign_apc   = c_sign_apc.

  ENDIF.
  CONCATENATE c_item_group c_rep_object c_update INTO c_title.
  gs_display_variant-report = self.
  gs_display_variant-handle = c_item_group.
  gs_display_variant-log_group = c_rep_object.

ENDFORM.                               " TRANSACTION_INIT

The function module K_LINE_ITEM_LOGICAL_KEY_GET does not know your transaction and therefore returns an error.

To overcome this problem you can change the coding in your copied report as following:

*&---------------------------------------------------------------------*
AT SELECTION-SCREEN OUTPUT.
*&---------------------------------------------------------------------*
* Transaction initialization must be done here because parameters are
* not filled at INITIALIZATION when called via SUBMIT
*&---------------------------------------------------------------------*

  CHECK sscrfields-ucomm(2) NE 'UC'.
  IF p_tcode IS INITIAL.
    p_tcode = sy-tcode.
  ENDIF.

  GET PARAMETER ID 'TPB' FIELD p_valtyp.
  IF sy-subrc NE 0.
    GET PARAMETER ID 'VTP' FIELD p_valtyp.
  ENDIF.

  PERFORM transaction_init 
                           USING    'CPB1'     " p_tcode
                           CHANGING p_item
                                    p_obj
                                    gd-update
                                    gd-sign_apc
                                    gd-title.
...

Simply replace the variable <i>p_tcode</i> with the original transaction code.

Regards

Uwe

Read only

Former Member
0 Likes
1,641

hi experts

please help as m not getting any direction to it.

Read only

0 Likes
1,640

Hello Annie

As mentioned before the coding

    IF sy-subrc = 1.
      MESSAGE e496(kb).  " Transaction code not defined
    ENDIF.

gives you the error message.

Thus, if you modify the PERFORM <i>transaction_init</i> as described above the report should work.

See the coding of function module <b>K_LINE_ITEM_LOGICAL_KEY_GET</b> to get the allowed transactions:

FUNCTION K_LINE_ITEM_LOGICAL_KEY_GET.
*"----------------------------------------------------------------------
*"*"Lokale Schnittstelle:
*"       IMPORTING
*"             VALUE(I_TCODE) LIKE  SY-TCODE DEFAULT SY-TCODE
*"       EXPORTING
*"             VALUE(E_ITEM_GROUP) TYPE  KAEP_ITEM_GROUP
*"             VALUE(E_REP_OBJECT) TYPE  KAEP_REP_OBJECT
*"             VALUE(E_UPDATE) TYPE  KAEP_FLAG
*"       EXCEPTIONS
*"              UNKNOW_TRANSACTION
*"----------------------------------------------------------------------
  CLEAR E_UPDATE.

  CASE I_TCODE.
* documents
    WHEN 'KSB5'.
      E_ITEM_GROUP = CON_ITEM_GROUP-COST_ACTUAL.
      E_REP_OBJECT = CON_REP_OBJECT-DOCUMENTS.
    WHEN 'KABP'.
      E_ITEM_GROUP = CON_ITEM_GROUP-COST_PLAN.
      E_REP_OBJECT = CON_REP_OBJECT-DOCUMENTS.
* cost centers
    WHEN 'KSB1'.
      E_ITEM_GROUP = CON_ITEM_GROUP-COST_ACTUAL.
      E_REP_OBJECT = OBJEKTART_KS.
    WHEN 'KSBP'.
      E_ITEM_GROUP = CON_ITEM_GROUP-COST_PLAN.
      E_REP_OBJECT = OBJEKTART_KS.
    WHEN 'KSB2'.
      E_ITEM_GROUP = CON_ITEM_GROUP-COMMITMENTS.
      E_REP_OBJECT = OBJEKTART_KS.
    WHEN 'KSB8'.
      E_ITEM_GROUP = CON_ITEM_GROUP-BUDGET.
      E_REP_OBJECT = OBJEKTART_KS.
* orders
    WHEN 'KOB1' OR 'KRMI'.
      E_ITEM_GROUP = CON_ITEM_GROUP-COST_ACTUAL.
      E_REP_OBJECT = OBJEKTART_OR.
    WHEN 'KOBP'.
      E_ITEM_GROUP = CON_ITEM_GROUP-COST_PLAN.
      E_REP_OBJECT = OBJEKTART_OR.
    WHEN 'KOB4'.
      E_ITEM_GROUP = CON_ITEM_GROUP-BUDGET.
      E_REP_OBJECT = OBJEKTART_OR.
    WHEN 'KOB5'.                         " IM-Auftraege EP Aufteilung
      E_ITEM_GROUP = CON_ITEM_GROUP-SETTLEMENT.
      E_REP_OBJECT = OBJEKTART_OR.
      E_UPDATE     = CON_ON.
    WHEN 'KOB6'.                         " IM-Auftraege EP Anzeige
      E_ITEM_GROUP = CON_ITEM_GROUP-SETTLEMENT.
      E_REP_OBJECT = OBJEKTART_OR.
      E_UPDATE     = CON_OFF.
    WHEN 'KOB7'.                         " IM-Auftraege EP Abgang
      E_ITEM_GROUP = CON_ITEM_GROUP-RETIREMENT.
      E_REP_OBJECT = OBJEKTART_OR.
      E_UPDATE     = CON_ON.
    WHEN 'KOB2'.
      E_ITEM_GROUP = CON_ITEM_GROUP-COMMITMENTS.
      E_REP_OBJECT = OBJEKTART_OR.
    WHEN 'KOB3' OR 'KKFB'.
      E_ITEM_GROUP = CON_ITEM_GROUP-DEVIATION.
      E_REP_OBJECT = OBJEKTART_OR.
    WHEN 'KOB8'.
      E_ITEM_GROUP = CON_ITEM_GROUP-RESULT_ANALYSIS.
      E_REP_OBJECT = OBJEKTART_OR.

<b>* business processes

WHEN 'CPB1'.</b>

      E_ITEM_GROUP = CON_ITEM_GROUP-COST_ACTUAL.
      E_REP_OBJECT = OBJEKTART_BP.
    WHEN 'CPBP'.
      E_ITEM_GROUP = CON_ITEM_GROUP-COST_PLAN.
      E_REP_OBJECT = OBJEKTART_BP.
* cost objects
    WHEN 'KKCS'.
      E_ITEM_GROUP = CON_ITEM_GROUP-COST_ACTUAL.
      E_REP_OBJECT = OBJEKTART_HP.
    WHEN 'KKCP'.
      E_ITEM_GROUP = CON_ITEM_GROUP-COST_PLAN.
      E_REP_OBJECT = OBJEKTART_HP.
    WHEN 'KKCA'.
      E_ITEM_GROUP = CON_ITEM_GROUP-DEVIATION.
      E_REP_OBJECT = OBJEKTART_HP.
* sales orders
    WHEN 'KVBI'.
      E_ITEM_GROUP = CON_ITEM_GROUP-COST_ACTUAL.
      E_REP_OBJECT = OBJEKTART_VB.
    WHEN 'KVBO'.
      E_ITEM_GROUP = CON_ITEM_GROUP-COMMITMENTS.
      E_REP_OBJECT = OBJEKTART_VB.
    WHEN 'KKAA'.
      E_ITEM_GROUP = CON_ITEM_GROUP-RESULT_ANALYSIS.
      E_REP_OBJECT = OBJEKTART_VB.
* projects
    WHEN 'CJI3' OR 'CJ74'.               "projects actual line items
      E_ITEM_GROUP = CON_ITEM_GROUP-COST_ACTUAL.
      E_REP_OBJECT = OBJEKTART_PD.
    WHEN 'CJI4' OR 'CJ7M'.               "projects plan line items
      E_ITEM_GROUP = CON_ITEM_GROUP-COST_PLAN.
      E_REP_OBJECT = OBJEKTART_PD.
    WHEN 'CJI5' OR 'CJ76'.               "projects obligo line items
      E_ITEM_GROUP = CON_ITEM_GROUP-COMMITMENTS.
      E_REP_OBJECT = OBJEKTART_PD.
    WHEN 'CJI6'.
      E_ITEM_GROUP = CON_ITEM_GROUP-SKF_ACTUAL.
      E_REP_OBJECT = OBJEKTART_PD.
    WHEN 'CJI7'.
      E_ITEM_GROUP = CON_ITEM_GROUP-SKF_PLAN.
      E_REP_OBJECT = OBJEKTART_PD.
    WHEN 'CJI8'.                         "projects budget line items
      E_ITEM_GROUP = CON_ITEM_GROUP-BUDGET.
      E_REP_OBJECT = OBJEKTART_PD.
    WHEN 'CJI9'.                         "projects strc. plan line items
      E_ITEM_GROUP = CON_ITEM_GROUP-STRC_PLAN.
      E_REP_OBJECT = OBJEKTART_PD.
    WHEN 'CJIA' OR 'CJT2'.               "projects cash act. line items
      E_ITEM_GROUP = CON_ITEM_GROUP-FINANCE_ACTUAL.
      E_REP_OBJECT = OBJEKTART_PD.
    WHEN 'CJIB'.                         "projects cash plan line items
      E_ITEM_GROUP = CON_ITEM_GROUP-FINANCE_PLAN.
      E_REP_OBJECT = OBJEKTART_PD.
    WHEN 'CJIC'   OR   'CJ70'.              " IM-Projekte EP Aufteilung
      E_ITEM_GROUP = CON_ITEM_GROUP-SETTLEMENT.
      E_REP_OBJECT = OBJEKTART_PD.
      E_UPDATE     = CON_ON.
    WHEN 'CJID'   OR 'CJ72'.              " IM-Projekte EP Anzeige
      E_ITEM_GROUP = CON_ITEM_GROUP-SETTLEMENT.
      E_REP_OBJECT = OBJEKTART_PD.
    WHEN 'CJIE'   OR 'CJ7N'.              " IM-Projekte EP Abgang
      E_ITEM_GROUP = CON_ITEM_GROUP-RETIREMENT.
      E_REP_OBJECT = OBJEKTART_PD.
      E_UPDATE     = CON_ON.
    WHEN 'CJIF'.                         "projects res. anal. line items
      E_ITEM_GROUP = CON_ITEM_GROUP-RESULT_ANALYSIS.
      E_REP_OBJECT = OBJEKTART_PD.
    WHEN 'CJIG'.                         "projects cash documents
      E_ITEM_GROUP = CON_ITEM_GROUP-FINANCE_ACTUAL.
      E_REP_OBJECT = CON_REP_OBJECT-DOCUMENTS.
* real estate objects                                             "TH40C
    WHEN 'FOEP0001'                "real estate actual line items "TH40C
    OR   'FOEPA001'                                               "TH40C
    OR   'FOEPV001'.                                              "TH40C
      E_ITEM_GROUP = CON_ITEM_GROUP-COST_ACTUAL.                  "TH40C
      E_REP_OBJECT = OBJEKTART_IW.                                "TH40C
    WHEN 'FOEP0002'                 "real estate com. line items  "TH40C
    OR   'FOEPA002'                                               "TH40C
    OR   'FOEPV002'.                                              "TH40C
      E_ITEM_GROUP = CON_ITEM_GROUP-COMMITMENTS.                  "TH40C
      E_REP_OBJECT = OBJEKTART_IW.                                "TH40C
    WHEN 'FOEP0003'                 "real estate plan line items  "TH40C
    OR   'FOEPA003'                                               "TH40C
    OR   'FOEPV003'.                                              "TH40C
      E_ITEM_GROUP = CON_ITEM_GROUP-COST_PLAN.                    "TH40C
      E_REP_OBJECT = OBJEKTART_IW.                                "TH40C
    WHEN OTHERS.
      RAISE UNKNOW_TRANSACTION.
  ENDCASE.

ENDFUNCTION.

Regards

Uwe

Read only

Former Member
0 Likes
1,640

Hi,

For creating a custom transaction code using SE 93 u can do it,

go to SE93, and give the name starting with Z or Y and rest of ur,

then the in se38 the standard program also copy with Z or Y, then assign the Z or Y program to the custom Z or Y transaction, I hope it will solve ur issue.

Regards,

Nagaraju.

Read only

Former Member
0 Likes
1,640

Thanks so much Uwe, u solved my problem.

i've awarded u ur points.