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 - creating hyperlinks

Former Member
0 Likes
1,542

Hello,

I have a request from the business to create report in ALV. the report will contain the Accounting Document number, PO number, vendor, and some other fields. The request also states that if the user clicks on the accounting document number, the user should be able to view the document in MIR4. also for the PO number, the user should be able to view in ME23N, and for the vendor, the user should be able to view in XK03. Being new to ALV, I am asking if this can be done and if so, where would I look for the documentation. Is this considered a drilldown? I looked thru the help.sap.com but I am not sure what to look for.

thanks in advance for the help

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,089

Hi,

Check this alv example..There will be hotspot on the PO number..If you click it will take you ME23N.

TYPE-POOLS: slis.

DATA: gt_fieldcat TYPE slis_t_fieldcat_alv.

DATA: BEGIN OF wa_ekko,

ebeln like ekko-ebeln,

ekorg like ekko-ekorg,

ekgrp like ekko-ekgrp,

END OF wa_ekko.

DATA: v_repid TYPE syrepid.

v_repid = sy-repid.

DATA it_ekko LIKE STANDARD TABLE OF wa_ekko WITH HEADER LINE.

SELECT * UP TO 100 ROWS

FROM ekko

INTO CORRESPONDING FIELDS OF TABLE it_ekko.

CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'

EXPORTING

i_program_name = v_repid

i_internal_tabname = 'WA_EKKO'

i_inclname = v_repid

CHANGING

ct_fieldcat = gt_fieldcat.

  • have hotspot for a PO.

DATA: s_fieldcat LIKE LINE OF gt_fieldcat.

s_fieldcat-hotspot = 'X'.

MODIFY gt_fieldcat FROM s_fieldcat TRANSPORTING hotspot

WHERE fieldname = 'EBELN'.

  • Pass the program.

v_repid = sy-repid.

CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'

EXPORTING

i_callback_program = v_repid

it_fieldcat = gt_fieldcat

i_callback_user_command = 'USER_COMMAND'

TABLES

t_outtab = it_ekko.

----


  • FORM display_detail *

----


  • ........ *

----


  • --> UCOMM *

  • --> SELFIELD *

----


FORM user_command USING ucomm LIKE sy-ucomm

selfield TYPE slis_selfield.

IF ucomm = '&IC1'.

READ TABLE it_ekko INDEX selfield-tabindex.

IF sy-subrc = 0.

SET PARAMETER ID 'BES' FIELD it_ekko-ebeln.

CALL TRANSACTION 'ME23N' AND SKIP FIRST SCREEN.

ENDIF.

ENDIF.

ENDFORM.

Thanks,

Naren

Hello,

I have a request from the business to create report in ALV. the report will contain the Accounting Document number, PO number, vendor, and some other fields. The request also states that if the user clicks on the accounting document number, the user should be able to view the document in MIR4. also for the PO number, the user should be able to view in ME23N, and for the vendor, the user should be able to view in XK03. Being new to ALV, I am asking if this can be done and if so, where would I look for the documentation. Is this considered a drilldown? I looked thru the help.sap.com but I am not sure what to look for.

thanks in advance for the help

3 REPLIES 3
Read only

Former Member
0 Likes
1,090

Hi,

Check this alv example..There will be hotspot on the PO number..If you click it will take you ME23N.

TYPE-POOLS: slis.

DATA: gt_fieldcat TYPE slis_t_fieldcat_alv.

DATA: BEGIN OF wa_ekko,

ebeln like ekko-ebeln,

ekorg like ekko-ekorg,

ekgrp like ekko-ekgrp,

END OF wa_ekko.

DATA: v_repid TYPE syrepid.

v_repid = sy-repid.

DATA it_ekko LIKE STANDARD TABLE OF wa_ekko WITH HEADER LINE.

SELECT * UP TO 100 ROWS

FROM ekko

INTO CORRESPONDING FIELDS OF TABLE it_ekko.

CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'

EXPORTING

i_program_name = v_repid

i_internal_tabname = 'WA_EKKO'

i_inclname = v_repid

CHANGING

ct_fieldcat = gt_fieldcat.

  • have hotspot for a PO.

DATA: s_fieldcat LIKE LINE OF gt_fieldcat.

s_fieldcat-hotspot = 'X'.

MODIFY gt_fieldcat FROM s_fieldcat TRANSPORTING hotspot

WHERE fieldname = 'EBELN'.

  • Pass the program.

v_repid = sy-repid.

CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'

EXPORTING

i_callback_program = v_repid

it_fieldcat = gt_fieldcat

i_callback_user_command = 'USER_COMMAND'

TABLES

t_outtab = it_ekko.

----


  • FORM display_detail *

----


  • ........ *

----


  • --> UCOMM *

  • --> SELFIELD *

----


FORM user_command USING ucomm LIKE sy-ucomm

selfield TYPE slis_selfield.

IF ucomm = '&IC1'.

READ TABLE it_ekko INDEX selfield-tabindex.

IF sy-subrc = 0.

SET PARAMETER ID 'BES' FIELD it_ekko-ebeln.

CALL TRANSACTION 'ME23N' AND SKIP FIRST SCREEN.

ENDIF.

ENDIF.

ENDFORM.

Thanks,

Naren

Read only

Former Member
0 Likes
1,089

Hi,

Yes, this can be done. Use event DOUBLE_CLICK of class cl_gui_alv_grid.

1. Declare a local method inside a local class to handle the event DOUBLE_CLICK of class cl_gui_alv_grid.

2. Event will give the row number & column number.

3. Based on it, go to the internal table (which contains the displayed data in the ALV) and get the row. Also, by the column number, you will know whether the use has clicked on Accounting Document Number, PO Number, Vendor or anything else. Hence, you will get the value of the cell clicked by the user.

4. Therefore, Based on it, either call Transaction MIR4 or ME23N or XK03.... Also, set the respective parameter id before calling the transaction.

Reward points if the answer is helpful.

Regards,

Mukul

Read only

Former Member
0 Likes
1,089

Hi timothy,

am unsure if u do want to create a hyperlink for the net browser or if the

po number/ acct doc num when clicked should go to particular screen.

however when writing the form(subroutine) .

use type-pools slis, sel-field value to get the value

then write in the form that screen(call transaction).

moreover follow this link this might help u

http://www.delantt.com/Forum/viewtopic.php?p=491&sid=a74613d58462816b9e0590eae97e86a9

hope this might help u a part.

all the best,

sampath