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: 

Double Click in ALV

Former Member
0 Kudos

Hello Friends

I have an ALV Program. List shows may Sales Order numbers(vbak-vbeln).

If I double click on a particular Vbeln , same Vbeln should open in VA03.

Thanks in Advance

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Is it alv list or alv grid??

14 REPLIES 14

Former Member
0 Kudos

Is it alv list or alv grid??

0 Kudos

Ram

It is Grid display, ALV oops concept

Message was edited by:

swati kota

0 Kudos

Hi Swati...

you can do this by using the code mentioned above by me and in that instead of displaying second list....

you should call...

Call transaction 'VA03' USING bdc_tab [bdc_options]

this you will get by F1 on CALL TRANSACTION which will give you BDC_OPTION parameters to be passed...

there you need to pass VA03 screen's program name, screen number and Field name VBELN(as on the screen on VA03) and its value ( as achieved from you rprogram)

so this will run VA03 with that VBELN.

<b>Reward helpful answers with points.</b>

Regards,

Tejas

0 Kudos

hi,

If u r using oops for alv, try this.

<b>Step 1)declare class & method.</b>

CLASS DBL_CLICK DEFINITION.

PUBLIC SECTION.

METHODS: DBLCLICK_HANDEL FOR EVENT DOUBLE_CLICK OF CL_GUI_ALV_GRID

IMPORTING E_ROW E_COLUMN.

ENDCLASS. "DBL_CLICK DEFINITION

<b>Step 2)Write ur coding in the method.</b>

CLASS DBL_CLICK IMPLEMENTATION.

METHOD DBLCLICK_HANDEL.

READ TABLE IT_alv INDEX E_ROW-INDEX INTO WA_alv.

SET PARAMETER ID 'AUN' FIELD WA_ALV-VBELN.

CALL TRANSACTION 'VA03'.

ENDMETHOD. "DBLCLICK_HANDEL

ENDCLASS. "DBL_CLICK IMPLEMENTATION

******REWARD PTS IF USEFUL

0 Kudos

Thank very much vijayalakshmi modhukur.

it solved the problem

but a quick question. what is ' AUN '

IN SET PARAMETER ID 'AUN' FIELD WA_ALV-VBELN.

Y IS IT HARD CODED.

0 Kudos

Hi swati,

'AUN' is nothing but the parameter id of the field vbeln.U can find this by finding f1 help on screen field order of va03 .the order no that u click on alv will passed to this screen by seting the parameter id.

Any more queries keep in touch.

Regards,

Viji

0 Kudos

Viji

I understood . Thank you.

rahulkavuri
Active Contributor
0 Kudos

hi check this code which address ur issue, dont forget to award points if found helpful

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

I_CALLBACK_PROGRAM = SY-REPID

IS_LAYOUT = LAYOUT

IT_FIELDCAT = IT_FIELDCAT

IT_SORT = IT_SORT

I_CALLBACK_PF_STATUS_SET = 'STATUS'

IT_EXCLUDING = I_FCODE_EXTAB

I_CALLBACK_USER_COMMAND = 'USER_COMMAND'

IT_EVENTS = IT_EVENTS[]

TABLES

T_OUTTAB = IT_VBAK.

  • EXCEPTIONS

  • PROGRAM_ERROR = 1

  • OTHERS = 2

<b>

FORM USER_COMMAND USING R_UCOMM LIKE SY-UCOMM

RS_SELFIELD TYPE SLIS_SELFIELD.

CASE R_UCOMM.

WHEN 'BACK' OR 'CANC' OR 'EXIT'.

LEAVE TO SCREEN 0.

WHEN '&IC1'.

SET PARAMETER ID 'AUN' FIELD RS_SELFIELD-VALUE.

CALL TRANSACTION 'VA03' AND SKIP FIRST SCREEN.

ENDCASE.

ENDFORM. "USER_COMMAND</b>

Former Member
0 Kudos

REPORT Ztest_ALV

NO STANDARD PAGE HEADING

LINE-SIZE 180

MESSAGE-ID /EMN/SD.

*class lcl_event_receiver definition deferred.

----


  • T A B L E S *

----


TABLES : /EMN/DMS_DTLS. "DMS Details

    • Class Declarations

CLASS LCL_EVENT_RECEIVER DEFINITION DEFERRED.

----


  • T Y P E D E C L A R A T I O N S *

----


  • Types for Selection Data

TYPES : BEGIN OF T_CHKINFO,

BELNR TYPE /EMN/DMS_DTLS-BELNR, "Invoice

YCHKNO TYPE /EMN/DMS_DTLS-YCHKNO, "Check no

YCHKDT TYPE /EMN/DMS_DTLS-YCHKDT, "Check Date

YCHKAM TYPE /EMN/DMS_DTLS-YCHKAM, "Check Amount

YAENAM TYPE /EMN/DMS_DTLS-YAENAM, "User ID

END OF T_CHKINFO.

  • Types for User Data

TYPES : BEGIN OF T_USR21,

BNAME TYPE USR21-BNAME, "User Name in User Master Record

PERSNUMBER TYPE USR21-PERSNUMBER, "Person number

END OF T_USR21.

  • Types for User Name Details

TYPES : BEGIN OF T_ADRP,

PERSNUMBER TYPE /EMN/DMS_DTLS-YCHKNO, "Person number

NAME_FIRST TYPE ADRP-NAME_FIRST, "First name

NAME_LAST TYPE ADRP-NAME_LAST, "Last name

END OF T_ADRP.

  • Types for ALV List

TYPES : BEGIN OF T_FINAL,

BELNR TYPE /EMN/DMS_DTLS-BELNR, "Invoice

YCHKNO TYPE /EMN/DMS_DTLS-YCHKNO, "Check no

YCHKDT TYPE /EMN/DMS_DTLS-YCHKDT, "Check Date

YCHKAM TYPE /EMN/DMS_DTLS-YCHKAM, "Check Amount

YAENAM TYPE /EMN/DMS_DTLS-YAENAM, "User ID

NAME_FIRST TYPE ADRP-NAME_FIRST, "First name

NAME_LAST TYPE ADRP-NAME_LAST, "Last name

END OF T_FINAL.

----


  • I N T E R N A L T A B L E D E C L A R A T I O N S

----


DATA: WA_FINAL TYPE T_FINAL.

DATA : DT_CHKINFO TYPE STANDARD TABLE OF T_CHKINFO WITH HEADER LINE ,

DT_USR21 TYPE STANDARD TABLE OF T_USR21,

DT_ADRP TYPE STANDARD TABLE OF T_ADRP,

DT_FINAL TYPE STANDARD TABLE OF T_FINAL WITH HEADER LINE,

  • ALV Internal tables (Standard Internal Tables)

  • Catalog of fields for ALV

DT_FIELDCAT TYPE LVC_T_FCAT,

  • Internal table of alv sort

DT_SORT TYPE LVC_T_SORT.

----


  • D A T A D E C L A R A T I O N S

----


DATA: DG_TABIX TYPE SY-TABIX,

DG_COL_POS TYPE I, " Column

DG_ROW_POS TYPE I, " Row

DG_DATE1(10), " Date

DG_EXIT(1) TYPE C, " Exit for no data

DG_GRID TYPE REF TO CL_GUI_ALV_GRID, " Grid Control

DG_TXT(255) TYPE C, " Text

DG_TIME(8), " Time

DG_DATE(10), " Date

DG_SUBJECT TYPE SIN_OBJ_DE, " Subject for Mail

DG_REASON TYPE SIN_OBJ_DE, " Reason

DG_CONTAINER TYPE SCRFNAME VALUE 'MODIFYDATEPROG',

" Container Name

DG_CUSTOM_CONTAINER TYPE REF

TO CL_GUI_CUSTOM_CONTAINER, " Custom Cont.

DG_SPLITTER TYPE REF

TO CL_GUI_SPLITTER_CONTAINER, " Splitter Cont.

DG_CONTAINER_1 TYPE REF TO CL_GUI_CONTAINER, " container 1

DG_CONTAINER_2 TYPE REF TO CL_GUI_CONTAINER, " container 2

DG_OK_CODE LIKE SY-UCOMM, " OK Code

DG_LOGO TYPE REF TO CL_DD_AREA, " Print logo

DG_DYNDOC_ID TYPE REF TO CL_DD_DOCUMENT, " Text

DG_REPID TYPE SY-REPID, " Program Name

EVENT_RECEIVER TYPE REF TO LCL_EVENT_RECEIVER.

----


  • S T R U C T U R E D E C L A R A T I O N S

----


  • ALV List workareas

*Structure for Field catalog

DATA: DS_FIELDCAT_LN LIKE LINE OF DT_FIELDCAT,

  • Structure for ALV Grid layout properties

DS_LAYOUT TYPE LVC_S_LAYO,

  • Structure for alv sort

DS_SORT TYPE LVC_S_SORT.

----


  • C O N S T A N T D E C L A R A T I O N S

----


CONSTANTS: C_X(1) TYPE C VALUE 'X'. " Value X

----


  • I N P U T S C R E E N

----


SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001."Selection

SELECT-OPTIONS : S_BELNR FOR /EMN/DMS_DTLS-BELNR, "Invoice no

S_YCHKDT FOR /EMN/DMS_DTLS-YCHKDT, "Check Date

S_YAENAM FOR /EMN/DMS_DTLS-YAENAM. "User ID

SELECTION-SCREEN END OF BLOCK B1.

----


      • CLASS DEFINITION

----


CLASS LCL_EVENT_RECEIVER DEFINITION.

PUBLIC SECTION.

METHODS:

GET_DATA ,

HANDLE_ROW_CLICK

FOR EVENT HOTSPOT_CLICK OF CL_GUI_ALV_GRID

IMPORTING E_ROW_ID E_COLUMN_ID ES_ROW_NO,

DISPLAY_LIST.

ENDCLASS. "lcl_event_receiver DEFINITION

----


      • CLASS IMPLEMENTATION

----


CLASS LCL_EVENT_RECEIVER IMPLEMENTATION.

METHOD GET_DATA.

CLEAR DG_REPID.

DG_REPID = SY-REPID.

PERFORM GET_DATA.

ENDMETHOD. "GET_DATA

METHOD HANDLE_ROW_CLICK.

READ TABLE DT_FINAL INTO WA_FINAL INDEX E_ROW_ID.

IF SY-SUBRC = 0.

EXPORT WA_FINAL FROM WA_FINAL TO MEMORY ID 'ZCHK'.

CALL TRANSACTION 'YDMSCHKINFO'.

ENDIF.

ENDMETHOD. "handle_row_click

METHOD DISPLAY_LIST.

IF DT_FINAL[] IS NOT INITIAL.

  • Display ALV Grid List

PERFORM DISPLAY_LIST.

ENDIF.

ENDMETHOD. "DISPLAY_LIST

ENDCLASS. "lcl_event_receiver IMPLEMENTATION

----


  • S T A R T O F S E L E C T I O N

----


START-OF-SELECTION.

  • Create object for Check Data

CREATE OBJECT EVENT_RECEIVER.

CALL METHOD EVENT_RECEIVER->GET_DATA.

----


  • E N D O F S E L E C T I O N

----


END-OF-SELECTION.

  • Display ALV GRID Report

CALL METHOD EVENT_RECEIVER->DISPLAY_LIST.

&----


*& Form GET_DATA

&----


  • Perform to Get Data

----


FORM GET_DATA .

DATA: WA_USR21 TYPE T_USR21,

WA_ADRP TYPE T_ADRP,

WA_CHKINFO TYPE T_CHKINFO.

CLEAR :DT_CHKINFO,DT_CHKINFO[].

    • Fetch the Check Info from /EMN/DMS_DTLS

SELECT BELNR

YCHKNO

YCHKDT

YCHKAM

YAENAM

FROM /EMN/DMS_DTLS

INTO TABLE DT_CHKINFO

WHERE BELNR IN S_BELNR

AND YCHKDT IN S_YCHKDT

AND YAENAM IN S_YAENAM.

IF SY-SUBRC = 0.

SORT DT_CHKINFO BY BELNR YAENAM.

    • Fetch the User Data from USR21

SELECT BNAME

PERSNUMBER

FROM USR21

INTO TABLE DT_USR21

FOR ALL ENTRIES IN DT_CHKINFO

WHERE BNAME = DT_CHKINFO-YAENAM.

IF SY-SUBRC = 0.

SORT DT_USR21 BY BNAME.

    • Fetch the User Name Details from ADRP

SELECT PERSNUMBER

NAME_FIRST

NAME_LAST

FROM ADRP

INTO TABLE DT_ADRP

FOR ALL ENTRIES IN DT_USR21

WHERE PERSNUMBER = DT_USR21-PERSNUMBER.

IF SY-SUBRC = 0.

LOOP AT DT_CHKINFO INTO WA_CHKINFO..

WA_FINAL-BELNR = WA_CHKINFO-BELNR.

WA_FINAL-YCHKNO = WA_CHKINFO-YCHKNO.

WA_FINAL-YCHKDT = WA_CHKINFO-YCHKDT.

WA_FINAL-YCHKAM = WA_CHKINFO-YCHKAM.

WA_FINAL-YAENAM = WA_CHKINFO-YAENAM.

READ TABLE DT_USR21 INTO WA_USR21 WITH KEY BNAME = WA_CHKINFO-YAENAM.

CLEAR WA_CHKINFO.

IF SY-SUBRC = 0.

READ TABLE DT_ADRP INTO WA_ADRP WITH KEY PERSNUMBER = WA_USR21-PERSNUMBER.

CLEAR WA_USR21.

IF SY-SUBRC = 0.

WA_FINAL-NAME_FIRST = WA_ADRP-NAME_FIRST.

WA_FINAL-NAME_LAST = WA_ADRP-NAME_LAST.

CLEAR WA_ADRP.

ENDIF.

ENDIF.

APPEND WA_FINAL TO DT_FINAL.

CLEAR WA_FINAL.

ENDLOOP.

ENDIF.

ENDIF.

ELSE.

MESSAGE I000 WITH 'No Data Found for Given criteria'.

ENDIF.

ENDFORM. " GET_DATA

&----


*& Form display_list

&----


  • Perform to Display the Data

----


FORM DISPLAY_LIST .

  • Build catalog and assign layout settings

PERFORM BUILD_HEADER.

  • Display ALV Grid List in screen 100 for Grid Control

CALL SCREEN 100.

ENDFORM. " display_list

&----


*& Form build_header

&----


  • Perform to Build the Heading for the Report

----


FORM BUILD_HEADER .

  • Field catalog

REFRESH DT_FIELDCAT.

  • Invoice Number

ADD 1 TO DG_ROW_POS.

ADD 1 TO DG_COL_POS.

CLEAR DS_FIELDCAT_LN.

DS_FIELDCAT_LN-FIELDNAME = 'BELNR'.

DS_FIELDCAT_LN-INTTYPE = 'C'.

DS_FIELDCAT_LN-OUTPUTLEN = '12'.

DS_FIELDCAT_LN-ROW_POS = DG_ROW_POS. " Position in row

DS_FIELDCAT_LN-COL_POS = DG_COL_POS. " Position in column

DS_FIELDCAT_LN-SELTEXT = 'Invoice Number'.

DS_FIELDCAT_LN-SCRTEXT_M = 'Invoice Number'.

DS_FIELDCAT_LN-HOTSPOT = C_X.

APPEND DS_FIELDCAT_LN TO DT_FIELDCAT.

  • Check No

ADD 1 TO DG_COL_POS.

CLEAR DS_FIELDCAT_LN.

DS_FIELDCAT_LN-FIELDNAME = 'YCHKNO'.

DS_FIELDCAT_LN-INTTYPE = 'C'.

DS_FIELDCAT_LN-OUTPUTLEN = '10'.

DS_FIELDCAT_LN-ROW_POS = DG_ROW_POS. " Position in row

DS_FIELDCAT_LN-COL_POS = DG_COL_POS. " Position in column

DS_FIELDCAT_LN-SELTEXT = 'Check No '.

DS_FIELDCAT_LN-SCRTEXT_M = 'Check No '.

APPEND DS_FIELDCAT_LN TO DT_FIELDCAT.

  • Check Date

ADD 1 TO DG_COL_POS.

CLEAR DS_FIELDCAT_LN.

DS_FIELDCAT_LN-FIELDNAME = 'YCHKDT'.

DS_FIELDCAT_LN-INTTYPE = 'D'.

DS_FIELDCAT_LN-OUTPUTLEN = '10'.

DS_FIELDCAT_LN-ROW_POS = DG_ROW_POS. " Position in row

DS_FIELDCAT_LN-COL_POS = DG_COL_POS. " Position in column

DS_FIELDCAT_LN-SELTEXT = 'Check Date'.

DS_FIELDCAT_LN-SCRTEXT_M = 'Check Date'.

APPEND DS_FIELDCAT_LN TO DT_FIELDCAT.

*Check Amount

ADD 1 TO DG_COL_POS.

CLEAR DS_FIELDCAT_LN.

DS_FIELDCAT_LN-FIELDNAME = 'YCHKAM'.

DS_FIELDCAT_LN-INTTYPE = 'C'.

DS_FIELDCAT_LN-OUTPUTLEN = '14'.

DS_FIELDCAT_LN-ROW_POS = DG_ROW_POS. " Position in row

DS_FIELDCAT_LN-COL_POS = DG_COL_POS. " Position in column

DS_FIELDCAT_LN-SELTEXT = 'Check Amount'.

DS_FIELDCAT_LN-SCRTEXT_M = 'Check Amount'.

APPEND DS_FIELDCAT_LN TO DT_FIELDCAT.

  • User ID

ADD 1 TO DG_COL_POS.

CLEAR DS_FIELDCAT_LN.

DS_FIELDCAT_LN-FIELDNAME = 'YAENAM'.

DS_FIELDCAT_LN-INTTYPE = 'C'.

DS_FIELDCAT_LN-OUTPUTLEN = '12'.

DS_FIELDCAT_LN-ROW_POS = DG_ROW_POS. " Position in row

DS_FIELDCAT_LN-COL_POS = DG_COL_POS. " Position in column

DS_FIELDCAT_LN-SELTEXT = 'User ID'.

DS_FIELDCAT_LN-SCRTEXT_M = 'User ID'.

APPEND DS_FIELDCAT_LN TO DT_FIELDCAT.

  • User First Name

ADD 1 TO DG_COL_POS.

CLEAR DS_FIELDCAT_LN.

DS_FIELDCAT_LN-FIELDNAME = 'NAME_FIRST'.

DS_FIELDCAT_LN-INTTYPE = 'C'.

DS_FIELDCAT_LN-OUTPUTLEN = '25'.

DS_FIELDCAT_LN-ROW_POS = DG_ROW_POS. " Position in row

DS_FIELDCAT_LN-COL_POS = DG_COL_POS. " Position in column

DS_FIELDCAT_LN-SELTEXT = 'First Name'.

DS_FIELDCAT_LN-SCRTEXT_M = 'First Name'.

APPEND DS_FIELDCAT_LN TO DT_FIELDCAT.

  • User Last Name

ADD 1 TO DG_COL_POS.

CLEAR DS_FIELDCAT_LN.

DS_FIELDCAT_LN-FIELDNAME = 'NAME_LAST'.

DS_FIELDCAT_LN-INTTYPE = 'C'.

DS_FIELDCAT_LN-OUTPUTLEN = '25'.

DS_FIELDCAT_LN-ROW_POS = DG_ROW_POS. " Position in row

DS_FIELDCAT_LN-COL_POS = DG_COL_POS. " Position in column

DS_FIELDCAT_LN-SELTEXT = 'Last Name'.

DS_FIELDCAT_LN-SCRTEXT_M = 'Last Name'.

APPEND DS_FIELDCAT_LN TO DT_FIELDCAT.

ENDFORM. " build_header

&----


*& Module STATUS_0100 OUTPUT

&----


  • text

----


MODULE STATUS_0100 OUTPUT.

  • Set PF Status

SET PF-STATUS 'ZCHK'.

SET TITLEBAR 'ZTITLE'.

WRITE SY-UZEIT TO DG_TIME. " Time

WRITE SY-DATUM TO DG_DATE. " Date

  • ALV Layout

CLEAR DS_LAYOUT.

  • DS_LAYOUT-CWIDTH_OPT = C_X.

  • Create a custom container object

IF DG_CUSTOM_CONTAINER IS INITIAL.

CREATE OBJECT DG_CUSTOM_CONTAINER

EXPORTING

CONTAINER_NAME = DG_CONTAINER

EXCEPTIONS

CNTL_ERROR = 1

CNTL_SYSTEM_ERROR = 2

CREATE_ERROR = 3

LIFETIME_ERROR = 4

LIFETIME_DYNPRO_DYNPRO_LINK = 5.

IF SY-SUBRC <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

  • Create Splitter container object in custom container

CREATE OBJECT DG_SPLITTER

EXPORTING

PARENT = DG_CUSTOM_CONTAINER

ROWS = 2

COLUMNS = 1

EXCEPTIONS

CNTL_ERROR = 1

CNTL_SYSTEM_ERROR = 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.

  • Assigning container 1 to splitter container

CALL METHOD DG_SPLITTER->GET_CONTAINER

EXPORTING

ROW = 1

COLUMN = 1

RECEIVING

CONTAINER = DG_CONTAINER_1.

  • Assigning height to row

CALL METHOD DG_SPLITTER->SET_ROW_HEIGHT

EXPORTING

ID = '1'

HEIGHT = 24

EXCEPTIONS

CNTL_ERROR = 1

CNTL_SYSTEM_ERROR = 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.

  • Create Document object

CREATE OBJECT DG_DYNDOC_ID

EXPORTING STYLE = 'ALV_GRID'.

  • Add Text for Heading

CALL METHOD DG_DYNDOC_ID->ADD_TEXT

EXPORTING

TEXT = 'DMS Check Info Report'

SAP_STYLE = CL_DD_AREA=>HEADING.

  • Add Line

CALL METHOD DG_DYNDOC_ID->NEW_LINE.

  • Add Text for Heading

CALL METHOD DG_DYNDOC_ID->ADD_TEXT

EXPORTING

TEXT = 'Invoice no'

SAP_EMPHASIS = CL_DD_AREA=>STRONG.

  • Add Gap for Text

CALL METHOD DG_DYNDOC_ID->ADD_GAP.

  • Add Text for :

CALL METHOD DG_DYNDOC_ID->ADD_TEXT

EXPORTING

TEXT = ':'

SAP_EMPHASIS = CL_DD_AREA=>STRONG.

  • Add Gap for Text

CALL METHOD DG_DYNDOC_ID->ADD_GAP

EXPORTING

WIDTH = 2.

  • Add Text for Heading

IF S_BELNR-LOW IS NOT INITIAL.

WRITE S_BELNR-LOW TO DG_TXT.

ELSE.

CLEAR DG_TXT.

ENDIF.

CALL METHOD DG_DYNDOC_ID->ADD_TEXT

EXPORTING

TEXT = DG_TXT.

  • Add Gap for Text

CALL METHOD DG_DYNDOC_ID->ADD_GAP.

if S_BELNR-low is not initial or S_BELNR-HIGH is not initial.

  • Add Text for Heading

CALL METHOD DG_DYNDOC_ID->ADD_TEXT

EXPORTING

TEXT = 'To'

SAP_EMPHASIS = CL_DD_AREA=>STRONG.

endif.

  • Add Gap for Text

CALL METHOD DG_DYNDOC_ID->ADD_GAP.

  • Add Text for Heading

IF S_BELNR-HIGH IS NOT INITIAL.

WRITE S_BELNR-HIGH TO DG_TXT.

ELSE.

CLEAR DG_TXT.

ENDIF.

CALL METHOD DG_DYNDOC_ID->ADD_TEXT

EXPORTING

TEXT = DG_TXT.

  • Add Line

CALL METHOD DG_DYNDOC_ID->NEW_LINE.

  • Add Line

CALL METHOD DG_DYNDOC_ID->NEW_LINE.

  • Add Text for Heading

CALL METHOD DG_DYNDOC_ID->ADD_TEXT

EXPORTING

TEXT = 'Chk Date'

SAP_EMPHASIS = CL_DD_AREA=>STRONG.

  • Add Gap for Text

CALL METHOD DG_DYNDOC_ID->ADD_GAP.

  • Add Text for :

CALL METHOD DG_DYNDOC_ID->ADD_TEXT

EXPORTING

TEXT = ':'

SAP_EMPHASIS = CL_DD_AREA=>STRONG.

  • Add Gap for Text

CALL METHOD DG_DYNDOC_ID->ADD_GAP

EXPORTING

WIDTH = 2.

  • Add Text for Heading

IF S_YCHKDT-LOW IS NOT INITIAL.

WRITE S_YCHKDT-LOW TO DG_TXT MM/DD/YYYY.

ELSE.

CLEAR DG_TXT.

ENDIF.

CALL METHOD DG_DYNDOC_ID->ADD_TEXT

EXPORTING

TEXT = DG_TXT.

  • Add Gap for Text

CALL METHOD DG_DYNDOC_ID->ADD_GAP.

if S_YCHKDT-LOW is not initial or S_YCHKDT-HIGH is not initial.

  • Add Text for Heading

CALL METHOD DG_DYNDOC_ID->ADD_TEXT

EXPORTING

TEXT = 'To'

SAP_EMPHASIS = CL_DD_AREA=>STRONG.

endif.

  • Add Gap for Text

CALL METHOD DG_DYNDOC_ID->ADD_GAP.

  • Add Text for Heading

IF S_YCHKDT-HIGH IS NOT INITIAL.

WRITE S_YCHKDT-HIGH TO DG_TXT MM/DD/YYYY.

ELSE.

CLEAR DG_TXT.

ENDIF.

CALL METHOD DG_DYNDOC_ID->ADD_TEXT

EXPORTING

TEXT = DG_TXT.

  • Add Line

CALL METHOD DG_DYNDOC_ID->NEW_LINE.

  • Add Line

CALL METHOD DG_DYNDOC_ID->NEW_LINE.

  • Add Text for Heading

CALL METHOD DG_DYNDOC_ID->ADD_TEXT

EXPORTING

TEXT = 'User ID'

SAP_EMPHASIS = CL_DD_AREA=>STRONG.

  • Add Gap for Text

CALL METHOD DG_DYNDOC_ID->ADD_GAP.

  • Add Text for :

CALL METHOD DG_DYNDOC_ID->ADD_TEXT

EXPORTING

TEXT = ':'

SAP_EMPHASIS = CL_DD_AREA=>STRONG.

  • Add Gap for Text

CALL METHOD DG_DYNDOC_ID->ADD_GAP

EXPORTING

WIDTH = 2.

  • Add Text for Heading

IF S_YAENAM-LOW IS NOT INITIAL.

WRITE S_YAENAM-LOW TO DG_TXT.

ELSE.

CLEAR DG_TXT.

ENDIF.

CALL METHOD DG_DYNDOC_ID->ADD_TEXT

EXPORTING

TEXT = DG_TXT.

  • Add Gap for Text

CALL METHOD DG_DYNDOC_ID->ADD_GAP.

if S_YAENAM-LOW is not initial or S_YAENAM-HIGH is not initial.

  • Add Text for Heading

CALL METHOD DG_DYNDOC_ID->ADD_TEXT

EXPORTING

TEXT = 'To'

SAP_EMPHASIS = CL_DD_AREA=>STRONG.

endif.

  • Add Gap for Text

CALL METHOD DG_DYNDOC_ID->ADD_GAP.

  • Add Text for Heading

IF S_YAENAM-HIGH IS NOT INITIAL.

WRITE S_YAENAM-HIGH TO DG_TXT.

ELSE.

CLEAR DG_TXT.

ENDIF.

CALL METHOD DG_DYNDOC_ID->ADD_TEXT

EXPORTING

TEXT = DG_TXT.

  • Add Logo

CALL METHOD DG_DYNDOC_ID->VERTICAL_SPLIT

EXPORTING

SPLIT_AREA = DG_DYNDOC_ID

SPLIT_WIDTH = '82%'

IMPORTING

RIGHT_AREA = DG_LOGO

EXCEPTIONS

INVALID_SPLIT_AREA = 1

SPLIT_AREA_EQ_RIGHT_AREA = 2

RIGHT_AREA_ALREADY_USED = 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.

CALL METHOD DG_LOGO->ADD_PICTURE

EXPORTING

PICTURE_ID = '/EMN/EASTMAN_LOGO'.

CALL METHOD DG_DYNDOC_ID->MERGE_DOCUMENT.

  • Display Heading document & Logo in container 1

CALL METHOD DG_DYNDOC_ID->DISPLAY_DOCUMENT

EXPORTING

REUSE_CONTROL = C_X

PARENT = DG_CONTAINER_1

EXCEPTIONS

HTML_DISPLAY_ERROR = 1.

IF SY-SUBRC <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

  • Assigning container 2 in splitter container

CALL METHOD DG_SPLITTER->GET_CONTAINER

EXPORTING

ROW = 2

COLUMN = 1

RECEIVING

CONTAINER = DG_CONTAINER_2.

  • Display GRID control in container 2

CREATE OBJECT DG_GRID

EXPORTING

I_PARENT = DG_CONTAINER_2

EXCEPTIONS

ERROR_CNTL_CREATE = 1

ERROR_CNTL_INIT = 2

ERROR_CNTL_LINK = 3

ERROR_DP_CREATE = 4.

IF SY-SUBRC <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

DS_SORT-FIELDNAME = 'BELNR'.

  • ds_sort-group = 'X'.

APPEND DS_SORT TO DT_SORT.

CLEAR DS_SORT.

  • Display the ALV Grid Control in Report

CALL METHOD DG_GRID->SET_TABLE_FOR_FIRST_DISPLAY

EXPORTING

  • I_BUFFER_ACTIVE = C_X

  • I_BYPASSING_BUFFER =

  • I_CONSISTENCY_CHECK =

  • I_STRUCTURE_NAME =

  • IS_VARIANT =

  • I_SAVE = 'A'

  • I_DEFAULT = 'X'

IS_LAYOUT = DS_LAYOUT

  • IS_PRINT =

  • IT_SPECIAL_GROUPS =

  • IT_TOOLBAR_EXCLUDING =

  • IT_HYPERLINK =

  • IT_ALV_GRAPHICS =

  • IT_EXCEPT_QINFO =

CHANGING

IT_OUTTAB = DT_FINAL[]

IT_FIELDCATALOG = DT_FIELDCAT[]

IT_SORT = DT_SORT[]

  • IT_FILTER =

EXCEPTIONS

INVALID_PARAMETER_COMBINATION = 1

PROGRAM_ERROR = 2.

IF SY-SUBRC <> 0.

MESSAGE I000 WITH

'Error in calling SET_TABLE_FOR_FIRST_DISPLAY'.

ENDIF.

  • Call "set_focus" if you want to make sure that 'the cursor'

  • is active in your control

CALL METHOD CL_GUI_CONTROL=>SET_FOCUS

EXPORTING

CONTROL = DG_GRID

EXCEPTIONS

CNTL_ERROR = 1

CNTL_SYSTEM_ERROR = 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.

  • CREATE OBJECT EVENT_RECEIVER.

SET HANDLER EVENT_RECEIVER->HANDLE_ROW_CLICK FOR DG_GRID.

ENDIF.

ENDMODULE. " STATUS_0100 OUTPUT

&----


*& Module USER_COMMAND_0100 INPUT

&----


  • Process After Input

----


MODULE USER_COMMAND_0100 INPUT.

  • Send the methods from presentation server

CALL METHOD CL_GUI_CFW=>DISPATCH.

CASE SY-UCOMM.

WHEN 'BACK' OR 'EXIT' OR 'CANCEL'.

CALL METHOD CL_GUI_CFW=>FLUSH

EXCEPTIONS

CNTL_SYSTEM_ERROR = 1

CNTL_ERROR = 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.

  • Leave to selection screen

LEAVE TO SCREEN 0.

WHEN OTHERS.

  • do nothing

ENDCASE.

CLEAR DG_OK_CODE.

ENDMODULE. " USER_COMMAND_0100 INPUT

or see this program

********************************************************************************************

&----


*& Report ZZ_22038_22098_002 *

*& *

&----


*& This is an Interactive ALV report, where on line slection we can see

*& the secondry list

*&

*& *

&----


REPORT ZZ_22038_22098_002 NO STANDARD PAGE HEADING LINE-SIZE 650

MESSAGE-ID ZZ_9838 .

TYPE-POOLS: SLIS.

*type declaration for values from ekko

TYPES: BEGIN OF I_EKKO,

EBELN LIKE EKKO-EBELN,

AEDAT LIKE EKKO-AEDAT,

BUKRS LIKE EKKO-BUKRS,

BSART LIKE EKKO-BSART,

LIFNR LIKE EKKO-LIFNR,

END OF I_EKKO.

DATA: IT_EKKO TYPE STANDARD TABLE OF I_EKKO INITIAL SIZE 0,

WA_EKKO TYPE I_EKKO.

*type declaration for values from ekpo

TYPES: BEGIN OF I_EKPO,

EBELN LIKE EKPO-EBELN,

EBELP LIKE EKPO-EBELP,

MATNR LIKE EKPO-MATNR,

MENGE LIKE EKPO-MENGE,

MEINS LIKE EKPO-MEINS,

NETPR LIKE EKPO-NETPR,

END OF I_EKPO.

DATA: IT_EKPO TYPE STANDARD TABLE OF I_EKPO INITIAL SIZE 0,

WA_EKPO TYPE I_EKPO .

*variable for Report ID

DATA: V_REPID LIKE SY-REPID .

*declaration for fieldcatalog

DATA: I_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,

WA_FIELDCAT TYPE SLIS_FIELDCAT_ALV.

DATA: IT_LISTHEADER TYPE SLIS_T_LISTHEADER.

  • declaration for events table where user comand or set PF status will

  • be defined

DATA: V_EVENTS TYPE SLIS_T_EVENT,

WA_EVENT TYPE SLIS_ALV_EVENT.

  • declartion for layout

DATA: ALV_LAYOUT TYPE SLIS_LAYOUT_ALV.

  • declaration for variant(type of display we want)

DATA: I_VARIANT TYPE DISVARIANT,

I_VARIANT1 TYPE DISVARIANT,

I_SAVE(1) TYPE C.

*PARAMETERS : p_var TYPE disvariant-variant.

*Title displayed when the alv list is displayed

DATA: I_TITLE_EKKO TYPE LVC_TITLE VALUE 'FIRST LIST DISPLAYED'.

DATA: I_TITLE_EKPO TYPE LVC_TITLE VALUE 'SECONDRY LIST DISPLAYED'.

INITIALIZATION.

V_REPID = SY-REPID.

PERFORM BUILD_FIELDCATLOG.

PERFORM EVENT_CALL.

PERFORM POPULATE_EVENT.

START-OF-SELECTION.

PERFORM DATA_RETRIEVAL.

PERFORM BUILD_LISTHEADER USING IT_LISTHEADER.

PERFORM DISPLAY_ALV_REPORT.

&----


*& Form BUILD_FIELDCATLOG

&----


  • Fieldcatalog has all the field details from ekko

----


FORM BUILD_FIELDCATLOG.

WA_FIELDCAT-TABNAME = 'IT_EKKO'.

WA_FIELDCAT-FIELDNAME = 'EBELN'.

WA_FIELDCAT-SELTEXT_M = 'PO NO.'.

APPEND WA_FIELDCAT TO I_FIELDCAT.

CLEAR WA_FIELDCAT.

WA_FIELDCAT-TABNAME = 'IT_EKKO'.

WA_FIELDCAT-FIELDNAME = 'AEDAT'.

WA_FIELDCAT-SELTEXT_M = 'DATE.'.

APPEND WA_FIELDCAT TO I_FIELDCAT.

CLEAR WA_FIELDCAT.

WA_FIELDCAT-TABNAME = 'IT_EKKO'.

WA_FIELDCAT-FIELDNAME = 'BUKRS'.

WA_FIELDCAT-SELTEXT_M = 'COMPANY CODE'.

APPEND WA_FIELDCAT TO I_FIELDCAT.

CLEAR WA_FIELDCAT.

WA_FIELDCAT-TABNAME = 'IT_EKKO'.

WA_FIELDCAT-FIELDNAME = 'BUKRS'.

WA_FIELDCAT-SELTEXT_M = 'DOCMENT TYPE'.

APPEND WA_FIELDCAT TO I_FIELDCAT.

CLEAR WA_FIELDCAT.

WA_FIELDCAT-TABNAME = 'IT_EKKO'.

WA_FIELDCAT-FIELDNAME = 'LIFNR'.

WA_FIELDCAT-NO_OUT = 'X'.

WA_FIELDCAT-SELTEXT_M = 'VENDOR CODE'.

APPEND WA_FIELDCAT TO I_FIELDCAT.

CLEAR WA_FIELDCAT.

ENDFORM. "BUILD_FIELDCATLOG

&----


*& Form EVENT_CALL

&----


  • we get all events - TOP OF PAGE or USER COMMAND in table v_events

----


FORM EVENT_CALL.

CALL FUNCTION 'REUSE_ALV_EVENTS_GET'

EXPORTING

I_LIST_TYPE = 0

IMPORTING

ET_EVENTS = V_EVENTS

  • EXCEPTIONS

  • LIST_TYPE_WRONG = 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.

ENDFORM. "EVENT_CALL

&----


*& Form POPULATE_EVENT

&----


  • Events populated for TOP OF PAGE & USER COMAND

----


FORM POPULATE_EVENT.

READ TABLE V_EVENTS INTO WA_EVENT WITH KEY NAME = 'TOP_OF_PAGE'.

IF SY-SUBRC EQ 0.

WA_EVENT-FORM = 'TOP_OF_PAGE'.

MODIFY V_EVENTS FROM WA_EVENT TRANSPORTING FORM WHERE NAME =

WA_EVENT-FORM.

ENDIF.

READ TABLE V_EVENTS INTO WA_EVENT WITH KEY NAME = 'USER_COMMAND'.

IF SY-SUBRC EQ 0.

WA_EVENT-FORM = 'USER_COMMAND'.

MODIFY V_EVENTS FROM WA_EVENT TRANSPORTING FORM WHERE NAME =

WA_EVENT-NAME.

ENDIF.

ENDFORM. "POPULATE_EVENT

&----


*& Form data_retrieval

&----


  • retreiving values from the database table ekko

----


FORM DATA_RETRIEVAL.

SELECT EBELN AEDAT BUKRS BSART LIFNR FROM EKKO INTO TABLE IT_EKKO.

ENDFORM. "data_retrieval

&----


*& Form bUild_listheader

&----


  • text

----


  • -->I_LISTHEADEtext

----


FORM BUILD_LISTHEADER USING I_LISTHEADER TYPE SLIS_T_LISTHEADER.

DATA HLINE TYPE SLIS_LISTHEADER.

HLINE-INFO = 'this is my first alv pgm'.

HLINE-TYP = 'H'.

ENDFORM. "build_listheader

&----


*& Form display_alv_report

&----


  • text

----


FORM DISPLAY_ALV_REPORT.

V_REPID = SY-REPID.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

I_CALLBACK_PROGRAM = V_REPID

  • I_CALLBACK_PF_STATUS_SET = ' '

I_CALLBACK_USER_COMMAND = 'USER_COMMAND'

I_CALLBACK_TOP_OF_PAGE = 'TOP_OF_PAGE'

I_GRID_TITLE = I_TITLE_EKKO

  • I_GRID_SETTINGS =

  • IS_LAYOUT = ALV_LAYOUT

IT_FIELDCAT = I_FIELDCAT[]

  • IT_EXCLUDING =

  • IT_SPECIAL_GROUPS =

  • IT_SORT =

  • IT_FILTER =

  • IS_SEL_HIDE =

  • i_default = 'ZLAY1'

I_SAVE = 'A'

  • is_variant = i_variant

IT_EVENTS = V_EVENTS

TABLES

T_OUTTAB = IT_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.

ENDFORM. "display_alv_report

&----


*& Form TOP_OF_PAGE

&----


  • text

----


FORM TOP_OF_PAGE.

CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'

EXPORTING

IT_LIST_COMMENTARY = IT_LISTHEADER

  • i_logo =

  • I_END_OF_LIST_GRID =

.

ENDFORM. "TOP_OF_PAGE

&----


*& Form USER_COMMAND

&----


  • text

----


  • -->R_UCOMM text

  • -->, text

  • -->RS_SLEFIELDtext

----


FORM USER_COMMAND USING R_UCOMM LIKE SY-UCOMM

RS_SELFIELD TYPE SLIS_SELFIELD.

CASE R_UCOMM.

WHEN '&IC1'.

READ TABLE IT_EKKO INTO WA_EKKO INDEX RS_SELFIELD-TABINDEX.

PERFORM BUILD_FIELDCATLOG_EKPO.

PERFORM EVENT_CALL_EKPO.

PERFORM POPULATE_EVENT_EKPO.

PERFORM DATA_RETRIEVAL_EKPO.

PERFORM BUILD_LISTHEADER_EKPO USING IT_LISTHEADER.

PERFORM DISPLAY_ALV_EKPO.

ENDCASE.

ENDFORM. "user_command

&----


*& Form BUILD_FIELDCATLOG_EKPO

&----


  • text

----


FORM BUILD_FIELDCATLOG_EKPO.

WA_FIELDCAT-TABNAME = 'IT_EKPO'.

WA_FIELDCAT-FIELDNAME = 'EBELN'.

WA_FIELDCAT-SELTEXT_M = 'PO NO.'.

APPEND WA_FIELDCAT TO I_FIELDCAT.

CLEAR WA_FIELDCAT.

WA_FIELDCAT-TABNAME = 'IT_EKPO'.

WA_FIELDCAT-FIELDNAME = 'EBELP'.

WA_FIELDCAT-SELTEXT_M = 'LINE NO'.

APPEND WA_FIELDCAT TO I_FIELDCAT.

CLEAR WA_FIELDCAT.

WA_FIELDCAT-TABNAME = 'I_EKPO'.

WA_FIELDCAT-FIELDNAME = 'MATNR'.

WA_FIELDCAT-SELTEXT_M = 'MATERIAL NO.'.

APPEND WA_FIELDCAT TO I_FIELDCAT.

CLEAR WA_FIELDCAT.

WA_FIELDCAT-TABNAME = 'I_EKPO'.

WA_FIELDCAT-FIELDNAME = 'MENGE'.

WA_FIELDCAT-SELTEXT_M = 'QUANTITY'.

APPEND WA_FIELDCAT TO I_FIELDCAT.

CLEAR WA_FIELDCAT.

WA_FIELDCAT-TABNAME = 'I_EKPO'.

WA_FIELDCAT-FIELDNAME = 'MEINS'.

WA_FIELDCAT-SELTEXT_M = 'UOM'.

APPEND WA_FIELDCAT TO I_FIELDCAT.

CLEAR WA_FIELDCAT.

WA_FIELDCAT-TABNAME = 'I_EKPO'.

WA_FIELDCAT-FIELDNAME = 'NETPR'.

WA_FIELDCAT-SELTEXT_M = 'PRICE'.

APPEND WA_FIELDCAT TO I_FIELDCAT.

CLEAR WA_FIELDCAT.

ENDFORM. "BUILD_FIELDCATLOG_EKPO

&----


*& Form event_call_ekpo

&----


  • we get all events - TOP OF PAGE or USER COMMAND in table v_events

----


FORM EVENT_CALL_EKPO.

CALL FUNCTION 'REUSE_ALV_EVENTS_GET'

EXPORTING

I_LIST_TYPE = 0

IMPORTING

ET_EVENTS = V_EVENTS

  • EXCEPTIONS

  • LIST_TYPE_WRONG = 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.

ENDFORM. "event_call_ekpo

&----


*& Form POPULATE_EVENT

&----


  • Events populated for TOP OF PAGE & USER COMAND

----


FORM POPULATE_EVENT_EKPO.

READ TABLE V_EVENTS INTO WA_EVENT WITH KEY NAME = 'TOP_OF_PAGE'.

IF SY-SUBRC EQ 0.

WA_EVENT-FORM = 'TOP_OF_PAGE'.

MODIFY V_EVENTS FROM WA_EVENT TRANSPORTING FORM WHERE NAME =

WA_EVENT-FORM.

ENDIF.

ENDFORM. "POPULATE_EVENT

&----


*& Form TOP_OF_PAGE

&----


  • text

----


FORM F_TOP_OF_PAGE.

CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'

EXPORTING

IT_LIST_COMMENTARY = IT_LISTHEADER

  • i_logo =

  • I_END_OF_LIST_GRID =

.

ENDFORM. "TOP_OF_PAGE

&----


*& Form USER_COMMAND

&----


  • text

----


  • -->R_UCOMM text

  • -->, text

  • -->RS_SLEFIELDtext

----


*retreiving values from the database table ekko

FORM DATA_RETRIEVAL_EKPO.

SELECT EBELN EBELP MATNR MENGE MEINS NETPR FROM EKPO INTO TABLE IT_EKPO.

ENDFORM.

FORM BUILD_LISTHEADER_EKPO USING I_LISTHEADER TYPE SLIS_T_LISTHEADER.

DATA: HLINE1 TYPE SLIS_LISTHEADER.

HLINE1-TYP = 'H'.

HLINE1-INFO = 'CHECKING PGM'.

ENDFORM.

FORM DISPLAY_ALV_EKPO.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

  • I_INTERFACE_CHECK = ' '

  • I_BYPASSING_BUFFER = ' '

  • I_BUFFER_ACTIVE = ' '

I_CALLBACK_PROGRAM = V_REPID

  • I_CALLBACK_PF_STATUS_SET = ' '

  • I_CALLBACK_USER_COMMAND = 'F_USER_COMMAND'

I_CALLBACK_TOP_OF_PAGE = 'TOP_OF_PAGE'

  • I_CALLBACK_HTML_TOP_OF_PAGE = ' '

  • I_CALLBACK_HTML_END_OF_LIST = ' '

  • I_STRUCTURE_NAME =

  • I_BACKGROUND_ID = ' '

I_GRID_TITLE = I_TITLE_EKPO

  • I_GRID_SETTINGS =

  • IS_LAYOUT =

IT_FIELDCAT = I_FIELDCAT[]

  • IT_EXCLUDING =

  • IT_SPECIAL_GROUPS =

  • IT_SORT =

  • IT_FILTER =

  • IS_SEL_HIDE =

  • I_DEFAULT =

I_SAVE = 'A'

  • IS_VARIANT =

IT_EVENTS = V_EVENTS

TABLES

T_OUTTAB = IT_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.

ENDFORM.

********************************************************************************************

Reward points for helpful answers..

Message was edited by:

sunil kumar

Former Member
0 Kudos

Hi,

If you are using OO ALVs then you can handle the event Double click of the class CL_GUI_ALV_GRID.

This event returns the row and column number and the value of teh cell that is double clicked. You can then use "call transaction" after setting the parameter id of VBELN to the chosen value.

Hope this helps.

Thanks,

Rashmi.

Former Member
0 Kudos

U need to trigger the event for this.

sample code below.

&----


*& Form sub_event_call

&----


  • text

----


  • -->P_V_EVENTS_REPL text

----


FORM sub_event_call USING p_v_events.

CALL FUNCTION 'REUSE_ALV_EVENTS_GET'

EXPORTING

i_list_type = 0

IMPORTING

et_events = p_v_events

  • EXCEPTIONS

  • LIST_TYPE_WRONG = 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.

ENDFORM. " sub_event_call

*&----


*& Form POPULATE_EVENT

*&----


  • text

*----


  • --> p1 text

  • <-- p2 text

*----


FORM populate_event.

READ TABLE v_events_final INTO wa_event WITH KEY

name = 'USER_COMMAND_FINAL'.

IF sy-subrc EQ 0.

wa_event-form = 'USER_COMMAND_FINAL'.

MODIFY v_events_final FROM wa_event TRANSPORTING form

WHERE name = wa_event-name.

ENDIF.

ENDFORM. " POPULATE_EVENT

&----


*& Form USER_COMMAND_FINAL

&----


  • text

----


  • -->R_UCOMM text

  • -->, text

  • -->RS_SLEFIELDtext

----


FORM user_command_final USING r_ucomm LIKE sy-ucomm

rs_selfield TYPE slis_selfield.

***User interaction on detail list

**Displays Tx IW53

CLEAR g_rs_selfield.

CASE r_ucomm.

WHEN '&IC1'.

CLEAR wa_repl_final.

READ TABLE itab INTO wa_itab INDEX

rs_selfield-tabindex.

IF sy-subrc = 0.

SET PARAMETER ID 'AUN' FIELD wa_itab-vbeln.

CALL TRANSACTION 'VA03' AND SKIP FIRST SCREEN.

ENDIF.

ENDCASE.

ENDFORM. "user_command_det

Pass the v_events_final table to it_events of REUSE_ALV_GRID_DISPLAY

Former Member
0 Kudos

Hi....

Just see this code...copy and paste it into ur Editor and you will get to understand the method...

you can just replace the fields by your fields and it will work perfectly fine...

<b>Rewrd points if answer was helpful to you.</b>

here is the code...

***********************************************************************************************

&----


*& Report ZZ_22038_22098_002 *

*& *

&----


*& This is an Interactive ALV report, where on line slection we can see

*& the secondry list

*&

*& *

&----


REPORT ZZ_22038_22098_002 NO STANDARD PAGE HEADING LINE-SIZE 650

MESSAGE-ID ZZ_9838 .

TYPE-POOLS: SLIS.

*type declaration for values from ekko

TYPES: BEGIN OF I_EKKO,

EBELN LIKE EKKO-EBELN,

AEDAT LIKE EKKO-AEDAT,

BUKRS LIKE EKKO-BUKRS,

BSART LIKE EKKO-BSART,

LIFNR LIKE EKKO-LIFNR,

END OF I_EKKO.

DATA: IT_EKKO TYPE STANDARD TABLE OF I_EKKO INITIAL SIZE 0,

WA_EKKO TYPE I_EKKO.

*type declaration for values from ekpo

TYPES: BEGIN OF I_EKPO,

EBELN LIKE EKPO-EBELN,

EBELP LIKE EKPO-EBELP,

MATNR LIKE EKPO-MATNR,

MENGE LIKE EKPO-MENGE,

MEINS LIKE EKPO-MEINS,

NETPR LIKE EKPO-NETPR,

END OF I_EKPO.

DATA: IT_EKPO TYPE STANDARD TABLE OF I_EKPO INITIAL SIZE 0,

WA_EKPO TYPE I_EKPO .

*variable for Report ID

DATA: V_REPID LIKE SY-REPID .

*declaration for fieldcatalog

DATA: I_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,

WA_FIELDCAT TYPE SLIS_FIELDCAT_ALV.

DATA: IT_LISTHEADER TYPE SLIS_T_LISTHEADER.

  • declaration for events table where user comand or set PF status will

  • be defined

DATA: V_EVENTS TYPE SLIS_T_EVENT,

WA_EVENT TYPE SLIS_ALV_EVENT.

  • declartion for layout

DATA: ALV_LAYOUT TYPE SLIS_LAYOUT_ALV.

  • declaration for variant(type of display we want)

DATA: I_VARIANT TYPE DISVARIANT,

I_VARIANT1 TYPE DISVARIANT,

I_SAVE(1) TYPE C.

*PARAMETERS : p_var TYPE disvariant-variant.

*Title displayed when the alv list is displayed

DATA: I_TITLE_EKKO TYPE LVC_TITLE VALUE 'FIRST LIST DISPLAYED'.

DATA: I_TITLE_EKPO TYPE LVC_TITLE VALUE 'SECONDRY LIST DISPLAYED'.

INITIALIZATION.

V_REPID = SY-REPID.

PERFORM BUILD_FIELDCATLOG.

PERFORM EVENT_CALL.

PERFORM POPULATE_EVENT.

START-OF-SELECTION.

PERFORM DATA_RETRIEVAL.

PERFORM BUILD_LISTHEADER USING IT_LISTHEADER.

PERFORM DISPLAY_ALV_REPORT.

&----


*& Form BUILD_FIELDCATLOG

&----


  • Fieldcatalog has all the field details from ekko

----


FORM BUILD_FIELDCATLOG.

WA_FIELDCAT-TABNAME = 'IT_EKKO'.

WA_FIELDCAT-FIELDNAME = 'EBELN'.

WA_FIELDCAT-SELTEXT_M = 'PO NO.'.

APPEND WA_FIELDCAT TO I_FIELDCAT.

CLEAR WA_FIELDCAT.

WA_FIELDCAT-TABNAME = 'IT_EKKO'.

WA_FIELDCAT-FIELDNAME = 'AEDAT'.

WA_FIELDCAT-SELTEXT_M = 'DATE.'.

APPEND WA_FIELDCAT TO I_FIELDCAT.

CLEAR WA_FIELDCAT.

WA_FIELDCAT-TABNAME = 'IT_EKKO'.

WA_FIELDCAT-FIELDNAME = 'BUKRS'.

WA_FIELDCAT-SELTEXT_M = 'COMPANY CODE'.

APPEND WA_FIELDCAT TO I_FIELDCAT.

CLEAR WA_FIELDCAT.

WA_FIELDCAT-TABNAME = 'IT_EKKO'.

WA_FIELDCAT-FIELDNAME = 'BUKRS'.

WA_FIELDCAT-SELTEXT_M = 'DOCMENT TYPE'.

APPEND WA_FIELDCAT TO I_FIELDCAT.

CLEAR WA_FIELDCAT.

WA_FIELDCAT-TABNAME = 'IT_EKKO'.

WA_FIELDCAT-FIELDNAME = 'LIFNR'.

WA_FIELDCAT-NO_OUT = 'X'.

WA_FIELDCAT-SELTEXT_M = 'VENDOR CODE'.

APPEND WA_FIELDCAT TO I_FIELDCAT.

CLEAR WA_FIELDCAT.

ENDFORM. "BUILD_FIELDCATLOG

&----


*& Form EVENT_CALL

&----


  • we get all events - TOP OF PAGE or USER COMMAND in table v_events

----


FORM EVENT_CALL.

CALL FUNCTION 'REUSE_ALV_EVENTS_GET'

EXPORTING

I_LIST_TYPE = 0

IMPORTING

ET_EVENTS = V_EVENTS

  • EXCEPTIONS

  • LIST_TYPE_WRONG = 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.

ENDFORM. "EVENT_CALL

&----


*& Form POPULATE_EVENT

&----


  • Events populated for TOP OF PAGE & USER COMAND

----


FORM POPULATE_EVENT.

READ TABLE V_EVENTS INTO WA_EVENT WITH KEY NAME = 'TOP_OF_PAGE'.

IF SY-SUBRC EQ 0.

WA_EVENT-FORM = 'TOP_OF_PAGE'.

MODIFY V_EVENTS FROM WA_EVENT TRANSPORTING FORM WHERE NAME =

WA_EVENT-FORM.

ENDIF.

READ TABLE V_EVENTS INTO WA_EVENT WITH KEY NAME = 'USER_COMMAND'.

IF SY-SUBRC EQ 0.

WA_EVENT-FORM = 'USER_COMMAND'.

MODIFY V_EVENTS FROM WA_EVENT TRANSPORTING FORM WHERE NAME =

WA_EVENT-NAME.

ENDIF.

ENDFORM. "POPULATE_EVENT

&----


*& Form data_retrieval

&----


  • retreiving values from the database table ekko

----


FORM DATA_RETRIEVAL.

SELECT EBELN AEDAT BUKRS BSART LIFNR FROM EKKO INTO TABLE IT_EKKO.

ENDFORM. "data_retrieval

&----


*& Form bUild_listheader

&----


  • text

----


  • -->I_LISTHEADEtext

----


FORM BUILD_LISTHEADER USING I_LISTHEADER TYPE SLIS_T_LISTHEADER.

DATA HLINE TYPE SLIS_LISTHEADER.

HLINE-INFO = 'this is my first alv pgm'.

HLINE-TYP = 'H'.

ENDFORM. "build_listheader

&----


*& Form display_alv_report

&----


  • text

----


FORM DISPLAY_ALV_REPORT.

V_REPID = SY-REPID.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

I_CALLBACK_PROGRAM = V_REPID

  • I_CALLBACK_PF_STATUS_SET = ' '

I_CALLBACK_USER_COMMAND = 'USER_COMMAND'

I_CALLBACK_TOP_OF_PAGE = 'TOP_OF_PAGE'

I_GRID_TITLE = I_TITLE_EKKO

  • I_GRID_SETTINGS =

  • IS_LAYOUT = ALV_LAYOUT

IT_FIELDCAT = I_FIELDCAT[]

  • IT_EXCLUDING =

  • IT_SPECIAL_GROUPS =

  • IT_SORT =

  • IT_FILTER =

  • IS_SEL_HIDE =

  • i_default = 'ZLAY1'

I_SAVE = 'A'

  • is_variant = i_variant

IT_EVENTS = V_EVENTS

TABLES

T_OUTTAB = IT_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.

ENDFORM. "display_alv_report

&----


*& Form TOP_OF_PAGE

&----


  • text

----


FORM TOP_OF_PAGE.

CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'

EXPORTING

IT_LIST_COMMENTARY = IT_LISTHEADER

  • i_logo =

  • I_END_OF_LIST_GRID =

.

ENDFORM. "TOP_OF_PAGE

&----


*& Form USER_COMMAND

&----


  • text

----


  • -->R_UCOMM text

  • -->, text

  • -->RS_SLEFIELDtext

----


FORM USER_COMMAND USING R_UCOMM LIKE SY-UCOMM

RS_SELFIELD TYPE SLIS_SELFIELD.

CASE R_UCOMM.

WHEN '&IC1'.

READ TABLE IT_EKKO INTO WA_EKKO INDEX RS_SELFIELD-TABINDEX.

PERFORM BUILD_FIELDCATLOG_EKPO.

PERFORM EVENT_CALL_EKPO.

PERFORM POPULATE_EVENT_EKPO.

PERFORM DATA_RETRIEVAL_EKPO.

PERFORM BUILD_LISTHEADER_EKPO USING IT_LISTHEADER.

PERFORM DISPLAY_ALV_EKPO.

ENDCASE.

ENDFORM. "user_command

&----


*& Form BUILD_FIELDCATLOG_EKPO

&----


  • text

----


FORM BUILD_FIELDCATLOG_EKPO.

WA_FIELDCAT-TABNAME = 'IT_EKPO'.

WA_FIELDCAT-FIELDNAME = 'EBELN'.

WA_FIELDCAT-SELTEXT_M = 'PO NO.'.

APPEND WA_FIELDCAT TO I_FIELDCAT.

CLEAR WA_FIELDCAT.

WA_FIELDCAT-TABNAME = 'IT_EKPO'.

WA_FIELDCAT-FIELDNAME = 'EBELP'.

WA_FIELDCAT-SELTEXT_M = 'LINE NO'.

APPEND WA_FIELDCAT TO I_FIELDCAT.

CLEAR WA_FIELDCAT.

WA_FIELDCAT-TABNAME = 'I_EKPO'.

WA_FIELDCAT-FIELDNAME = 'MATNR'.

WA_FIELDCAT-SELTEXT_M = 'MATERIAL NO.'.

APPEND WA_FIELDCAT TO I_FIELDCAT.

CLEAR WA_FIELDCAT.

WA_FIELDCAT-TABNAME = 'I_EKPO'.

WA_FIELDCAT-FIELDNAME = 'MENGE'.

WA_FIELDCAT-SELTEXT_M = 'QUANTITY'.

APPEND WA_FIELDCAT TO I_FIELDCAT.

CLEAR WA_FIELDCAT.

WA_FIELDCAT-TABNAME = 'I_EKPO'.

WA_FIELDCAT-FIELDNAME = 'MEINS'.

WA_FIELDCAT-SELTEXT_M = 'UOM'.

APPEND WA_FIELDCAT TO I_FIELDCAT.

CLEAR WA_FIELDCAT.

WA_FIELDCAT-TABNAME = 'I_EKPO'.

WA_FIELDCAT-FIELDNAME = 'NETPR'.

WA_FIELDCAT-SELTEXT_M = 'PRICE'.

APPEND WA_FIELDCAT TO I_FIELDCAT.

CLEAR WA_FIELDCAT.

ENDFORM. "BUILD_FIELDCATLOG_EKPO

&----


*& Form event_call_ekpo

&----


  • we get all events - TOP OF PAGE or USER COMMAND in table v_events

----


FORM EVENT_CALL_EKPO.

CALL FUNCTION 'REUSE_ALV_EVENTS_GET'

EXPORTING

I_LIST_TYPE = 0

IMPORTING

ET_EVENTS = V_EVENTS

  • EXCEPTIONS

  • LIST_TYPE_WRONG = 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.

ENDFORM. "event_call_ekpo

&----


*& Form POPULATE_EVENT

&----


  • Events populated for TOP OF PAGE & USER COMAND

----


FORM POPULATE_EVENT_EKPO.

READ TABLE V_EVENTS INTO WA_EVENT WITH KEY NAME = 'TOP_OF_PAGE'.

IF SY-SUBRC EQ 0.

WA_EVENT-FORM = 'TOP_OF_PAGE'.

MODIFY V_EVENTS FROM WA_EVENT TRANSPORTING FORM WHERE NAME =

WA_EVENT-FORM.

ENDIF.

ENDFORM. "POPULATE_EVENT

&----


*& Form TOP_OF_PAGE

&----


  • text

----


FORM F_TOP_OF_PAGE.

CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'

EXPORTING

IT_LIST_COMMENTARY = IT_LISTHEADER

  • i_logo =

  • I_END_OF_LIST_GRID =

.

ENDFORM. "TOP_OF_PAGE

&----


*& Form USER_COMMAND

&----


  • text

----


  • -->R_UCOMM text

  • -->, text

  • -->RS_SLEFIELDtext

----


*retreiving values from the database table ekko

FORM DATA_RETRIEVAL_EKPO.

SELECT EBELN EBELP MATNR MENGE MEINS NETPR FROM EKPO INTO TABLE IT_EKPO.

ENDFORM.

FORM BUILD_LISTHEADER_EKPO USING I_LISTHEADER TYPE SLIS_T_LISTHEADER.

DATA: HLINE1 TYPE SLIS_LISTHEADER.

HLINE1-TYP = 'H'.

HLINE1-INFO = 'CHECKING PGM'.

ENDFORM.

FORM DISPLAY_ALV_EKPO.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

  • I_INTERFACE_CHECK = ' '

  • I_BYPASSING_BUFFER = ' '

  • I_BUFFER_ACTIVE = ' '

I_CALLBACK_PROGRAM = V_REPID

  • I_CALLBACK_PF_STATUS_SET = ' '

  • I_CALLBACK_USER_COMMAND = 'F_USER_COMMAND'

I_CALLBACK_TOP_OF_PAGE = 'TOP_OF_PAGE'

  • I_CALLBACK_HTML_TOP_OF_PAGE = ' '

  • I_CALLBACK_HTML_END_OF_LIST = ' '

  • I_STRUCTURE_NAME =

  • I_BACKGROUND_ID = ' '

I_GRID_TITLE = I_TITLE_EKPO

  • I_GRID_SETTINGS =

  • IS_LAYOUT =

IT_FIELDCAT = I_FIELDCAT[]

  • IT_EXCLUDING =

  • IT_SPECIAL_GROUPS =

  • IT_SORT =

  • IT_FILTER =

  • IS_SEL_HIDE =

  • I_DEFAULT =

I_SAVE = 'A'

  • IS_VARIANT =

IT_EVENTS = V_EVENTS

TABLES

T_OUTTAB = IT_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.

ENDFORM.

******************************************************************************************

Regards,

Tejas

Former Member
0 Kudos

HI Swati ,

Coule you please tell how is it implemented using FM or abap objects.

Regards

Arun

Former Member
0 Kudos

Hi swati,

I am not sure of this but i think u can call the BDC for VA03 in the user command, in the double click event.