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: 

drill down on alv

Former Member
0 Kudos

Hi,

I am trying to show 'me22n' ( PO details) by drilling down on ebeln in my alv report. but for some reason this is NOT happening. can somebody pls help.

the alv is been shown properly the it does not drill down on po number "ebeln".

Please find the enclosed code.

Thanks & Regards

Hrishi

REPORT Z_VENDOR_BACKORDER_REPORT_ALV line-size 400.

TABLES: EKKO, LFA1, MAKT, EKET, EKPO, AFPO, MARC.

*Data Declaration

*----


DATA: BEGIN OF ITAB OCCURS 0 ,

ebeln LIKE ekko-ebeln , " PO number

aedat LIKE ekko-aedat , " creation date

ebelp LIKE ekpo-ebelp , " item no

lifnr LIKE ekko-lifnr , " vendor number

name1 LIKE lfa1-name1 , " vendor name

RESWK LIKE EKKO-RESWK , " PLANT NO

MEMORY LIKE EKKO-MEMORY , " ORDER INCOMPLETE

matnr LIKE ekpo-matnr , " material number

werks like ekpo-werks , " plant

txz01 LIKE ekpo-txz01 , " material description

eindt LIKE eket-eindt , " Promised date

menge LIKE eket-menge , " quantity

wemng LIKE eket-wemng , " delivered quantity

netpr like ekpo-netpr , " value in AUD

peinh like ekpo-peinh , " price unit

banfn like ekpo-banfn , " PR no

aufnr like ebkn-aufnr , " Production order no

MAABC LIKE MARC-MAABC , " MATERIAL ABC Indicator

maktx like makt-maktx , " material long description

open_quant type p decimals 2, " quantity - delivered

VALUE TYPE p decimals 2, " $ VALUE * OPEN QUANTITY

end of ITAB.

data: wa like itab.

DATA: bdcdata LIKE bdcdata OCCURS 0 WITH HEADER LINE.

DATA: TEMP TYPE EKKO-LIFNR.

data: opt like CTU_PARAMS.

*DATA: WA TYPE FINAL.

  • all ALV declarations

*----


type-pools: slis. "ALV Declarations

DATA: fieldcatalog TYPE slis_t_fieldcat_alv with header line,

G_REPID TYPE SY-REPID,

GS_PRINT TYPE SLIS_PRINT_ALV,

GT_LIST_TOP_OF_PAGE TYPE SLIS_T_LISTHEADER,

GT_EVENTS TYPE SLIS_T_EVENT,

GT_SORT TYPE SLIS_T_SORTINFO_ALV,

GS_LAYOUT TYPE SLIS_LAYOUT_ALV,

COL_POS TYPE I.

*----


  • -----------------SELECTION SCREEN----------------------

selection-screen begin of block b1 with frame title text-001.

select-options VENDORNO for ekko-lifnr.

select-options MATERIAL for ekpo-matnr.

SELECT-OPTIONS PLANT FOR EKKO-RESWK.

select-options REQDAT for eket-eindt.

selection-screen end of block b1.

*----


*................... GET DATA..................

SELECT EKKO~EBELN

EKKO~AEDAT

EKKO~LIFNR

  • EKKO~MEMORY

  • EKKO~RESWK

EKPO~EBELP

EKPO~MATNR

ekpo~werks

ekpo~netpr

ekpo~peinh

ekpo~banfn

ekpo~txz01

  • makt~maktx

EKET~EINDT

EKET~MENGE

EKET~WEMNG

LFA1~NAME1

INTO corresponding fields of ITAB

FROM (

EKKO inner JOIN EKPO

ON EKKOEBELN = EKPOEBELN

inner JOIN EKET

ON EKPOEBELN = EKETEBELN

AND EKPOEBELP = EKETEBELP

inner JOIN LFA1

ON EKKOLIFNR = LFA1LIFNR

*left outer join makt

*on ekpomatnr = maktmatnr

)

WHERE EKKO~LIFNR IN VENDORNO

AND EKKO~RESWK IN PLANT

and EKPO~MATNR IN MATERIAL

and ekpo~elikz eq ' '

and ekpo~loekz ne 'L'

and eket~eindt in REQDAT.

append itab.

CLEAR ITAB.

endselect.

*----


clear temp.

sort itab by lifnr.

loop at itab .

ITAB-OPEN_QUANT = ITAB-MENGE - ITAB-WEMNG.

if itab-matnr eq ''.

select single aufnr from ebkn into itab-aufnr where banfn = itab-banfn.

select single matnr from afpo into itab-matnr where aufnr = itab-aufnr.

endif.

select single maktx from makt into itab-maktx where matnr = itab-matnr.

select single maabc from MARC INTO ITAB-MAABC WHERE MATNR = ITAB-MATNR.

ITAB-VALUE = ITAB-NETPR * ITAB-OPEN_QUANT / itab-peinh.

modify itab.

endloop.

SKIP.

*----


*

fieldcatalog-fieldname = 'LIFNR'.

fieldcatalog-seltext_m = 'vendor no'.

fieldcatalog-col_pos = 1.

fieldcatalog-outputlen = 15.

  • fieldcatalog-emphasize = 'X'.

  • fieldcatalog-key = 'X'.

  • fieldcatalog-do_sum = 'X'.

  • fieldcatalog-no_zero = 'X'.

append fieldcatalog to fieldcatalog.

clear fieldcatalog.

fieldcatalog-fieldname = 'EBELN'.

fieldcatalog-seltext_m = 'po Number'.

fieldcatalog-col_pos = 2.

append fieldcatalog to fieldcatalog.

clear fieldcatalog.

fieldcatalog-fieldname = 'AEDAT'.

fieldcatalog-seltext_m = 'po date'.

fieldcatalog-col_pos = 3.

append fieldcatalog to fieldcatalog.

clear fieldcatalog.

fieldcatalog-fieldname = 'EBELP'.

fieldcatalog-seltext_m = 'item number'.

fieldcatalog-col_pos = 4.

append fieldcatalog to fieldcatalog.

clear fieldcatalog.

fieldcatalog-fieldname = 'MATNR'.

fieldcatalog-seltext_m = 'material number'.

fieldcatalog-col_pos = 5.

append fieldcatalog to fieldcatalog.

clear fieldcatalog.

fieldcatalog-fieldname = 'MAABC'.

fieldcatalog-seltext_m = 'material type'.

fieldcatalog-col_pos = 6.

append fieldcatalog to fieldcatalog.

clear fieldcatalog.

fieldcatalog-fieldname = 'TXZ01'.

fieldcatalog-seltext_m = 'short text'.

fieldcatalog-col_pos = 7.

append fieldcatalog to fieldcatalog.

clear fieldcatalog.

fieldcatalog-fieldname = 'MAKTX'.

fieldcatalog-seltext_m = 'long text'.

fieldcatalog-col_pos = 8.

fieldcatalog-outputlen = 15.

append fieldcatalog to fieldcatalog.

clear fieldcatalog.

fieldcatalog-fieldname = 'EINDT'.

fieldcatalog-seltext_m = 'date promised'.

fieldcatalog-col_pos = 9.

append fieldcatalog to fieldcatalog.

clear fieldcatalog.

fieldcatalog-fieldname = 'MENGE'.

fieldcatalog-seltext_m = 'Quantity'.

fieldcatalog-col_pos = 10.

fieldcatalog-outputlen = 15.

append fieldcatalog to fieldcatalog.

clear fieldcatalog.

fieldcatalog-fieldname = 'WEMNG'.

fieldcatalog-seltext_m = 'Delivered'.

fieldcatalog-col_pos = 11.

append fieldcatalog to fieldcatalog.

clear fieldcatalog.

fieldcatalog-fieldname = 'OPEN_QUANT'.

fieldcatalog-seltext_m = 'Open quantity'.

fieldcatalog-col_pos = 12.

append fieldcatalog to fieldcatalog.

clear fieldcatalog.

fieldcatalog-fieldname = 'VALUE'.

fieldcatalog-seltext_m = '$ value'.

fieldcatalog-col_pos = 13.

fieldcatalog-do_sum = 'X'.

append fieldcatalog to fieldcatalog.

clear fieldcatalog.

*----


call function 'REUSE_ALV_GRID_DISPLAY'

exporting

i_callback_program = g_repid

  • i_callback_top_of_page = 'TOP-OF-PAGE' "see FORM

I_CALLBACK_USER_COMMAND = 'USER_COMMAND'

it_fieldcat = fieldcatalog[]

is_layout = GS_layout

  • is_variant = z_template

tables

t_outtab = itab

exceptions

program_error = 1

others = 2.

*----


FORM USE_COMMAND USING r_ucomm LIKE sy-ucomm

rs_selfield TYPE slis_selfield.

CASE r_ucomm.

WHEN '&IC1'.

CASE rs_selfield-sel_tab_field.

WHEN 'ITAB-LIFNR'.

WHEN 'ITAB-EBELN'.

CHECK NOT rs_selfield-value IS INITIAL.

SET PARAMETER ID 'BUS' FIELD rs_selfield-value.

CALL TRANSACTION 'ME22N' AND SKIP FIRST SCREEN.

ENDCASE.

ENDCASE.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi

It seems you are not reading the Int table with that field

see this sample

WHEN '&IC1'. " Double click line

IF rs_selfield-fieldname = 'EBELN'.

READ TABLE t_disp_tab INTO wa_item_tab INDEX

rs_selfield-tabindex.

  • Set parameter ID for transaction screen field

SET PARAMETER ID 'BUS' FIELD wa_item_tab-ebeln.

CALL TRANSACTION 'ME22N' AND SKIP FIRST SCREEN.

ENDIF.

Reward points for useful Answers

Regards

Anji

6 REPLIES 6

Former Member
0 Kudos

Hi

It seems you are not reading the Int table with that field

see this sample

WHEN '&IC1'. " Double click line

IF rs_selfield-fieldname = 'EBELN'.

READ TABLE t_disp_tab INTO wa_item_tab INDEX

rs_selfield-tabindex.

  • Set parameter ID for transaction screen field

SET PARAMETER ID 'BUS' FIELD wa_item_tab-ebeln.

CALL TRANSACTION 'ME22N' AND SKIP FIRST SCREEN.

ENDIF.

Reward points for useful Answers

Regards

Anji

0 Kudos

Naaah Anji, that doesnt help. I did try this code.

Still not working !

Pls help.

Hrishi

FORM USE_COMMAND USING r_ucomm LIKE sy-ucomm

rs_selfield TYPE slis_selfield.

CASE r_ucomm.

WHEN '&IC1'.

IF rs_selfield-fieldname = 'EBELN'.

READ TABLE itab INTO wa INDEX

rs_selfield-tabindex.

  • Set parameter ID for transaction screen field

SET PARAMETER ID 'BUS' FIELD wa-ebeln.

CALL TRANSACTION 'ME22N' AND SKIP FIRST SCREEN.

ENDIF.

endcase.

endform.

Former Member
0 Kudos

Hi,

Plz refer the standard program DEMO_DYNPRO_DROPDOWN_LISTBOX

for any issue on drill down.

regards,

Ruchika

Reward if useful.

Former Member
0 Kudos

hi Hrishi

just check whether u are selecting right options on the selection screen. i mean does the data exist for tha corresponding values.

Because i have executed ur program ur inetrnal table itab is not being filled.

regards

ravish

<b>plz reward if helpful</b>

0 Kudos

hi ravish,

Thanks for the reply. Which internal table you are talking about. Cuz as I said, the basic ALV is been displayed properly. just the drill down is not working !

I dont understand why.

Hrishi

0 Kudos

Problem solved. changed the code as follows and it did work

Regards

Hrishi

form display_alv_report.

g_repid = sy-repid.

call function 'REUSE_ALV_GRID_DISPLAY'

exporting

i_callback_program = g_repid

  • i_callback_top_of_page = 'TOP-OF-PAGE' "see FORM

i_callback_user_command = 'USER_COMMAND'

  • i_grid_title = outtext

is_layout = gs_layout

it_fieldcat = fieldcatalog[]

  • it_special_groups = gd_tabgroup

it_events = gt_events

  • is_print = gd_prntparams

i_save = 'X'

  • is_variant = z_template

tables

t_outtab = itAB

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 user_command USING r_ucomm LIKE sy-ucomm

rs_selfield TYPE slis_selfield.

  • Check function code

CASE r_ucomm.

WHEN '&IC1'.

  • Check field clicked on within ALVgrid report

IF rs_selfield-fieldname = 'EBELN'.

  • Read data table, using index of row user clicked on

READ TABLE ITAB INTO wa_ekko INDEX rs_selfield-tabindex.

  • Set parameter ID for transaction screen field

SET PARAMETER ID 'BES' FIELD wa_ekko-ebeln.

  • Sxecute transaction ME23N, and skip initial data entry screen

CALL TRANSACTION 'ME23N' AND SKIP FIRST SCREEN.

ENDIF.

IF rs_selfield-fieldname = 'MATNR'.

READ TABLE ITAB INTO wa_ekko INDEX rs_selfield-tabindex.

SET PARAMETER ID 'MAT' FIELD wa_ekko-matnr.

CALL TRANSACTION 'MD04' AND SKIP FIRST SCREEN.

ENDIF.

ENDCASE.

ENDFORM.