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

alv problem

Former Member
0 Likes
455

Hi I want to dispaly customer master in alv. And want to use three to four tables. and based on that want to diplay informatiion. Suppose if i click on customer master it should show details in another window of that corresponding customer mastre

Thanks ad regards......

3 REPLIES 3
Read only

Former Member
0 Likes
417

Hi Abhay,

Did I understand your question correctly?

If you are trying to navigate away from the customer master data displayed on the ALV into a window that displays the customer details, then find the answer below:

Try using the HOTSPOT option of the ALV. Make the customer master feild - customer number as HOTSPOT. When the cursor is dragged over it it should display an outstretched finger on that. By clicking it it should take you to the screen displaying the customer master details.

Logic:

1) Enable the HOTSPOT option for the customer field while building the field catalog

2) CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

i_callback_program = g_repid

i_callback_user_command = 'USER_COMMAND'

is_layout = st_layout

it_fieldcat = tbl_fieldcat[]

i_save = 'A'

is_variant = g_variant

TABLES

t_outtab = tbl_outtab

EXCEPTIONS

program_error = 1

OTHERS = 2.

IF sy-subrc <> 0.

  • Message i

ENDIF.

3) In the form 'USER_COMMAND' add the following logic

IF ( g_ucomm = '&IC1' ).

CLEAR wa_outtab.

READ TABLE tbl_outtab INTO wa_outtab INDEX g_selfield-tabindex.

IF NOT wa_outtab-matnr IS INITIAL.

SET PARAMETER ID 'MAT' FIELD wa_outtab-matnr.

CALL TRANSACTION 'MM03' AND SKIP FIRST SCREEN.

ENDIF.

ENDIF.

The above logic is used for navigating to a particular material in selection (wa_outtab-matnr). Something similar can be tried for customer number.

Let me know if your query wasnt this.

Read only

0 Likes
417

All u have to do is handle the hoptspot.

Refer the program that i am giving. In this If u click on the Document no. it takes u to transaction FB01 and displays the Doc details.

I believe u need a similar functionality .. the subtle difference being that u want to display Customer details by some other transaction.

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

&----


*& Report Z_ALV_TRAINING_LIST_HOTSPOT

*&

&----


*&

*&

&----


REPORT Z_ALV_TRAINING_LIST_HOTSPOT.

              • Type Pools Used **********

TYPE-POOLS : SLIS.

              • Internal Tables Declare ************

DATA : it_document type standard table of bkpf initial size 0 with header line,

IT_FIELD_CAT TYPE SLIS_T_FIELDCAT_ALV,

it_alv_event type SLIS_T_EVENT,

fl_layout type slis_layout_alv.

              • Select Data ***********

start-of-selection.

select * from bkpf into table it_document.

                • Make Field Catalog ******

PERFORM MAKE_FIELD_CATALOG.

                • Make Layout *********

perform sub_fill_layout.

                • Make Events Table *******

perform sub_Fill_alv_event.

              • Display ALV *********

PERFORM DISPLAY_ALV_LIST.

----


&----


*& Form make_field_catalog

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM MAKE_FIELD_CATALOG .

data : wa type slis_fieldcat_alv.

CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'

EXPORTING

  • I_PROGRAM_NAME =

  • I_INTERNAL_TABNAME =

I_STRUCTURE_NAME = 'bkpf'

  • I_CLIENT_NEVER_DISPLAY = 'X'

  • I_INCLNAME =

  • I_BYPASSING_BUFFER =

  • I_BUFFER_ACTIVE =

CHANGING

CT_FIELDCAT = it_field_cat

  • EXCEPTIONS

  • INCONSISTENT_INTERFACE = 1

  • PROGRAM_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.

read table it_field_cat into wa index 3.

wa-hotspot = 'X'.

modify it_field_cat index 3 from wa.

ENDFORM. " make_field_catalog

&----


*& Form display_alv_list

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM DISPLAY_ALV_LIST .

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

I_CALLBACK_PROGRAM = sy-repid

  • I_CALLBACK_PF_STATUS_SET = 'SET_MY_PF_STATUS'

  • I_CALLBACK_USER_COMMAND = ' '

IS_LAYOUT = fl_layout

IT_FIELDCAT = it_field_cat[]

  • IT_SORT =

  • I_DEFAULT = 'X'

I_SAVE = 'X'

  • IS_VARIANT = '/TEST_VV'

IT_EVENTS = it_alv_event

TABLES

T_OUTTAB = it_document.

IF SY-SUBRC <> 0.

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

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

ENDIF.

ENDFORM. " display_alv_list

&----


*& Form sub_my_pf_event

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM sub_my_pf_event using p_comm type sy-ucomm p_sEL_FIELD TYPE SLIS_SELFIELD.

read table it_document index p_sel_field-tabindex.

set parameter id 'BLN' field it_document-belnr.

set parameter id 'BUK' field it_document-bukrs.

set parameter id 'GJR' field it_document-gjahr.

case p_comm.

when 'PICK'.

call transaction 'FB03' and skip first screen.

endcase.

ENDFORM. " sub_my_pf_event

&----


*& Form sub_Fill_alv_event

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM sub_Fill_alv_event .

data : wa type slis_alv_event.

wa-name = 'USER_COMMAND'.

wa-form = 'SUB_MY_PF_EVENT'.

append wa to it_alv_event.

ENDFORM. " sub_Fill_alv_event

&----


*& Form sub_fill_layout

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM sub_fill_layout .

fl_layout-f2code = 'PICK'.

fl_layout-box_fieldname = 'BELNR'.

ENDFORM. " sub_fill_layout

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

Hope this helps.. If it does.. plz reward points.

Read only

Former Member
0 Likes
417

hi,

Refer BCALV_GRID_05

This is very helpful. But need to develop ALV in OOPS