Skip to Content
0
Former Member
Jun 08, 2007 at 05:35 AM

drill down on alv

64 Views

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.