Skip to Content
0
Former Member
Nov 15, 2012 at 07:28 PM

ALV double click to transaction

1315 Views

Good day and be well friends. The purpose of the program is to accept a range of equipment numbers and display them and a description (will display all if empty fields). I have gotten this far fine. Now I need to double click an equipment number, and then call transaction IE03 with that number. I've tried several examples, and while they compile there is no difference I can see compared to when it was 10 lines shorter. Thank you for taking the time to help me as I am new to ALV.

REPORT ZFV_EQUIPMENT_DISPLAY2.
TABLES: mara,
makt, eqkt.
*EQUNR EQKTX EQKTU

* Data output
DATA: BEGIN OF t_report OCCURS 3,
matnr LIKE eqkt-equnr,
mtart LIKE eqkt-eqktx,
maktx LIKE eqkt-eqktu,
END OF t_report.

* Field desciption / field catalog
TYPE-POOLS: SLIS.
data t_fcat type SLIS_T_FIELDCAT_ALV.

*-
DATA: d_repid LIKE sy-repid.

*-----------------------------------------
*--Selection Screen
SELECT-OPTIONS: s_matnr FOR mara-matnr.

*-----------------------------------------
START-OF-SELECTION.
*-Read data
SELECT * FROM eqkt
WHERE equnr IN s_matnr.
CLEAR makt.
SELECT SINGLE *
FROM makt
WHERE matnr = eqkt-equnr AND
spras = sy-langu.
MOVE: eqkt-equnr TO t_report-matnr,
eqkt-eqktx TO t_report-mtart,
eqkt-eqktu TO t_report-maktx.
APPEND t_report.
ENDSELECT.

IF sy-subrc NE 0.
WRITE 'No data found'.
EXIT.
ENDIF.
*-Create Field Catalog

* Store report name
d_repid = sy-repid.

* Create Fieldcatalogue from internal table
* Use capital letter for I_INTERNAL_TABNAME
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
I_PROGRAM_NAME = d_repid
I_INTERNAL_TABNAME = 'T_REPORT'
I_INCLNAME = d_repid
CHANGING
CT_FIELDCAT = t_fcat
EXCEPTIONS
INCONSISTENT_INTERFACE = 1
PROGRAM_ERROR = 2
OTHERS = 3.

IF SY-SUBRC <> 0.
write: / 'Error:',sy-subrc,
'when Create Field Catalog'.
EXIT.
ENDIF.

* Call ALV List Display
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = d_repid
IT_FIELDCAT = t_fcat
TABLES
T_OUTTAB = t_report
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2.

IF SY-SUBRC <> 0.
write: / 'Error:',sy-subrc,
'when Call ALV List Display'.
EXIT.
ENDIF.

*double click to call IE03
FORM user_command USING r_ucomm
wa_selrow TYPE slis_selfield.

IF r_ucomm = '&IC1'.
READ TABLE t_report INDEX wa_selrow-tabindex.
IF sy-subrc = 0.
SET PARAMETER ID 'EQN' FIELD t_report-matnr.
CALL TRANSACTION 'IE03' AND SKIP FIRST SCREEN.
ENDIF.
ENDIF.
ENDFORM.