how to write code alv with interactive?when i clicked
1field i will generated next-level report,is it possible in
alv?



how to write code alv with interactive?when i clicked 1field i will generated next-level report,is..

Answer / nitin sharma

Just check the following code

Building Interactive ALV list
using 'REUSE_ALV_LIST_DISPLAY'.

By Haritha

This program displays the Purchase Order header details on
the basic
list and on double-clicking any of the record on the basic
list,
the item-level information is displayed on the secondary
list.

REPORT ZPURCHASE_ORDER.

************************************************************
***********
* TYPE-POOLS DECLARATION
************************************************************
***********
TYPE-POOLS:
SLIS.

************************************************************
***********
* DATA DECLARATIONS
************************************************************
***********

DATA:
W_EBELN TYPE EKKO-EBELN,
W_PROG TYPE SY-REPID,
T_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
FS_FIELDCAT LIKE LINE OF T_FIELDCAT,
T_EVENTCAT TYPE SLIS_T_EVENT,
W_EVENTCAT LIKE LINE OF T_EVENTCAT.

************************************************************
***********
* SELECT-OPTIONS DECLARATION
************************************************************
***********
SELECT-OPTIONS:
S_EBELN FOR W_EBELN.

************************************************************
***********
* INTERNAL TABLE AND FIELD-STRING DECLARATIONS
************************************************************
***********

DATA:
T_EKKO LIKE
STANDARD TABLE
OF EKKO,
FS_EKKO LIKE LINE OF T_EKKO.

DATA:
T_EKPO LIKE
STANDARD TABLE
OF EKPO,
FS_EKPO LIKE LINE OF T_EKPO.

************************************************************
***********
* START-OF-SELECTION
************************************************************
***********
START-OF-SELECTION.
SELECT *
FROM EKKO
INTO TABLE T_EKKO
WHERE EBELN IN S_EBELN.

W_PROG = SY-REPID.

CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = W_PROG
I_CALLBACK_USER_COMMAND = 'PICK'
I_STRUCTURE_NAME = 'EKKO'
TABLES
T_OUTTAB = T_EKKO
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2
.
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.

*&----------------------------------------------------------
----------*
*& Form pick
*&----------------------------------------------------------
----------*
* -->UCOMM text
* -->SELFIELD text
*-----------------------------------------------------------
----------*
FORM PICK USING COMMAND LIKE SY-UCOMM
SELFIELD TYPE SLIS_SELFIELD.
READ TABLE T_EKKO INTO FS_EKKO INDEX SELFIELD-TABINDEX.

CASE COMMAND.
WHEN '&IC1'.
SELECT *
FROM EKPO
INTO TABLE T_EKPO
WHERE EBELN EQ FS_EKKO-EBELN.

W_PROG = SY-REPID.

CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
I_STRUCTURE_NAME = 'EKPO'
CHANGING
CT_FIELDCAT = T_FIELDCAT
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.

DELETE T_FIELDCAT WHERE FIELDNAME EQ 'EBELN'.
DELETE T_FIELDCAT WHERE FIELDNAME EQ 'BUKRS'.
DELETE T_FIELDCAT WHERE FIELDNAME EQ 'LGORT'.
DELETE T_FIELDCAT WHERE FIELDNAME EQ 'WERKS'.

CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = W_PROG
IT_FIELDCAT = T_FIELDCAT
IT_EVENTS = T_EVENTCAT
TABLES
T_OUTTAB = T_EKPO
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2
.
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.

ENDCASE. " CASE COMMAND
ENDFORM. " FORM PICK

FORM T_EVENTCAT.
W_EVENTCAT-NAME = 'TOP_OF_PAGE'.
W_EVENTCAT-FORM = 'TOP'.
APPEND W_EVENTCAT TO T_EVENTCAT.
ENDFORM.

FORM TOP.
READ TABLE T_EKPO INTO FS_EKPO INDEX 1.
WRITE:/ 'Purchase Document Number'(001),30 FS_EKPO-EBELN,
/ 'Company Code'(002), 30 FS_EKPO-BUKRS,
/ 'Plant'(003), 30 FS_EKPO-WERKS,
/ 'Storage Location'(004),30 FS_EKPO-LGORT.
ENDFORM.

Test Run:


If we enter the Purchasing Document Number and execute,
the Basic list will be displayed as follows.










When we double click on a record,
the secondary list will be displayed as follows:















Yes, it is possible.

Is This Answer Correct ?    6 Yes 1 No

Post New Answer

More SAP ABAP Interview Questions

Can i Have Some Realtime Examples on Bapi ?

1 Answers  


what is T.Code to write ABAP program?

9 Answers   FutureSoft, SAP Labs,


Can you set up background processing using call transaction?

0 Answers  


Explain the relationship between a functional area, user group, and query when developing queries using the sap query tool?

0 Answers  


HOW TO DIFFERENT CALL TRANSACTION ON THE BASIS OF DOUBLE CLICKING ON DIFFERENT FIELD.

0 Answers   Cwell,






What is the difference between table and template?

0 Answers  


What is an abap?

0 Answers  


ABAP : Classical reports events name

0 Answers   Infosys,


Can there be more than 1 main window in sap script?

0 Answers  


​​What is view proxy in abap?

0 Answers  


what is the difference between user-exit & BADIs?

2 Answers  


basic steps for creating subscreen?

2 Answers  


Categories
  • SAP Basis Interview Questions SAP Basis (1262)
  • SAP ABAP Interview Questions SAP ABAP (3939)
  • SAPScript Interview Questions SAPScript (236)
  • SAP SD (Sales & Distribution) Interview Questions SAP SD (Sales & Distribution) (2716)
  • SAP MM (Material Management) Interview Questions SAP MM (Material Management) (911)
  • SAP QM (Quality Management) Interview Questions SAP QM (Quality Management) (99)
  • SAP PP (Production Planning) Interview Questions SAP PP (Production Planning) (523)
  • SAP PM (Plant Maintenance) Interview Questions SAP PM (Plant Maintenance) (252)
  • SAP PS (Project Systems) Interview Questions SAP PS (Project Systems) (138)
  • SAP FI-CO (Financial Accounting & Controlling) Interview Questions SAP FI-CO (Financial Accounting & Controlling) (2766)
  • SAP HR (Human Resource Management) Interview Questions SAP HR (Human Resource Management) (1180)
  • SAP CRM (Customer Relationship Management) Interview Questions SAP CRM (Customer Relationship Management) (432)
  • SAP SRM (Supplier Relationship Management) Interview Questions SAP SRM (Supplier Relationship Management) (132)
  • SAP APO (Advanced Planner Optimizer) Interview Questions SAP APO (Advanced Planner Optimizer) (92)
  • SAP BW (Business Warehouse) Interview Questions SAP BW (Business Warehouse) (896)
  • SAP Business Workflow Interview Questions SAP Business Workflow (72)
  • SAP Security Interview Questions SAP Security (597)
  • SAP Interfaces Interview Questions SAP Interfaces (74)
  • SAP Netweaver Interview Questions SAP Netweaver (282)
  • SAP ALE IDocs Interview Questions SAP ALE IDocs (163)
  • SAP Business One Interview Questions SAP Business One (110)
  • SAP BO BOBJ (Business Objects) Interview Questions SAP BO BOBJ (Business Objects) (388)
  • SAP CPS (Central Process Scheduling) Interview Questions SAP CPS (Central Process Scheduling) (14)
  • SAP GTS (Global Trade Services) Interview Questions SAP GTS (Global Trade Services) (21)
  • SAP Hybris Interview Questions SAP Hybris (132)
  • SAP HANA Interview Questions SAP HANA (700)
  • SAP PI (Process Integration) Interview Questions SAP PI (Process Integration) (113)
  • SAP PO (Process Orchestration) Interview Questions SAP PO (Process Orchestration) (25)
  • SAP BI (Business Intelligence) Interview Questions SAP BI (Business Intelligence) (174)
  • SAP BPC (Business Planning and Consolidation) Interview Questions SAP BPC (Business Planning and Consolidation) (38)
  • SAP BODS (Business Objects Data Services) Interview Questions SAP BODS (Business Objects Data Services) (49)
  • SAP BODI (Business Objects Data Integrator) Interview Questions SAP BODI (Business Objects Data Integrator) (26)
  • SAP Ariba Interview Questions SAP Ariba (9)
  • SAP Fiori Interview Questions SAP Fiori (45)
  • SAP EWM (Extended Warehouse Management) Interview Questions SAP EWM (Extended Warehouse Management) (58)
  • Sap R/3 Interview Questions Sap R/3 (150)
  • SAP FSCM Financial Supply Chain Management Interview Questions SAP FSCM Financial Supply Chain Management (101)
  • SAP WM (Warehouse Management) Interview Questions SAP WM (Warehouse Management) (31)
  • SAP GRC (Governance Risk and Compliance) Interview Questions SAP GRC (Governance Risk and Compliance) (64)
  • SAP MDM (Master Data Management) Interview Questions SAP MDM (Master Data Management) (0)
  • SAP MRS (Multi Resource Scheduling) Interview Questions SAP MRS (Multi Resource Scheduling) (0)
  • SAP ESS MSS (Employee Manager Self Service) Interview Questions SAP ESS MSS (Employee Manager Self Service) (13)
  • SAP CS (Customer Service) Interview Questions SAP CS (Customer Service) (0)
  • SAP TRM (Treasury and Risk Management) Interview Questions SAP TRM (Treasury and Risk Management) (0)
  • SAP Web Dynpro ABAP Interview Questions SAP Web Dynpro ABAP (198)
  • SAP IBP (Integrated Business Planning) Interview Questions SAP IBP (Integrated Business Planning) (0)
  • SAP OO-ABAP (Object Oriented ABAP) Interview Questions SAP OO-ABAP (Object Oriented ABAP) (70)
  • SAP S/4 HANA Finance (Simple Finance) Interview Questions SAP S/4 HANA Finance (Simple Finance) (143)
  • SAP FS-CD (Collections and Disbursements) Interview Questions SAP FS-CD (Collections and Disbursements) (0)
  • SAP PLM (Product Lifecycle Management) Interview Questions SAP PLM (Product Lifecycle Management) (0)
  • SAP SuccessFactors Interview Questions SAP SuccessFactors (33)
  • SAP Vistex Interview Questions SAP Vistex (0)
  • SAP ISR (IS Retail) Interview Questions SAP ISR (IS Retail) (28)
  • SAP IdM (Identity Management) Interview Questions SAP IdM (Identity Management) (0)
  • SAP IM (Investment Management) Interview Questions SAP IM (Investment Management) (0)
  • SAP UI5 Interview Questions SAP UI5 (59)
  • SAP SCM (Supply Chain Management) Interview Questions SAP SCM (Supply Chain Management) (51)
  • SAP XI (Exchange Infrastructure) Interview Questions SAP XI (Exchange Infrastructure) (49)
  • SAP Cloud Platform Interview Questions SAP Cloud Platform (34)
  • SAP Testing Interview Questions SAP Testing (89)
  • SAP SolMan (Solution Manager) Interview Questions SAP SolMan (Solution Manager) (63)
  • SAP MaxDB Interview Questions SAP MaxDB (116)
  • SAP GUI Interview Questions SAP GUI (15)
  • SAP AllOther Interview Questions SAP AllOther (329)