Application Development 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: 

Interactive list

Former Member
0 Kudos

I have a task in which I am displaying material and plant in the basic list. The requirement is, if i click on the material, then it should display the material details in a secondary list and if i click on plant, then it should display the plant details in another secondary list. How to achieve this? can someone suggest me the code for this?

5 REPLIES 5

Former Member
0 Kudos

Hi,

For this requirement ALV output suits best. Because in ALV you will not only be able to select the row on which you have clicked you can also select the column on which you have clicked suiting your requirement better.

If you need more details on how to do this go to FM 'REUSE_ALV_GRID_DISPLAY' and select the documentation on the right hand corner. In the documentation check for the USER_COMMAND Details which will help you achieve this.

Regards,

Pramod

0 Kudos

Hi Pramod, Thanks for your suggestion. But I am not supposed to use ALV in this task.

0 Kudos

Hi Ashwini,

If you are only displaying plant and material then there is an alternative. When you double click on the basic list then popup a confirmation message asking the user if he wants to drilldown on Plant or material. This can be done using an FM i am not sure which, you can search for it using * POPUP * in SE37.

If he selects Material show material details on next list. Else if he states plant then show the plant details.

Hope this helps.

PS : The FM is 'POPUP_WITH_2_BUTTONS_TO_CHOOSE'

Regards,

Pramod

Edited by: Pramod Manjunath on Oct 10, 2008 5:15 PM

satsrockford
Active Participant
0 Kudos

hi

Lists are displayed in a special container screen. As with all other screens, you can link a dialog status to it using the SET PF-STATUS statement. In the dialog status, you link function codes to function keys, menu entries, icons in the standard toolbar, and pushbuttons in the application toolbar.

On a normal screen, a user action triggers the PAI event. In the screen flow logic, you code a processing block that calls ABAP dialog modules in this event. In list processing, the event is intercepted by the list processor and processed. Instead of calling dialog modules, one of the three following list events may be called, depending on the function code triggered by the user.

AT PF<nn> (obsolete)

AT LINE-SELECTION

AT USER-COMMAND

If you have written the corresponding event blocks in your program, they are executed. You can access the function code in the system field SY-UCOMM.

The output from any list statements that you write in these event blocks is written to detail lists. With one ABAP program, you can maintain one basic list and up to 19 detail lists.

Check this sample code..

REPORT ZTEST_ALV123 .

TYPE-POOLS:SLIS.

DATA : IT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,

IT_FIELDCAT1 TYPE SLIS_T_FIELDCAT_ALV.

DATA: BEGIN OF ITAB OCCURS 0,

VBELN LIKE VBAK-VBELN,

END OF ITAB.

DATA: BEGIN OF ITAB1 OCCURS 0,

VBELN LIKE VBAK-VBELN,

POSNR LIKE VBAP-POSNR,

END OF ITAB1.

SELECT VBELN

FROM VBAK

UP TO 100 ROWS

INTO TABLE ITAB.

IF SY-SUBRC = 0.

sort itab by vbeln .

SELECT VBELN

POSNR

INTO TABLE ITAB1

FROM VBAP

FOR ALL ENTRIES IN ITAB

WHERE VBELN = ITAB-VBELN.

ENDIF.

DATA: X_FIELDCAT TYPE SLIS_FIELDCAT_ALV.

X_FIELDCAT-FIELDNAME = 'VBELN'.

X_FIELDCAT-TABNAME = 'ITAB'.

X_FIELDCAT-COL_POS = 1.

APPEND X_FIELDCAT TO IT_FIELDCAT.

CLEAR X_FIELDCAT.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

I_CALLBACK_PROGRAM = SY-REPID

I_CALLBACK_PF_STATUS_SET = 'POPUP'

I_CALLBACK_USER_COMMAND = 'HANDLE_USER_COMMAND'

IT_FIELDCAT = IT_FIELDCAT

TABLES

T_OUTTAB = ITAB

EXCEPTIONS

PROGRAM_ERROR = 1

OTHERS = 2.

IF SY-SUBRC = 0.

ENDIF.

FORM POPUP USING P_EXTAB TYPE SLIS_T_EXTAB.

*- Pf status

SET PF-STATUS 'POPUP'.

ENDFORM. " POPUP

FORM HANDLE_USER_COMMAND USING R_UCOMM LIKE SY-UCOMM

RS_SELFIELD TYPE SLIS_SELFIELD.

CASE R_UCOMM.

WHEN '&IC1'.

PERFORM INTERACTIVE_REPORT.

ENDCASE.

ENDFORM. "HANDLE_USER_COMMAND

FORM INTERACTIVE_REPORT .

X_FIELDCAT-FIELDNAME = 'VBELN'.

X_FIELDCAT-TABNAME = 'ITAB1'.

X_FIELDCAT-COL_POS = 1.

APPEND X_FIELDCAT TO IT_FIELDCAT1.

CLEAR X_FIELDCAT.

X_FIELDCAT-FIELDNAME = 'POSNR'.

X_FIELDCAT-TABNAME = 'ITAB1'.

X_FIELDCAT-COL_POS = 2.

APPEND X_FIELDCAT TO IT_FIELDCAT1.

CLEAR X_FIELDCAT.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

I_CALLBACK_PROGRAM = SY-REPID

IT_FIELDCAT = IT_FIELDCAT1

TABLES

T_OUTTAB = ITAB1

EXCEPTIONS

PROGRAM_ERROR = 1

OTHERS = 2.

IF SY-SUBRC = 0.

ENDIF.

ENDFORM. " interactive_report

See this code sample

http://www.sap-img.com/abap/an-interactive-alv-report.htm