Skip to Content
avatar image
Former Member

How to set 'Material Master' tab as default in standard transaction CG54?

Hi All

I am having a requirement to call the transaction CG54 from a custom program. On calling the transaction, I need to put some default values to the input fields and the default tab selected should be 'Material Master'. I am able to default input fields using BDC Transaction call. Can anybody guide me how to set Material Master tab as the default tab selected?

Thanks in advance

Rinzy Deena Mathews

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

1 Answer

  • Best Answer
    avatar image
    Former Member
    Aug 19, 2014 at 03:37 AM

    Hi All

    Solved the issue by myself.

    Initialization of tab in transaction CG54 is based on the values in the standard table TCGSGP - EHS: Search parameter (reproduction from SET/GET memory).

    Calling of the transaction CG54, with default values and parameters can be done with the help of following standard function module:

    *-- Types

    TYPES : BEGIN OF t_obj_tab.

    INCLUDE STRUCTURE rcgapplobj.

    TYPES : END OF t_obj_tab.

    TYPES : tt_obj_tab TYPE t_obj_tab OCCURS 20.

    TYPES: BEGIN OF t_zplm02,

    sbgvid TYPE zppr_de_sbgvid,

    END OF t_zplm02.

    *-- Internal Tables

    DATA: li_obj_tab TYPE tt_obj_tab WITH HEADER LINE,

    li_report LIKE rcgstdrecn OCCURS 20 WITH HEADER LINE,

    li_variant LIKE rcgstdrecn OCCURS 20 WITH HEADER LINE,

    li_subid_tab TYPE espre_subid_rep_tab_type WITH HEADER LINE,

    li_report_m LIKE rcgstdrecn OCCURS 20 WITH HEADER LINE,

    li_variant_m LIKE rcgstdrecn OCCURS 20 WITH HEADER LINE,

    li_subid_tab_m TYPE espre_subid_rep_tab_type WITH HEADER LINE,

    li_zplm02 TYPE STANDARD TABLE OF t_zplm02.

    *-- Structures

    DATA: ls_addinf TYPE rcgaddinf,

    ls_rcgradmsel TYPE rcgradmsel,

    lw_zplm02 TYPE t_zplm02.

    *-- Variables

    DATA: lv_trtype TYPE rcgdialctr-trtype VALUE 'D',

    lv_actype TYPE rcgdialctr-actype VALUE 'D',

    lv_viewappl TYPE tcgl3-repappl VALUE 'MATMASTER',

    lv_sel_valdat TYPE rcgradmsel-valdat,

    lv_sel_langu TYPE rcgradmsel-langu,

    lv_ucomm TYPE syucomm,

    lw_gen TYPE char10,

    lv_flag TYPE esp1_boolean,

    lv_werks TYPE werks_d,

    lv_bsbgvid TYPE zppr_de_bsbgvid.

    *-- Parameters

    ls_addinf-aennr = sy-datum.

    ls_addinf-valdat = sy-datum.

    ls_rcgradmsel-sbgvid = iw_gen.

    ls_rcgradmsel-matnr = p_matnr.

    ls_rcgradmsel-namcat = 'MATNR'.

    ls_rcgradmsel-reprefflg = abap_true.

    ls_rcgradmsel-numcat = 'NUM'.

    *-- Application Object

    li_obj_tab-repappl = 'MATMASTER'.

    li_obj_tab-objectkey = p_matnr.

    APPEND li_obj_tab.

    *-- Evaluate selection screen and fill keytab

    CALL FUNCTION 'C1G0_KEYTAB_FILL_FROM_RADMSEL'

    EXPORTING

    i_radmsel = ls_rcgradmsel

    i_valdat = ls_addinf-valdat

    i_actype = lv_actype

    i_flg_popup_no_param = abap_true

    IMPORTING

    e_flg_cancel = lv_flag

    TABLES

    i_applobj_tab = li_obj_tab

    e_keytab_report = li_report

    e_keytab_variant = li_variant

    e_subid_refreport_tab = li_subid_tab

    EXCEPTIONS

    OTHERS = 1.

    *-- Initilize Report Header Buffer

    CALL FUNCTION 'C1AP_ESTDH_BUF_INIT'

    EXPORTING

    i_aennr = ls_addinf-aennr

    i_valdat = ls_addinf-valdat.

    *-- Parameters

    ls_addinf-aennr = sy-datum.

    ls_addinf-valdat = sy-datum.

    ls_rcgradmsel-sbgvid = iw_gen.

    ls_rcgradmsel-matnr = p_matnr.

    ls_rcgradmsel-namcat = 'MATNR'.

    ls_rcgradmsel-reprefflg = abap_true.

    ls_rcgradmsel-numcat = 'NUM'.

    *-- Application Object

    li_obj_tab-repappl = 'MATMASTER'.

    li_obj_tab-objectkey = p_matnr.

    APPEND li_obj_tab.

    *-- Initial report block tree of information

    CALL FUNCTION 'C1G2_ENTRY_INQUIERY'

    EXPORTING

    i_trtype = lv_trtype

    i_actype = lv_actype

    i_addinf = ls_addinf

    i_viewappl = lv_viewappl

    i_sel_valdat = lv_sel_valdat

    i_sel_langu = lv_sel_langu

    i_rcgradmsel = ls_rcgradmsel

    IMPORTING

    e_okcode = lv_ucomm

    TABLES

    i_keytab_report = li_report

    i_keytab_variant = li_variant

    i_subid_refreport_tab = li_subid_tab

    i_applobj_tab = li_obj_tab.

    With Regards

    Rinzy Deena Mathews.

    Add comment
    10|10000 characters needed characters exceeded