Reputation: 309
I have made a program which outputs a list of equipment numbers using WRITE
. The transaction IE03
lets the user input an equipment number, execute, and then displays a whole bunch of information on that piece of equipment.
What I would like to do is be able to double click on one of the numbers my program outputs, and then have the data display that IE03
would offer.
How do I integrate my custom program with the standard display functions?
Upvotes: 2
Views: 6692
Reputation: 74
Use the advice which gave vwegert, or:
REPORT ztest. CONSTANTS: gc_equpment_view_tcode TYPE sytcode VALUE 'IE03'. DATA: gt_eqkt TYPE TABLE OF eqkt, gs_eqkt TYPE eqkt. START-OF-SELECTION. SELECT * INTO CORRESPONDING FIELDS OF TABLE gt_eqkt FROM eqkt JOIN equi ON ( equi~equnr EQ eqkt~equnr ) UP TO 10 ROWS WHERE eqkt~spras EQ sy-langu. END-OF-SELECTION. LOOP AT gt_eqkt INTO gs_eqkt. WRITE: / gs_eqkt-equnr, gs_eqkt-eqktx. HIDE: gs_eqkt-equnr. ENDLOOP. AT LINE-SELECTION. CALL FUNCTION 'AUTHORITY_CHECK_TCODE' " check S_TCODE auth. object EXPORTING tcode = gc_equpment_view_tcode EXCEPTIONS ok = 1 not_ok = 2 OTHERS = 3. IF sy-subrc EQ 1. SET PARAMETER ID 'EQN' FIELD gs_eqkt-equnr. "check I_TCODE auth. object (see IE03 definition) CALL TRANSACTION gc_equpment_view_tcode AND SKIP FIRST SCREEN. ENDIF.
Upvotes: 1
Reputation: 18493
First of all, don't use WRITE
to create lists - this is stone-age technology. Store your data in an internal table based on a dictionary structure, then use the SALV library to create a list. Take a look at the sample program SALV_DEMO_TABLE_EVENTS
to see how to display a list and react to a double click. Note that you can throw away much of the demo program because it shows quite a lot of different functions.
Then, you don't "forward" anything to a transaction. You can call a transaction using the ABAP statement CALL TRANSACTION
(which should be obvious), and you can even pass some values using a crooked mix of SPA/GPA parameters and the addition ... AND SKIP FIRST SCREEN
. Be aware that this only works for certain kinds of transactions and only if they were programmed to do so. For this, you need to store the equipment number in a global variable using
SET PARAMETER ID 'EQN' FIELD l_my_equipment_number.
and then call the transaction
CALL TRANSACTION 'IE03' AND SKIP FIRST SCREEN.
Be aware that this statement does not perform the default authorization checks - if you need to do so, use the function module AUTHORITY_CHECK_TCODE
as specified by the keyword documentation.
Upvotes: 3