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

Program Title Change Issue

Former Member
0 Likes
2,107

Hello everyone,

I have an ALV grid using classes and also included a functionality when double clicked on an line item it would take to the corresponding standard CRM transaction with the number in the line item.

My problem is after working on the standard CRM transaction when i press the back button to come back to the grid display, the program title does not change back to the grids program title instead the standard CRM transaction title remains.

Tried setting the program title when the control comes back from standard CRM transaction, but did not work.

Can somebody suggest me a solution immediatly.

thanks.

11 REPLIES 11
Read only

Former Member
0 Likes
1,698

Hi Suri,

Check with adding the NO STANDARD PAGE HEADING to your program.

Regards,

Atish

Read only

0 Likes
1,698

Tried that too Atish did not work.

Thanks anyways

Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
1,698

Make sure that you are setting the title in the PBO of the screen in which the ALV grid is implemented.

Regards,

RIch Heilman

Read only

0 Likes
1,698

yes iam doing that Rich

Read only

0 Likes
1,698

Hi,

Can you paste your code.

Regards,

Atish

Read only

0 Likes
1,698

Now that I'm thinking about it, this is really weird, the fact that you are calling another transaction should have no effect on the calling program whatsoever. Your title should stay intacted. Can you post your code, in the PBO screen flow, as well as any modules therein, and also the event handler for your double click in the ALV. I can think of a work around, but you should have to do that. I've developed many programs just like this and have never had this problem.

Regards,

RIch Heilman

Read only

0 Likes
1,698

METHOD handle_double_click.

DATA : l_process_mode TYPE crmt_mode.

  • read selected row from internal table

READ TABLE it_alv INDEX e_row-index INTO l_alv.

l_process_mode = 'B'.

    • MAKE SURE THE HTML GUI FLAG IS SET SO BUTTONS WILL DISPLAY

  • CALL METHOD cl_crm_1o_manag=>is_htmlgui_active.

CALL FUNCTION 'CRM_1O_CALL_FOREIGN'

EXPORTING

iv_ui_method = 'LEAD'

  • IV_PROCESS_TYPE =

iv_process_mode = l_process_mode

iv_header_guid = l_alv-guid

  • IV_FULL_ORDER_FUNCTIONALITY =

EXCEPTIONS

error_occurred = 1

read_order_failed = 2

create_order_failed = 3

OTHERS = 4 .

SET TITLEBAR text-100

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

ENDMETHOD. "handle_double_click

The Function Module in the method takes us to the standard CRM activity transaction for the selected line item. i tried to set the title bar when it comes back from the FM but did not worl.

Read only

0 Likes
1,698

Again, you should need to do this, but try setting the sy-title directly after coming back.

sy-title =  text-100.

Regards,

Rich Heilman

Read only

0 Likes
1,698

)) tried even that did not work. i tried all possibilities. i feel there is something goto do with the FM im using to call the transaction.

Read only

0 Likes
1,698

Its got to be that, not sure what is happening, but it appears that you are going to need to fire a round trip in your event handler. So try putting this coding after your function call in your event handler method.



* cause PAI
    call method cl_gui_cfw=>set_new_ok_code
          exporting
                 new_code = 'XREFRESH'.

What this should do is cause a PAI, (which there should be no funciton code in your PAI for XREFRESH), and of course will come around to the PBO, where you should be setting your titlebar as usual.

Regards,

Rich Heilman

Read only

0 Likes
1,698

Oh dear --why do people make this stuff so complicated.

Here's an easy way without having to do any extra PBO's, or refreshing the display.

<b>This changes both the GRID and the PROGRAM titles.</b>

For Top of the screen you need to set the GUI titlebar before you get another display <b>either via the grid</b> or a programmed PBO.

In a typical grid application you don't get another PBO event after your initial call to the GRID unless you implement it in an event handler routine (and it's not normally necessary).

<b>What you need to do after an event such as double click or whatever IS THEN set the new (or previous) title.</b>

On the conclusion of your routine unless you code EXIT / LEAVE program the GRID will re-display. <b>Before this display is where you need to set the title bar.</b>

In my Double click routine method I've set the Program title to a different value and as soon as the GRID displays again the title is changed.

The GRID title has also changed -- I've shown here how to change BOTH objects.

in your main program

DATA: i_gridtitle TYPE lvc_title.

Now in the routine where you want to change the title we simply set a new title.

I also change the GRID title.

I'm going to do it in my Double click routine

  • in your SE41 for the program have different titles

  • defined

  • I've got 2 000 and 001.

form dubbleklik using

e_row type LVC_S_ROW

e_column type LVC_S_col

es_row_no type lvc_s_roid.

SET TITLEBAR '001'. "=========>PGM title bar

i_gridtitle = 'Grid Title Changed'.

CALL METHOD z_object->change_title

EXPORTING i_gridtitle = i_gridtitle.

ENDFORM.

In my class definition

in the definition section public methods

change_title

IMPORTING i_gridtitle type lvc_title.

In the implementation section

METHOD change_title.

CALL METHOD grid1->set_gridtitle

EXPORTING

i_gridtitle = i_gridtitle.

ENDMETHOD.

For the event handler etc I've posted my class definition

several times but here is the complete class for people who want to try all the functionality out.

*

CLASS zcl_dog DEFINITION.

PUBLIC SECTION.

METHODS:

constructor

IMPORTING z_object type ref to zcl_dog,

display_grid

CHANGING it_fldcat type lvc_t_fcat,

build_dynamic_structures

CHANGING it_fldcat TYPE lvc_t_fcat,

change_title

IMPORTING i_gridtitle type lvc_title.

PRIVATE SECTION.

METHODS:

on_user_command FOR EVENT before_user_command OF cl_gui_alv_grid

IMPORTING e_ucomm

sender,

on_toolbar FOR EVENT toolbar OF cl_gui_alv_grid

IMPORTING e_object

e_interactive,

on_dubbelklik FOR EVENT double_click OF cl_gui_alv_grid

IMPORTING e_row

e_column

es_row_no,

handle_data_changed

FOR EVENT data_changed OF cl_gui_alv_grid

IMPORTING er_data_changed,

handle_data_changed_finished

FOR EVENT data_changed_finished OF cl_gui_alv_grid

IMPORTING e_modified

et_good_cells,

verwerk

IMPORTING program TYPE sy-repid,

download_to_excel,

dubbleklik

IMPORTING

e_row type LVC_S_ROW

e_column TYPE LVC_S_COL

es_row_no type lvc_s_ROID

program type sy-repid,

return_structure,

create_dynamic_fcat

EXPORTING it_fldcat TYPE lvc_t_fcat,

create_dynamic_table

IMPORTING it_fldcat TYPE lvc_t_fcat

EXPORTING dy_table TYPE REF TO DATA.

DATA:

lr_rtti_struc TYPE REF TO cl_abap_structdescr, "RTTI

zog LIKE LINE OF lr_rtti_struc->components, "RTTI

wa_it_fldcat TYPE lvc_s_fcat,

it_fldcat TYPE lvc_t_fcat,

dy_table TYPE REF TO data,

dy_line TYPE REF TO data,

struct_grid_lset TYPE lvc_s_layo,

e_row TYPE LVC_S_ROW,

e_column TYPE lvc_s_col,

es_rowid TYPE lvc_s_roid,

grid_container1 TYPE REF TO cl_gui_custom_container,

grid1 TYPE REF TO cl_gui_alv_grid,

ls_layout TYPE kkblo_layout,

lt_fieldcat_wa TYPE kkblo_fieldcat,

l_mode TYPE raw4,

celltab TYPE LVC_T_STYL,

wa_celltab TYPE lvc_s_styl,

lt_fieldcat TYPE kkblo_t_fieldcat,

l_tabname TYPE slis_tabname.

TYPES:

struc LIKE zog.

DATA:

zogt TYPE TABLE OF struc.

ENDCLASS.

CLASS zcl_dog IMPLEMENTATION.

METHOD constructor.

CREATE OBJECT grid_container1

EXPORTING

container_name = 'CCONTAINER1'.

CREATE OBJECT grid1

EXPORTING

i_parent = grid_container1.

SET HANDLER z_object->on_user_command for grid1.

SET HANDLER z_object->on_toolbar for grid1.

SET HANDLER Z_OBJECT->handle_data_changed_finished FOR grid1.

SET HANDLER Z_OBJECT->on_dubbelklik FOR grid1.

CALL METHOD grid1->register_edit_event

EXPORTING

i_event_id = cl_gui_alv_grid=>mc_evt_enter.

ENDMETHOD.

METHOD on_dubbelklik.

CALL METHOD me->dubbleklik

EXPORTING

e_row = e_row

e_column = e_column

es_row_no = es_row_no

program = sy-repid.

break-point 1.

ENDMETHOD.

METHOD handle_data_changed.

  • Insert user code here if required

  • this method is entered if user ENTERS DATA.

ENDMETHOD.

METHOD handle_data_changed_finished.

  • Insert user code here if required

  • Method entered here after data entry has finished.

ENDMETHOD.

METHOD return_structure.

lr_rtti_struc ?= cl_abap_structdescr=>DESCRIBE_BY_DATA( <fs1> ).

zogt[] = lr_rtti_struc->components.

ASSIGN zogt[] TO <fs2>.

ENDMETHOD.

METHOD create_dynamic_fcat.

LOOP AT <fs2> INTO zog.

CLEAR wa_it_fldcat.

wa_it_fldcat-fieldname = zog-name .

wa_it_fldcat-datatype = zog-type_kind.

wa_it_fldcat-inttype = zog-type_kind.

wa_it_fldcat-intlen = zog-length.

wa_it_fldcat-decimals = zog-decimals.

wa_it_fldcat-coltext = zog-name.

wa_it_fldcat-lowercase = 'X'.

APPEND wa_it_fldcat TO it_fldcat .

ASSIGN it_fldcat[] TO <field_catalog>.

ENDLOOP.

ASSIGN it_fldcat[] TO <field_catalog>.

ENDMETHOD.

METHOD download_to_excel.

break-point 5.

CALL FUNCTION 'LVC_TRANSFER_TO_KKBLO'

EXPORTING

it_fieldcat_lvc = <field_catalog>

  • is_layout_lvc = m_cl_variant->ms_layout

is_tech_complete = ' '

IMPORTING

es_layout_kkblo = ls_layout

et_fieldcat_kkblo = lt_fieldcat.

LOOP AT lt_fieldcat INTO lt_fieldcat_wa.

CLEAR lt_fieldcat_wa-tech_complete.

IF lt_fieldcat_wa-tabname IS initial.

lt_fieldcat_wa-tabname = '1'.

MODIFY lt_fieldcat FROM lt_fieldcat_wa.

ENDIF.

l_tabname = lt_fieldcat_wa-tabname.

ENDLOOP.

CALL FUNCTION 'ALV_XXL_CALL'

EXPORTING

i_tabname = l_tabname

is_layout = ls_layout

it_fieldcat = lt_fieldcat

i_title = sy-title

TABLES

it_outtab = <dyn_table>

EXCEPTIONS

fatal_error = 1

no_display_possible = 2

others = 3.

IF sy-subrc <> 0.

message id sy-msgid type 'S' number sy-msgno

with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

ENDMETHOD.

METHOD create_dynamic_table.

CALL METHOD cl_alv_table_create=>create_dynamic_table

EXPORTING

it_fieldcatalog = it_fldcat

IMPORTING

ep_table = dy_table.

ENDMETHOD.

METHOD build_dynamic_structures.

CALL METHOD me->return_structure.

CALL METHOD me->create_dynamic_fcat

IMPORTING

it_fldcat = it_fldcat.

CALL METHOD me->create_dynamic_table

EXPORTING

it_fldcat = it_fldcat

IMPORTING

dy_table = dy_table.

ASSIGN dy_table->* TO <dyn_table>.

CREATE DATA dy_line LIKE LINE OF <dyn_table>.

ASSIGN dy_line->* TO <dyn_wa>.

ENDMETHOD.

METHOD display_grid.

struct_grid_lset-edit = 'X'. "To enable editing in ALV

struct_grid_lset-grid_title = 'Bulkwijzigingen inkoopprijzen'.

struct_grid_lset-ctab_fname = 'T_CELLCOLORS'.

struct_grid_lset-stylefname = 'CELLTAB'.

CALL METHOD grid1->set_ready_for_input

EXPORTING

i_ready_for_input = '1'.

CALL METHOD grid1->set_table_for_first_display

EXPORTING

is_layout = struct_grid_lset

CHANGING

it_outtab = <dyn_table>

it_fieldcatalog = it_fldcat.

ENDMETHOD.

METHOD change_title.

CALL METHOD grid1->set_gridtitle

EXPORTING

i_gridtitle = i_gridtitle.

ENDMETHOD.

METHOD on_user_command.

CASE e_ucomm.

WHEN 'EXIT'.

LEAVE PROGRAM.

WHEN 'EXCEL'.

CALL METHOD me->download_to_excel.

WHEN 'SAVE'.

WHEN 'VERW'.

CALL METHOD me->verwerk

EXPORTING

PROGRAM = SY-REPID.

ENDCASE.

ENDMETHOD. "on_user_command

METHOD on_toolbar.

DATA: ls_toolbar TYPE stb_button.

CLEAR ls_toolbar.

MOVE 0 TO ls_toolbar-butn_type.

MOVE 'EXIT' TO ls_toolbar-function.

MOVE SPACE TO ls_toolbar-disabled.

MOVE icon_system_end TO ls_toolbar-icon.

MOVE 'Click2Exit' TO ls_toolbar-quickinfo.

APPEND ls_toolbar TO e_object->mt_toolbar.

CLEAR ls_toolbar.

MOVE 0 TO ls_toolbar-butn_type.

MOVE 'SAVE' TO ls_toolbar-function.

MOVE SPACE TO ls_toolbar-disabled.

MOVE icon_system_save TO ls_toolbar-icon.

MOVE 'Save data' TO ls_toolbar-quickinfo.

APPEND ls_toolbar TO e_object->mt_toolbar.

CLEAR ls_toolbar.

MOVE 0 TO ls_toolbar-butn_type.

MOVE 'EDIT' TO ls_toolbar-function.

MOVE SPACE TO ls_toolbar-disabled.

MOVE icon_toggle_display_change TO ls_toolbar-icon.

MOVE 'Edit data' TO ls_toolbar-quickinfo.

MOVE 'EDIT' TO ls_toolbar-text.

APPEND ls_toolbar TO e_object->mt_toolbar.

CLEAR ls_toolbar.

MOVE 0 TO ls_toolbar-butn_type.

MOVE 'VERW' TO ls_toolbar-function.

MOVE SPACE TO ls_toolbar-disabled.

MOVE icon_businav_process to ls_toolbar-icon.

MOVE 'Verw.' TO ls_toolbar-quickinfo.

MOVE 'VERW' TO ls_toolbar-text.

APPEND ls_toolbar TO e_object->mt_toolbar.

CLEAR ls_toolbar.

MOVE 0 TO ls_toolbar-butn_type.

MOVE 'EXCEL' TO ls_toolbar-function.

MOVE SPACE TO ls_toolbar-disabled.

MOVE icon_xxl TO ls_toolbar-icon.

MOVE 'Excel' TO ls_toolbar-quickinfo.

MOVE 'EXCEL' TO ls_toolbar-text.

APPEND ls_toolbar TO e_object->mt_toolbar.

ENDMETHOD.

METHOD verwerk.

PERFORM verwerk IN PROGRAM (program).

LEAVE PROGRAM.

ENDMETHOD.

METHOD dubbleklik.

PERFORM dubbleklik IN PROGRAM (program)

USING

e_row

e_column

es_row_no.

ENDMETHOD.

ENDCLASS.

Cheers

Jimbo