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

abap general

Former Member
0 Likes
790

WHAT IS THE DIFF B/W THE CALL SCREEN AND LEAVE SCREEN .

HOW CAN WE GET PUSH BUTTONS IN ALVS.

7 REPLIES 7
Read only

Former Member
0 Likes
768

Hi,

Call Screen: This is used to call a single screen for embedding a screen sequence.The syntax for call the screen is

CALL SCREEN <SCREEN NO>.

eg: CALL SCREEN 200.

If you want to preserve the original Screen then just use the following statement

CALL SCREEN 200 STARTING AT X1 Y1 ENDING AT X2 Y2.

LEAVE SCREEN

~~~~~~~~~~~~~

When this is use the control goes back to the screen from which the present screen was called and continues with the processing.

Thanks,

Samantak

Rewards points for useful answers.

Read only

Former Member
0 Likes
768

hi,

call screen : it is used to call the next screen. when call screen is used then system stops processing of current screen n goes to next screen it process it and comes back to current screen for execution.

generally call screen is used for calling sub screens

for ex: call screen 9999 starting at 20 ending at 67.

displays a sub screen with this co ordinates.

leave screen: to navigate to end or starting this is used.

ex: leave screen 1000. -> navigates to screen 1000 when it executes this statement.

leave screen is useful in certain conditions like when click on on exit u have to go to starting or ending like that.

if helpful reward some points.

with regards,

Suresh.A

Read only

Former Member
0 Likes
768

Hi,

LEAVE TO SCREEN scr.

Effect

Leaves the current screen and processes the screen scr.

SET SCREEN,

LEAVE SCREEN.

whereas in call screen, Once the screen is displayed the user can enter all the data and return to the main screen by clicking BACK button.

Call screen is usually used for pop up screens.

To call screen as pop up screen the syntax is

Call screen starting at <col.no.> <line no>

Ending at <col no> <line no>.

Thanks,

Sheetal singh.

Read only

Former Member
0 Likes
768

Hi,

<u><b>Call Screen</b></u>

To call a screen from list processing, use the statement

CALL SCREEN <nnnn>.

This inserts a screen sequence into the program flow as described in the section Calling Screen Sequences. The list processor passes control to the dialog processor. The context from the time of the call is retained. If you call a screen sequence during processing of a particular list level, it is processed until the end of a screen with next screen 0. Then the dialog processor returns control to the list processor, and processing carries on after the CALL SCREEN statement.

<u><b>Leave Screen</b></u>

In a program, you can use one of the two following ABAP statements to leave a screen:

LEAVE SCREEN.

or

LEAVE TO SCREEN <next screen>.

The LEAVE SCREEN statement ends the current screen and calls the subsequent screen. The next screen is either the static next screen or a dynamic next screen. In the second case, you must override the static next screen using the SET SCREEN statement before the LEAVE SCREEN statement.

The LEAVE TO SCREEN statement exits the current screen and calls the dynamic next screen, which you specify as part of the statement. The LEAVE TO SCREEN statement is no more than a contraction of the two statements

SET SCREEN <next screen>.

LEAVE SCREEN.

These statements do not end the screen sequence. They merely branch to another screen in the same sequence. The screen sequence only ends when you leave to next screen 0.

Regards,

Bhaskar

Read only

Former Member
0 Likes
768

when call screen is used another screen is called before the control exits from this screen and when leave screen is used the control just leaves this particular screen and the previous screen gets displayed.

for pushbuttons in ALV's refer

http://help.sap.com/saphelp_erp2004/helpdata/en/88/387f380c2f2e3ce10000009b38f8cf/content.htm

regards,

srinivas

<b>*reward for useful answers*</b>

Read only

Former Member
0 Likes
768

hi,

<u>

WHAT IS THE DIFF B/W THE CALL SCREEN AND LEAVE SCREEN .</u>

CALL SCREEN 200

If we write this statement in screen 100 ,it will goto screen 200 and it will retain screen 100(ie u can come back)

and moreover u have options using this

CALL SCREEN 200 STARTING AT x1 y1 ENDING AT x2 y2

SET SCREEN 200

with the above statement , it will goto screen 200 and screen 100 no more remains

And no additional options for this

LEAVE SCREEN

Leaves the current screen and processes the next screen.

LEAVE TO SCREEN 200

it leaves the current screen and processes screen 200

<u>HOW CAN WE GET PUSH BUTTONS IN ALVS.<u></u></u>

1. create your own pf status.

2. put a button there.

now how to create pf - status.

chk this.

http://www.sapdevelopment.co.uk/reporting/alv/alvgrid_pfstatus.htm

then how to capture that button click.

chk here.

http://www.sapdevelopment.co.uk/reporting/alv/alvgrid_ucomm.htm

Rgds

Reshma

Read only

Former Member
0 Likes
768

Hi,

Call screen is used to shift the program flow to a particular screen and then return back to program again whereas the leave screen is used to leave the program to a particular screen thereby not returning back to program flow.

check this sample code to add the push button in STD alv toolbar.

report zalv_object.

type-pools: icon.

--


to all the data dec for reference var defore defition-----

class: lcl_event_receiver definition deferred.

data: dis_obj type ref to zalv_obj,

alv_dis type ref to cl_gui_alv_grid,

g_container type ref to cl_gui_custom_container,

gt_container type scrfname value 'ALVLIST',

event_receiver type ref to lcl_event_receiver.

data: ok_code type sy-ucomm,

g_repid like sy-repid,

x_save type c,

gs_layout type disvariant, "Layout (External Use)

gl_layout type lvc_s_layo. "ALV control: Layout structure

data: wa_tab like zob_tab,

itab type zob_itab,

fcat type lvc_t_fcat..

----


  • local class definition to handle events

----


class lcl_event_receiver definition.

public section.

methods: handle_toolbar for event toolbar

of cl_gui_alv_grid importing e_object,

handle_user_command for event user_command

of cl_gui_alv_grid importing e_ucomm,

handle_data_changed for event data_changed

of cl_gui_alv_grid importing er_data_changed.

endclass. "lcl_event_receiver DEFINITION

----


  • local class implementation to handle events

----


class lcl_event_receiver implementation.

method handle_toolbar.

  • to add a buton in the atandard toolbar of the custom control

data: ls_toolbar type stb_button, "Toolbar Button

ls_toolbar1 type stb_button.

*to add insert button.

clear ls_toolbar.

move 3 to ls_toolbar-butn_type.

append ls_toolbar to e_object->mt_toolbar.

clear ls_toolbar.

move icon_execute_object to ls_toolbar-icon.

move 'INSERT' to ls_toolbar-function.

move 'move list to ztable' to ls_toolbar-quickinfo.

move 'Insert_values' to ls_toolbar-text.

move ' ' to ls_toolbar-disabled.

append ls_toolbar to e_object->mt_toolbar.

clear ls_toolbar.

*to add edit button.

clear ls_toolbar1.

move 3 to ls_toolbar1-butn_type.

append ls_toolbar1 to e_object->mt_toolbar.

clear ls_toolbar1.

move icon_toggle_display_change to ls_toolbar1-icon.

move 'EDIT' to ls_toolbar1-function.

move 'change contents in list' to ls_toolbar1-quickinfo.

move 'Edit' to ls_toolbar1-text.

move ' ' to ls_toolbar1-disabled.

append ls_toolbar1 to e_object->mt_toolbar.

clear ls_toolbar1.

endmethod. "handle_toolbar

*to trigge the action when the button is pressed

method handle_user_command.

*data gl1_layout type lvc_s_layo.

case e_ucomm.

*function insert

when 'INSERT'.

loop at itab into wa_tab.

insert into zalv_tab values wa_tab. " from wa_tab table itab.

endloop.

*function edit

when 'EDIT'.

perform editable.

endcase.

endmethod. "handle_user_command

method handle_data_changed.

endmethod. "handle_data_changed

endclass. "lcl_event_receiver IMPLEMENTATION

*selection-screen

selection-screen: begin of block b1 with frame title text-001.

parameter: p_vbeln like vbap-vbeln.

selection-screen: end of block b1.

start-of-selection.

create object dis_obj.

call method dis_obj->get_method

exporting

sale_doc_num = p_vbeln

importing

zitab = itab.

clear gs_layout.

call screen 201.

&----


*& Module STATUS_0201 OUTPUT

&----


  • text

----


module status_0201 output.

set pf-status 'ZSRN201'.

  • SET TITLEBAR 'xxx'.

if g_container is initial.

--


create object for custom control ref var--

create object g_container

exporting

container_name = gt_container

--


create object for the class alv_obj--

create object alv_dis

exporting

i_parent = g_container

--


fieldcatalog definition--

perform fieldcat changing fcat.

perform save_layout.

gl_layout-grid_title = 'sales document details'(100).

*gl_layout-edit = 'X'.

endif.

--


set the table for display--

call method alv_dis->set_table_for_first_display

exporting

  • I_STRUCTURE_NAME = 'VBAP'

is_variant = gs_layout

i_save = x_save

is_layout = gl_layout

changing

it_outtab = itab[]

it_fieldcatalog = fcat

*create object for event reference var

create object event_receiver.

*set the event to grid reference variable

set handler event_receiver->handle_toolbar for alv_dis.

set handler event_receiver->handle_user_command for alv_dis.

call method alv_dis->refresh_table_display

endmodule. " STATUS_0201 OUTPUT

&----


*& Module USER_COMMAND_0201 INPUT

&----


  • text

----


module user_command_0201 input.

*CALL METHOD CL_GUI_CFW=>DISPATCH.

case ok_code.

when 'EXIT'.

leave program.

when 'EXEC'.

loop at itab into wa_tab.

insert into zalv_tab values wa_tab. " from wa_tab table itab.

endloop.

when 'EDIT'.

perform editable.

clear ok_code.

endmodule. " USER_COMMAND_0201 INPUT

&----


*& Form save_layout

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


form save_layout .

x_save = 'A'.

g_repid = sy-repid.

gs_layout-report = g_repid.

endform. " save_layout

&----


*& Form FIELDCAT

&----


  • text

----


  • <--P_FCAT text

----


form fieldcat changing pt_fcat type lvc_t_fcat.

data wa_fcat type lvc_s_fcat.

wa_fcat-col_pos = 1.

wa_fcat-key = 'X'.

  • wa_fcat-row_pos = 1.

wa_fcat-fieldname = 'VBELN'.

wa_fcat-ref_field = 'VBELN'.

wa_fcat-tabname = 'ITAB'.

wa_fcat-ref_table = 'VBAP'.

append wa_fcat to fcat.

clear wa_fcat.

wa_fcat-col_pos = 2.

  • wa_fcat-row_pos = 1.

wa_fcat-fieldname = 'MATNR'.

wa_fcat-ref_field = 'MATNR'.

wa_fcat-tabname = 'ITAB'.

wa_fcat-ref_table = 'VBAP'.

wa_fcat-edit = 'X'.

append wa_fcat to fcat.

clear wa_fcat.

wa_fcat-col_pos = 3.

  • wa_fcat-row_pos = 1.

wa_fcat-fieldname = 'ARKTX'.

wa_fcat-ref_field = 'ARKTX'.

wa_fcat-tabname = 'ITAB'.

wa_fcat-ref_table = 'VBAP'.

append wa_fcat to fcat.

clear wa_fcat.

wa_fcat-col_pos = 4.

  • wa_fcat-row_pos = 1.

wa_fcat-fieldname = 'MEINS'.

wa_fcat-ref_field = 'MEINS'.

wa_fcat-tabname = 'ITAB'.

wa_fcat-ref_table = 'VBAP'.

append wa_fcat to fcat.

clear wa_fcat.

wa_fcat-col_pos = 5.

  • wa_fcat-row_pos = 1.

wa_fcat-fieldname = 'KWMENG'.

wa_fcat-ref_field = 'KWMENG'.

wa_fcat-tabname = 'ITAB'.

wa_fcat-ref_table = 'VBAP'.

wa_fcat-quantity = 'NO'.

wa_fcat-edit = 'X'.

append wa_fcat to fcat.

clear wa_fcat.

wa_fcat-col_pos = 6.

  • wa_fcat-row_pos = 1.

wa_fcat-fieldname = 'NETWR'.

wa_fcat-ref_field = 'NETWR'.

wa_fcat-tabname = 'ITAB'.

wa_fcat-ref_table = 'VBAP'.

  • wa_fcat-do_sum = 'X'.

  • WA_FCAT-CURRENCY = 'INR'.

wa_fcat-edit = 'X'.

append wa_fcat to fcat.

clear wa_fcat.

endform. " FIELDCAT

&----


*& Form editable

&----


  • text

----


  • <--P_GC_LAYOUT[] text

----


form editable.

gl_layout-edit = 'X'.

if alv_dis->is_ready_for_input( ) eq 0.

call method alv_dis->set_ready_for_input

exporting

i_ready_for_input = 1.

else.

call method alv_dis->set_ready_for_input

exporting

i_ready_for_input = 0.

endif.

endform. " editable

hope this helps.

Pls reward points.

Regards,

Ameet