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

Hi

Former Member
0 Likes
572

Hi

I have a requirement that on double clicking the vnedor number all

the details related to vendor number should be displayed.

Can anyone give me the code related to this.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
546

hi

please follow this code

&----


*& Report ZCL_OOP03

*&

&----


*&

*&

&----


report zcl_oop03.

data:

gd_okcode type sy-ucomm,

*

go_docking type ref to cl_gui_docking_container,

go_splitter type ref to cl_gui_splitter_container,

go_cell_top type ref to cl_gui_container,

go_cell_bottom type ref to cl_gui_container,

go_grid1 type ref to cl_gui_alv_grid,

go_grid2 type ref to cl_gui_alv_grid,

gs_layout type lvc_s_layo.

data:

gt_knb1 type standard table of knb1,

gt_knvv type standard table of knvv.

----


  • CLASS lcl_eventhandler DEFINITION

----


*

----


class lcl_eventhandler definition.

public section.

class-methods:

handle_double_click for event double_click of cl_gui_alv_grid

importing

e_row

e_column

es_row_no

sender.

endclass. "lcl_eventhandler DEFINITION

----


  • CLASS lcl_eventhandler IMPLEMENTATION

----


*

----


class lcl_eventhandler implementation.

method handle_double_click.

  • define local data

data:

ls_knb1 type knb1.

check ( sender = go_grid1 ).

read table gt_knb1 into ls_knb1 index e_row-index.

check ( ls_knb1-kunnr is not initial ).

call method go_grid1->set_current_cell_via_id

exporting

  • IS_ROW_ID =

  • IS_COLUMN_ID =

is_row_no = es_row_no.

  • Triggers PAI of the dynpro with the specified ok-code

call method cl_gui_cfw=>set_new_ok_code( 'DETAIL' ).

endmethod. "handle_double_click

endclass. "lcl_eventhandler IMPLEMENTATION

start-of-selection.

select * from knb1 into table gt_knb1

where bukrs = '1000'.

  • Create docking container++++++++++++++++++++++++++++++++++++++++++++++++++

create object go_docking

exporting

parent = cl_gui_container=>screen0

ratio = 90

exceptions

others = 6.

if sy-subrc <> 0.

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

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

endif.

  • Create splitter container

create object go_splitter

exporting

parent = go_docking

rows = 2

columns = 1

  • NO_AUTODEF_PROGID_DYNNR =

  • NAME =

exceptions

cntl_error = 1

cntl_system_error = 2

others = 3.

if sy-subrc <> 0.

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

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

endif.

  • Get cell container

call method go_splitter->get_container

exporting

row = 1

column = 1

receiving

container = go_cell_top.

call method go_splitter->get_container

exporting

row = 2

column = 1

receiving

container = go_cell_bottom.

  • Create ALV grids

create object go_grid1

exporting

i_parent = go_cell_top

exceptions

others = 5.

if sy-subrc <> 0.

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

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

endif.

  • Set event handler

set handler: lcl_eventhandler=>handle_double_click for go_grid1.

create object go_grid2

exporting

i_parent = go_cell_bottom

exceptions

others = 5.

if sy-subrc <> 0.

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

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

endif.

  • Display data

gs_layout-grid_title = 'Customers'.

call method go_grid1->set_table_for_first_display

exporting

i_structure_name = 'KNB1'

is_layout = gs_layout

changing

it_outtab = gt_knb1

exceptions

others = 4.

if sy-subrc <> 0.

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

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

endif.

gs_layout-grid_title = 'Customers Details (Sales Areas)'.

call method go_grid2->set_table_for_first_display

exporting

i_structure_name = 'KNVV'

is_layout = gs_layout

changing

it_outtab = gt_knvv " empty !!!

exceptions

others = 4.

if sy-subrc <> 0.

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

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

endif.

  • Link the docking container to the target dynpro

call method go_docking->link

exporting

repid = syst-repid

dynnr = '0100'

  • CONTAINER =

exceptions

others = 4.

if sy-subrc <> 0.

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

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

endif.

  • NOTE: dynpro does not contain any elements

call screen '0100'.

  • Flow logic of dynpro (does not contain any dynpro elements):

end-of-selection.

&----


*& Module STATUS_0100 OUTPUT

&----


  • text

----


module status_0100 output.

set pf-status 'STATUS_0100'. " contains push button "DETAIL"

  • SET TITLEBAR 'xxx'.

  • Refresh display of detail ALV list

call method go_grid2->refresh_table_display

  • EXPORTING

  • IS_STABLE =

  • I_SOFT_REFRESH =

exceptions

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.

endmodule. " STATUS_0100 OUTPUT

&----


*& Module USER_COMMAND_0100 INPUT

&----


  • text

----


module user_command_0100 input.

case gd_okcode.

when 'BACK' or

'END' or

'CANC'.

set screen 0. leave screen.

  • User has pushed button "Display Details"

when 'DETAIL'.

perform entry_show_details.

when others.

endcase.

clear: gd_okcode.

endmodule. " USER_COMMAND_0100 INPUT

&----


*& Form ENTRY_SHOW_DETAILS

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


form entry_show_details .

  • define local data

data:

ld_row type i,

ls_knb1 type knb1.

call method go_grid1->get_current_cell

importing

e_row = ld_row.

read table gt_knb1 into ls_knb1 index ld_row.

check ( syst-subrc = 0 ).

select * from knvv into table gt_knvv

where kunnr = ls_knb1-kunnr.

endform. " ENTRY_SHOW_DETAILS

Hi

I have a requirement that on double clicking the vnedor number all

the details related to vendor number should be displayed.

Can anyone give me the code related to this.

4 REPLIES 4
Read only

Former Member
0 Likes
546

Hi David,

<b>Check this code.</b>Hope it helps you.

&----


*& Report ZPURCHASE48 *

*& *

&----


*& *

*& *

&----


report zpurchase48 no standard page heading line-size 170.

tables: ekbz,ekpo,lfa1,makt,mara.

************************************************************************

***

*DECLARATION PART *

************************************************************************

***

data : total like ekbz-dmbtr.

types: begin of fds,

lifnr like ekbz-lifnr, "Vendor Number

waers like ekbz-waers, "Currency

ebeln like ekbz-ebeln, "Purchase Document Number

ebelp like ekbz-ebelp, "Item Number of Purchasing Document

belnr like ekbz-belnr, "Accounting Document Number

xblnr like ekbz-xblnr, "Reference Document Number

matnr like ekpo-matnr, "Material Number

maktx like makt-maktx, "Material Description

spras like lfa1-spras, "Language Key

meins like mara-meins, "Unit of Measure

dmbtr like ekbz-dmbtr, "Freight amount

name1 like lfa1-name1, "name1

kschl like ekbz-kschl, "condition type

end of fds.

data itab1 type standard table of fds with header line.

************************************************************************

***

*INTERNAL TABLE FOR LFA1 TABLE *

************************************************************************

***

types : begin of fieldst,

lifnr like lfa1-lifnr,

name1 like lfa1-name1,

adrnr like lfa1-adrnr,

stras like lfa1-stras,

pstlz like lfa1-pstlz,

ort01 like lfa1-ort01,

regio like lfa1-regio,

pstl2 like lfa1-pstl2,

end of fieldst.

data itab2 type table of fieldst with header line.

data wa_itab2 like line of itab2.

************************************************************************

***

*SELECTION-SCREEN *

************************************************************************

***

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

select-options : s_ebeln for ekbz-ebeln,

s_lifnr for ekbz-lifnr,

s_belnr for ekbz-belnr,

s_xblnr for ekbz-xblnr.

parameter p1 like ekbz-vgabe default '1'.

selection-screen : end of block blk.

************************************************************************

***

*FETCHING RECORDS FROM EKBZ EKPO MAKT MARA TABLES *

************************************************************************

***

start-of-selection.

perform selectdata.

end-of-selection.

************************************************************************

*******

loop at itab1.

write:/ itab1-lifnr hotspot on, 10 sy-vline,

itab1-waers, 25 sy-vline,

itab1-xblnr, 39 sy-vline,

itab1-belnr, 52 sy-vline,

itab1-ebelp, 60 sy-vline,

itab1-ebeln, 72 sy-vline,

76 itab1-matnr, 87 sy-vline,

91 itab1-name1, 98 sy-vline,

itab1-meins, 103 sy-vline,

107 itab1-maktx, 145 sy-vline,

149 itab1-dmbtr, 170 sy-vline.

hide : itab1-lifnr.

at end of waers.

sum.

format color 3.

uline (170).

write: /108 '*Currency Total*', 149 itab1-dmbtr, 170 sy-vline.

format color off.

uline (170).

endat.

at last.

format color 4.

sum.

skip.

uline (170).

write: /108 '*Grand Total*' , 149 itab1-dmbtr, 170 sy-vline.

endat.

endloop.

uline (170).

************************************************************************

***

*TOP-OF-PAGE *

************************************************************************

***

top-of-page.

write: /40 'INTERACTIVE REPORT',

90 'DATE : ' , sy-datum.

uline.

write: /01 'VENDOR NO' , 10 sy-vline,

12 'CURRENCY' , 25 sy-vline,

26 'REFERENCE NO' , 39 sy-vline,

41 'ACCOUNT NO' , 52 sy-vline,

53 'ITEMNO' , 60 sy-vline,

64 'PURNO' , 72 sy-vline,

74 'MATERIAL NO.' , 87 sy-vline,

91 'NAME1' , 98 sy-vline,

99 'UNIT' , 103 sy-vline,

112 'MATERIAL DESCRIPTION' , 145 sy-vline,

150 'FREIGHT AMT' , 170 sy-vline.

uline.

************************************************************************

***

*AT-LINE-SELECTION *

************************************************************************

***

at line-selection.

read table itab2 into wa_itab2 with key

lifnr = itab1-lifnr.

write :/01 sy-vline,

02 wa_itab2-name1, 21 sy-vline,

25 wa_itab2-adrnr, 32 sy-vline,

wa_itab2-stras, 44 sy-vline,

wa_itab2-pstlz, 56 sy-vline,

wa_itab2-ort01, 68 sy-vline,

wa_itab2-regio, 80 sy-vline,

wa_itab2-pstl2, 89 sy-vline.

uline /1(89).

************************************************************************

***

*TOP-OF-PAGE DURING AT LINE-SELCTION *

************************************************************************

***

top-of-page during line-selection.

uline 1(89).

write: /01 sy-vline, 30 'INTERACTIVE REPORT',

60 sy-datum, 89 sy-vline.

uline /1(89).

skip.

uline 1(89).

write:/01 sy-vline,

07 'Name' , 21 sy-vline,

23 'Address1', 32 sy-vline,

34 'Address2', 44 sy-vline,

46 'pobox' , 56 sy-vline,

58 'city' , 68 sy-vline,

70 'state' , 80 sy-vline,

82 'pin code', 89 sy-vline.

uline /1(89).

************************************************************************

*****

*FETCHING RECORDS FROM DATABASE TABLE *

************************************************************************

*****

form selectdata.

select ekbzebeln ekbzwaers ekbzebelp ekbzbelnr ekbz~xblnr

ekpomatnr maktmaktx marameins ekbzdmbtr ekbz~lifnr

lfa1~name1 into corresponding fields of table itab1

from ( ( ( ( ekbz inner join ekpo on ekbzebeln = ekpoebeln

and ekbzebelp = ekpoebelp )

inner join lfa1 on ekbzlifnr = lfa1lifnr )

inner join makt on lfa1spras = maktspras )

inner join mara on maramatnr = maktmatnr

and

maramatnr = ekpomatnr )

where ekbz~ebeln in s_ebeln and

ekbz~lifnr in s_lifnr and

ekbz~belnr in s_belnr and

ekbz~xblnr in s_xblnr and

ekbz~kschl between 'FRA1' and 'FRC3' and

vgabe eq p1.

sort itab1 by lifnr waers.

if not itab1[] is initial.

select lifnr name1 adrnr stras pstlz ort01 regio pstl2

from lfa1 into table itab2

for all entries in itab1 where lifnr = itab1-lifnr.

endif.

endform. "selectdata

************************************************************************

************************

<b>Regards,

Jackie.</b>

Read only

Former Member
0 Likes
547

hi

please follow this code

&----


*& Report ZCL_OOP03

*&

&----


*&

*&

&----


report zcl_oop03.

data:

gd_okcode type sy-ucomm,

*

go_docking type ref to cl_gui_docking_container,

go_splitter type ref to cl_gui_splitter_container,

go_cell_top type ref to cl_gui_container,

go_cell_bottom type ref to cl_gui_container,

go_grid1 type ref to cl_gui_alv_grid,

go_grid2 type ref to cl_gui_alv_grid,

gs_layout type lvc_s_layo.

data:

gt_knb1 type standard table of knb1,

gt_knvv type standard table of knvv.

----


  • CLASS lcl_eventhandler DEFINITION

----


*

----


class lcl_eventhandler definition.

public section.

class-methods:

handle_double_click for event double_click of cl_gui_alv_grid

importing

e_row

e_column

es_row_no

sender.

endclass. "lcl_eventhandler DEFINITION

----


  • CLASS lcl_eventhandler IMPLEMENTATION

----


*

----


class lcl_eventhandler implementation.

method handle_double_click.

  • define local data

data:

ls_knb1 type knb1.

check ( sender = go_grid1 ).

read table gt_knb1 into ls_knb1 index e_row-index.

check ( ls_knb1-kunnr is not initial ).

call method go_grid1->set_current_cell_via_id

exporting

  • IS_ROW_ID =

  • IS_COLUMN_ID =

is_row_no = es_row_no.

  • Triggers PAI of the dynpro with the specified ok-code

call method cl_gui_cfw=>set_new_ok_code( 'DETAIL' ).

endmethod. "handle_double_click

endclass. "lcl_eventhandler IMPLEMENTATION

start-of-selection.

select * from knb1 into table gt_knb1

where bukrs = '1000'.

  • Create docking container++++++++++++++++++++++++++++++++++++++++++++++++++

create object go_docking

exporting

parent = cl_gui_container=>screen0

ratio = 90

exceptions

others = 6.

if sy-subrc <> 0.

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

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

endif.

  • Create splitter container

create object go_splitter

exporting

parent = go_docking

rows = 2

columns = 1

  • NO_AUTODEF_PROGID_DYNNR =

  • NAME =

exceptions

cntl_error = 1

cntl_system_error = 2

others = 3.

if sy-subrc <> 0.

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

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

endif.

  • Get cell container

call method go_splitter->get_container

exporting

row = 1

column = 1

receiving

container = go_cell_top.

call method go_splitter->get_container

exporting

row = 2

column = 1

receiving

container = go_cell_bottom.

  • Create ALV grids

create object go_grid1

exporting

i_parent = go_cell_top

exceptions

others = 5.

if sy-subrc <> 0.

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

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

endif.

  • Set event handler

set handler: lcl_eventhandler=>handle_double_click for go_grid1.

create object go_grid2

exporting

i_parent = go_cell_bottom

exceptions

others = 5.

if sy-subrc <> 0.

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

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

endif.

  • Display data

gs_layout-grid_title = 'Customers'.

call method go_grid1->set_table_for_first_display

exporting

i_structure_name = 'KNB1'

is_layout = gs_layout

changing

it_outtab = gt_knb1

exceptions

others = 4.

if sy-subrc <> 0.

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

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

endif.

gs_layout-grid_title = 'Customers Details (Sales Areas)'.

call method go_grid2->set_table_for_first_display

exporting

i_structure_name = 'KNVV'

is_layout = gs_layout

changing

it_outtab = gt_knvv " empty !!!

exceptions

others = 4.

if sy-subrc <> 0.

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

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

endif.

  • Link the docking container to the target dynpro

call method go_docking->link

exporting

repid = syst-repid

dynnr = '0100'

  • CONTAINER =

exceptions

others = 4.

if sy-subrc <> 0.

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

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

endif.

  • NOTE: dynpro does not contain any elements

call screen '0100'.

  • Flow logic of dynpro (does not contain any dynpro elements):

end-of-selection.

&----


*& Module STATUS_0100 OUTPUT

&----


  • text

----


module status_0100 output.

set pf-status 'STATUS_0100'. " contains push button "DETAIL"

  • SET TITLEBAR 'xxx'.

  • Refresh display of detail ALV list

call method go_grid2->refresh_table_display

  • EXPORTING

  • IS_STABLE =

  • I_SOFT_REFRESH =

exceptions

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.

endmodule. " STATUS_0100 OUTPUT

&----


*& Module USER_COMMAND_0100 INPUT

&----


  • text

----


module user_command_0100 input.

case gd_okcode.

when 'BACK' or

'END' or

'CANC'.

set screen 0. leave screen.

  • User has pushed button "Display Details"

when 'DETAIL'.

perform entry_show_details.

when others.

endcase.

clear: gd_okcode.

endmodule. " USER_COMMAND_0100 INPUT

&----


*& Form ENTRY_SHOW_DETAILS

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


form entry_show_details .

  • define local data

data:

ld_row type i,

ls_knb1 type knb1.

call method go_grid1->get_current_cell

importing

e_row = ld_row.

read table gt_knb1 into ls_knb1 index ld_row.

check ( syst-subrc = 0 ).

select * from knvv into table gt_knvv

where kunnr = ls_knb1-kunnr.

endform. " ENTRY_SHOW_DETAILS

Read only

Former Member
0 Likes
546

Hi Ankit

Can you tell me what is the difference between docking contaniner and

simple gui container.

Read only

Former Member
0 Likes
546

Hi

docking container is just like simple gui container except some extra

features like resizing columns,rows etc..