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

oo abap-alv in dialog program.

Former Member
0 Likes
672

My scenario is: in one screen(module pool) i shud display a 2 column list in alv. when i selct few recs and clik left arrow, those recs shud move 2 left alv.

how can i do this.

shud i have 2 alvs to obtain this? or is there a single method to do this entire thing including the left & right arrows functionality?

can i get any sample codes for this.

note: i am using ecc6.0. so i shud do this only by OO-ABAP.

plz let me know.

tx. kiran

My scenario is: in one screen(module pool) i shud display a 2 column list in alv. when i selct few recs and clik left arrow, those recs shud move 2 left alv.

how can i do this.

shud i have 2 alvs to obtain this? or is there a single method to do this entire thing including the left & right arrows functionality?

can i get any sample codes for this.

note: i am using ecc6.0. so i shud do this only by OO-ABAP.

plz let me know.

tx. kiran

3 REPLIES 3
Read only

Former Member
0 Likes
594

hi,

for this u need to delete the selected records from internal table which is show in the grid1 and those selected records should be appended to the internal table which u r displaying in the grid2.

all this code u should write under he okcode action of that left arrow.

for right arrow u shouldimpliment the reverse logic.

regards,

bharat.

Read only

Former Member
0 Likes
594

tx 4 the reply barat..

is this all not possible with a single alv?

can i get any sample program?

note: using oo-abap, is all that i need.

kiran

Read only

0 Likes
594

Hello Kiran,

Here is a sample code.I have used double click event for this.You can use Left push-button instead and write the code in its user-command module.I have used two containers placed side by side and named as <b>CONTAINER1</b> and <b>CONTAINER2</b>.

ZSAMPLE.

DATA:

<b>*first container and grid</b>

cont1 type ref to cl_gui_custom_container,

alv1 type ref to cl_gui_alv_grid,

<b>*second container and grid</b>

cont2 type ref to cl_gui_custom_container,

alv2 type ref to cl_gui_alv_grid,

<b>*table displayed in first grid</b>

itab_spfli type table of spfli,

wa_spfli like line of itab_spfli,

<b>*table displayed in second grid</b>

itab_sflight type table of spfli,

wa_sflight like line of itab_sflight,

ok_code type sy-ucomm.

<b>*local class for handling the double click event of first grid</b>

----


  • CLASS lcl_eh DEFINITION

----


  • ........ *

----


class lcl_eh definition.

Public section.

Methods:DOUBLE_CLICK FOR EVENT DOUBLE_CLICK of cl_gui_alv_grid

importing E_ROW E_COLUMN ES_ROW_NO .

endclass.

DATA: lo_obj TYPE REF TO lcl_eh.

----


  • CLASS lcl_eh IMPLEMENTATION

----


  • ........ *

----


class lcl_eh implementation.

Method double_click.

<b> read table itab_spfli into wa_spfli INDEX e_row-index.

append wa_spfli to itab_sflight.

delete itab_spfli INDEX e_row-index.</b>

CALL METHOD ALV2-><b>SET_TABLE_FOR_FIRST_DISPLAY</b>

EXPORTING

I_STRUCTURE_NAME = 'SFLIGHT'

CHANGING

IT_OUTTAB = itab_sflight.

CALL METHOD ALV1-><b>REFRESH_TABLE_DISPLAY</b>

  • EXPORTING

  • IS_STABLE =

  • I_SOFT_REFRESH =

  • EXCEPTIONS

  • FINISHED = 1

  • others = 2

.

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.

endclass.

<b>

*selection-screen parameter</b>

PARAMETERS : carrid type spfli-carrid.

AT SELECTION-SCREEN.

SELECT * from spfli into table itab_spfli where carrid = carrid.

call screen 100.

&----


*& Module STATUS_0100 OUTPUT

&----


  • text

----


MODULE STATUS_0100 OUTPUT.

SET PF-STATUS 'GUI'.

  • SET TITLEBAR 'xxx'.

<b>*create first container and grid</b>

CREATE OBJECT CONT1

EXPORTING

CONTAINER_NAME = 'CONTAINER1'.

CREATE OBJECT ALV1

EXPORTING

I_PARENT = cont1.

<b>*set handler to handle the double click event</b>

<b>create object lo_obj.

set handler lo_obj->double_click for alv1.</b>

CALL METHOD ALV1->SET_TABLE_FOR_FIRST_DISPLAY

EXPORTING

I_STRUCTURE_NAME = 'SPFLI'

CHANGING

IT_OUTTAB = itab_spfli.

<b>*create second container and grid</b>

CREATE OBJECT CONT2

EXPORTING

CONTAINER_NAME = 'CONTAINER2'.

CREATE OBJECT ALV2

EXPORTING

I_PARENT = cont2.

ENDMODULE. " STATUS_0100 OUTPUT

&----


*& Module USER_COMMAND_0100 INPUT

&----


  • text

----


MODULE USER_COMMAND_0100 INPUT.

case ok_code.

when 'BACK'.

leave to screen 0.

when 'EXIT'.

leave program.

endcase.

ENDMODULE. " USER_COMMAND_0100 INPUT

regards,

Beejal

**Reward if this helps