‎2007 May 31 10:50 AM
Hi all,
I am getting output a list of PO's here it is displayed in ALV grid display.Now when i double click on any PO number in the o/p list i want to call another report which will take input as PO number and get the o/p...
Is this possible..pls help
‎2007 May 31 10:55 AM
hi srikanth,
u just pass user command parameter into alv grid function module'
just try this code.
&----
*& Report ZMM_OPEN_PURCH_ORDER_R
*&
&----
*&
*&
&----
report zmm_open_purch_order_r no standard page heading message-id zsmep.
*define tables...
tables: lfa1,
ekko,
ekpo,
marc,
mbew,
eket,
bseg.
*define types...
types: begin of t_tab_ekko, "struc or ekko dbt...
ebeln type ebeln,
ekgrp type bkgrp,
lifnr type elifn,
aedat type erdat,
bsart type esart,
waers type waers,
zterm type dzterm.
types: end of t_tab_ekko.
types: begin of t_tab_ekpo, "struc or ekpo dbt...
ebeln type ebeln,
ebelp type ebelp,
matnr type matnr,
txz01 type txz01,
werks type ewerk,
lgort type lgort_d,
matkl type matkl,
menge type bstmg,
meins type bstme,
netpr type bprei,
mwskz type mwskz,
peinh type epein.
types: end of t_tab_ekpo.
types: begin of t_tab_lfa1, "struc or lfa1 dbt...
lifnr type lifnr,
name1 type name1_gp,
brsch type brsch.
types: end of t_tab_lfa1.
types: begin of t_tab_t024, "struc or t024 dbt...
ekgrp type ekgrp,
eknam type eknam.
types: end of t_tab_t024.
types: begin of t_tab_mbew, "struc or mbew dbt...
matnr type matnr,
bwkey type bwkey,
vjbwh type vjbwh,
stprs type stprs,
verpr type verpr,
peinh type peinh.
types: end of t_tab_mbew.
types: begin of t_tab_marc, "struc or marc dbt...
matnr type matnr,
werks type werks_d,
ekgrp type ekgrp,
prctr type prctr,
insmk type insmk_mat,
dispo type dispo,
plifz type plifz,
webaz type webaz,
wzeit type wzeit.
types: end of t_tab_marc.
types: begin of t_tab_t024d, "struc or t024d dbt...
dispo type dispo,
dsnam type dsnam.
types: end of t_tab_t024d.
types: begin of t_tab_eket, "struc or t024d dbt...
ebeln type ebeln,
ebelp type ebelp,
etenr type eeten,
eindt type eindt,
menge type etmen,
wemng type weemg.
types: end of t_tab_eket.
types: begin of t_tab_t016t, "struc or t016t dbt...
brsch type brsch,
brtxt type text1_016t.
types: end of t_tab_t016t.
types: begin of t_tab_t023t, "struc or t023t dbt...
matkl type matkl,
wgbez type wgbez.
types: end of t_tab_t023t.
types: begin of t_tab_globe,
ebeln type ebeln,
ekgrp type bkgrp,
lifnr type elifn,
aedat type erdat,
bsart type esart,
waers type waers,
zterm type dzterm,
ebelp type ebelp,
matnr type matnr,
txz01 type txz01,
werks type ewerk,
lgort type lgort_d,
eknam type eknam,
matkl type matkl,
menge type bstmg,
meins type bstme,
netpr type bprei,
mwskz type mwskz,
peinh type epein,
name1 type name1_gp,
brsch type brsch,
dsnam type dsnam,
vjbwh type vjbwh,
stprs type stprs,
verpr type verpr,
pei_h type peinh,
prctr type prctr,
insmk type insmk_mat,
dispo type dispo,
plifz type plifz,
webaz type webaz,
wzeit type wzeit,
etenr type eeten,
eindt type eindt,
men_e type etmen,
wemng type weemg,
ope_q type weemg,
brtxt type text1_016t,
wgbez type wgbez,
targe type vjbwh,
pri_d type vjbwh,
%_tar type vjbwh.
types: end of t_tab_globe.
type-pools: slis.
*data object declaration...
data: g_tab_ekko type table of t_tab_ekko,
g_wa_ekko type t_tab_ekko.
data: g_tab_ekpo type table of t_tab_ekpo,
g_wa_ekpo type t_tab_ekpo.
data: g_tab_lfa1 type table of t_tab_lfa1,
g_wa_lfa1 type t_tab_lfa1.
data: g_tab_t024d type table of t_tab_t024d,
g_wa_t024d type t_tab_t024d.
data: g_tab_mbew type table of t_tab_mbew,
g_wa_mbew type t_tab_mbew.
data: g_tab_marc type table of t_tab_marc,
g_wa_marc type t_tab_marc.
data: g_tab_t024 type table of t_tab_t024,
g_wa_t024 type t_tab_t024.
data: g_tab_eket type table of t_tab_eket,
g_wa_eket type t_tab_eket.
data: g_tab_t016t type table of t_tab_t016t,
g_wa_t016t type t_tab_t016t.
data: g_tab_t023t type table of t_tab_t023t,
g_wa_t023t type t_tab_t023t.
data: g_tab_globe type table of t_tab_globe,
g_wa_globe type t_tab_globe.
data: l_tab_jit type table of zmm_epsp_jitpo_v,
l_wa_jit like line of l_tab_jit.
data: l_pos type i,
l_tab_fieldcat type slis_t_fieldcat_alv,
report type sy-repid.
*selection screen design...
selection-screen: begin of block b1 with frame ,
begin of block b2 with frame title text-001.
select-options: s_porg for ekko-ekorg,
s_pgrp for ekko-ekgrp,
s_docu for ekko-ebeln,
s_dtyp for ekko-bsart no intervals,
s_cdat for ekko-aedat,
s_vend for lfa1-lifnr.
selection-screen: end of block b2,
begin of block b3 with frame title text-002.
select-options: s_mate for marc-matnr,
s_plan for marc-werks,
s_item for ekpo-ebelp,
s_aaca for ekpo-knttp,
s_deda for eket-eindt.
selection-screen: end of block b3.
BEGIN OF BLOCK b4 WITH FRAME TITLE text-003.
*PARAMETERS: p_jitc AS CHECKBOX.
*SELECT-OPTIONS: s_targ FOR bseg-dmbtr.
*PARAMETERS: p_layo LIKE disvariant-variant.
*SELECTION-SCREEN: END OF BLOCK b4,
selection-screen: end of block b1.
*initiliazation event
initialization.
*for document type...
s_dtyp-low = 'NB'.
s_dtyp-high = ''.
s_dtyp-sign = 'I'.
s_dtyp-option = 'BT'.
append s_dtyp.
*for plant...
s_plan-low = 'WRK'.
s_plan-high = ''.
s_plan-sign = 'I'.
s_plan-option = 'BT'.
append s_plan.
*for purchasing org...
s_porg-low = 'EKO'.
s_porg-high = ''.
s_porg-sign = 'I'.
s_porg-option = 'BT'.
append s_porg.
*at selection screen event...
at selection-screen on s_dtyp.
loop at s_dtyp where low = 'NB' or low = 'LPA'.
continue.
endloop.
if sy-subrc ne 0.
message e027(zsmep).
endif.
*fetch the data from database...
start-of-selection.
perform fetch_data.
end-of-selection.
*move data to global itab...
perform move_globe.
*display the output in alv grid...
perform alv_grid.
&----
*& Form fetch_data
&----
text
----
form fetch_data.
select ebeln
ekgrp
lifnr
aedat
bsart
waers
zterm
from ekko
into table g_tab_ekko
where
ekorg in s_porg
and
ekgrp in s_pgrp
and
ebeln in s_docu
and
bsart in s_dtyp
and
aedat in s_cdat
and
lifnr in s_vend.
if not g_tab_ekko[] is initial.
select ebeln
ebelp
matnr
txz01
werks
lgort
matkl
menge
meins
netpr
mwskz
peinh
from ekpo
into table g_tab_ekpo
for all entries in g_tab_ekko
where
ebeln eq g_tab_ekko-ebeln
and
ebelp in s_item
and
knttp in s_aaca
and
matnr in s_mate
and
werks in s_plan.
select lifnr
name1
brsch
from lfa1
into table g_tab_lfa1
for all entries in g_tab_ekko
where
lifnr eq g_tab_ekko-lifnr.
select ekgrp
eknam
from t024
into table g_tab_t024
for all entries in g_tab_ekko
where
ekgrp eq g_tab_ekko-ekgrp.
endif.
if not g_tab_ekpo[] is initial.
select matnr
bwkey
vjbwh
stprs
verpr
peinh
from mbew
into table g_tab_mbew
for all entries in g_tab_ekpo
where
matnr eq g_tab_ekpo-matnr
and
bwkey eq g_tab_ekpo-werks.
select matnr
werks
ekgrp
prctr
insmk
dispo
plifz
webaz
wzeit
from marc
into table g_tab_marc
for all entries in g_tab_ekpo
where
matnr eq g_tab_ekpo-matnr
and
werks eq g_tab_ekpo-werks.
select ebeln
ebelp
etenr
eindt
menge
wemng
from eket
into table g_tab_eket
for all entries in g_tab_ekpo
where
ebeln eq g_tab_ekpo-ebeln
and
ebelp eq g_tab_ekpo-ebelp
and
eindt in s_deda.
select matkl
wgbez
from t023t
into table g_tab_t023t
for all entries in g_tab_ekpo
where
matkl eq g_tab_ekpo-matkl
and
spras eq 'EN'.
select * from zmm_epsp_jitpo_v into corresponding fields of table l_tab_jit
for all entries in g_tab_ekpo
where ebeln = g_tab_ekpo-ebeln and
ebelp = g_tab_ekpo-ebelp and
matnr = g_tab_ekpo-matnr.
endif.
if not g_tab_lfa1[] is initial.
select brsch
brtxt
from t016t
into table g_tab_t016t
for all entries in g_tab_lfa1
where
brsch eq g_tab_lfa1-brsch
and
spras eq 'EN'.
endif.
IF NOT g_tab_marc[] IS INITIAL.
SELECT werks
ekgrp
dsnam
FROM t024d
INTO TABLE g_tab_t024d
FOR ALL ENTRIES IN g_tab_marc
WHERE
werks EQ g_tab_marc-werks
AND
ekgrp EQ g_tab_marc-ekgrp.
*
ENDIF.
endform. "fetch_data
&----
*& Form move_globe
&----
text
----
--> p1 text
<-- p2 text
----
form move_globe .
data: l_openq type weemg.
loop at g_tab_ekko into g_wa_ekko.
read table g_tab_ekpo into g_wa_ekpo with key ebeln = g_wa_ekko-ebeln.
if sy-subrc eq 0.
if g_wa_ekpo-matnr ne ''.
move-corresponding: g_wa_ekpo to g_wa_globe,
g_wa_ekko to g_wa_globe.
endif.
endif.
if g_wa_ekpo-matnr ne ''.
read table g_tab_mbew into g_wa_mbew with key matnr = g_wa_globe-matnr
bwkey = g_wa_globe-werks.
if sy-subrc eq 0.
if g_wa_mbew-vjbwh > 0.
move g_wa_mbew-vjbwh to g_wa_globe-targe.
elseif g_wa_mbew-stprs > 0.
move g_wa_mbew-stprs to g_wa_globe-targe.
elseif g_wa_mbew-verpr > 0.
move g_wa_mbew-verpr to g_wa_globe-targe.
endif.
g_wa_globe-pri_d = g_wa_mbew-verpr - g_wa_globe-targe.
g_wa_globe-%_tar = ( ( g_wa_mbew-verpr / g_wa_globe-targe ) / g_wa_globe-targe ) * 100.
move g_wa_mbew-peinh to g_wa_globe-pei_h.
endif.
endif.
if g_wa_ekpo-matnr ne ''.
read table g_tab_marc into g_wa_marc with key matnr = g_wa_ekpo-matnr
werks = g_wa_ekpo-werks
ekgrp = g_wa_ekko-ekgrp.
if sy-subrc eq 0.
move-corresponding g_wa_marc to g_wa_globe.
endif.
endif.
if g_wa_ekpo-matnr ne ''.
read table g_tab_eket into g_wa_eket with key ebeln = g_wa_ekpo-ebeln
ebelp = g_wa_ekpo-ebelp.
if sy-subrc eq 0.
l_openq = g_wa_eket-menge - g_wa_eket-wemng.
if l_openq lt 0.
l_openq = 0.
move l_openq to g_wa_globe-ope_q.
else.
move l_openq to g_wa_globe-ope_q.
endif.
move g_wa_eket-menge to g_wa_globe-men_e.
move-corresponding g_wa_eket to g_wa_globe.
endif.
endif.
if g_wa_ekpo-matnr ne ''.
read table g_tab_t024 into g_wa_t024 with key ekgrp = g_wa_ekko-ekgrp.
if sy-subrc eq 0.
move g_wa_t024-eknam to g_wa_globe-eknam.
endif.
endif.
if g_wa_ekpo-matnr ne ''.
read table g_tab_lfa1 into g_wa_lfa1 with key lifnr = g_wa_ekko-lifnr.
if sy-subrc eq 0.
move: g_wa_lfa1-name1 to g_wa_globe-name1,
g_wa_lfa1-brsch to g_wa_globe-brsch.
endif.
endif.
if g_wa_ekpo-matnr ne ''.
read table g_tab_t016t into g_wa_t016t with key brsch = g_wa_lfa1-brsch.
if sy-subrc eq 0.
move g_wa_t016t-brtxt to g_wa_globe-brtxt.
endif.
endif.
if g_wa_ekpo-matnr ne ''.
read table g_tab_t023t into g_wa_t023t with key matkl = g_wa_ekpo-matkl.
if sy-subrc eq 0.
move g_wa_t023t-wgbez to g_wa_globe-wgbez.
endif.
endif.
append g_wa_globe to g_tab_globe.
clear: g_wa_ekko,
g_wa_ekpo,
g_wa_mbew,
g_wa_marc,
g_wa_eket,
g_wa_t024,
g_wa_t024d,
g_wa_lfa1,
g_wa_globe.
endloop.
sort g_tab_globe by ebeln matnr.
delete g_tab_globe where ebeln eq '' and matnr eq ''.
endform. " move_globe
&----
*& Form alv_grid
&----
text
----
--> p1 text
<-- p2 text
----
form alv_grid .
perform call_fieldcat.
perform call_alv_grid.
endform. " alv_grid
&----
*& Form call_fieldcat
&----
text
----
--> p1 text
<-- p2 text
----
form call_fieldcat .
perform build_fieldcat using l_pos 'G_TAB_GLOBE' 'EBELN' '10' text-010.
perform build_fieldcat using l_pos 'G_TAB_GLOBE' 'EBELP' '10' text-017.
perform build_fieldcat using l_pos 'G_TAB_GLOBE' 'BSART' '10' text-011.
perform build_fieldcat using l_pos 'G_TAB_GLOBE' 'AEDAT' '10' text-012.
perform build_fieldcat using l_pos 'G_TAB_GLOBE' 'LIFNR' '10' text-013.
perform build_fieldcat using l_pos 'G_TAB_GLOBE' 'NAME1' '32' text-014.
perform build_fieldcat using l_pos 'G_TAB_GLOBE' 'EKGRP' '10' text-015.
perform build_fieldcat using l_pos 'G_TAB_GLOBE' 'EKNAM' '32' text-016.
perform build_fieldcat using l_pos 'G_TAB_GLOBE' 'MATNR' '18' text-018.
perform build_fieldcat using l_pos 'G_TAB_GLOBE' 'TXZ01' '33' text-019.
perform build_fieldcat using l_pos 'G_TAB_GLOBE' 'WERKS' '05' text-020.
perform build_fieldcat using l_pos 'G_TAB_GLOBE' 'LGORT' '10' text-021.
perform build_fieldcat using l_pos 'G_TAB_GLOBE' 'MATKL' '10' text-022.
perform build_fieldcat using l_pos 'G_TAB_GLOBE' 'MENGE' '10' text-023.
perform build_fieldcat using l_pos 'G_TAB_GLOBE' 'MEINS' '10' text-024.
perform build_fieldcat using l_pos 'G_TAB_GLOBE' 'NETPR' '10' text-025.
perform build_fieldcat using l_pos 'G_TAB_GLOBE' 'WAERS' '10' text-026.
perform build_fieldcat using l_pos 'G_TAB_GLOBE' 'PEINH' '10' text-027.
perform build_fieldcat using l_pos 'G_TAB_GLOBE' 'TARGE' '10' text-042.
perform build_fieldcat using l_pos 'G_TAB_GLOBE' 'STPRS' '10' text-028.
perform build_fieldcat using l_pos 'G_TAB_GLOBE' 'PRI_D' '10' text-029.
perform build_fieldcat using l_pos 'G_TAB_GLOBE' '%_TAR' '10' text-030.
perform build_fieldcat using l_pos 'G_TAB_GLOBE' 'PEINH' '10' text-031.
perform build_fieldcat using l_pos 'G_TAB_GLOBE' 'PRCTR' '10' text-032.
perform build_fieldcat using l_pos 'G_TAB_GLOBE' 'INSMK' '10' text-033.
perform build_fieldcat using l_pos 'G_TAB_GLOBE' 'DISPO' '10' text-034.
perform build_fieldcat using l_pos 'G_TAB_GLOBE' 'PLIFZ' '10' text-035.
perform build_fieldcat using l_pos 'G_TAB_GLOBE' 'WEBAZ' '10' text-036.
perform build_fieldcat using l_pos 'G_TAB_GLOBE' 'WZEIT' '10' text-043.
perform build_fieldcat using l_pos 'G_TAB_GLOBE' 'ETENR' '10' text-037.
perform build_fieldcat using l_pos 'G_TAB_GLOBE' 'EINDT' '10' text-038.
perform build_fieldcat using l_pos 'G_TAB_GLOBE' 'MEN_E' '10' text-039.
perform build_fieldcat using l_pos 'G_TAB_GLOBE' 'WEMNG' '10' text-040.
perform build_fieldcat using l_pos 'G_TAB_GLOBE' 'OPE_Q' '10' text-041.
perform build_fieldcat using l_pos 'G_TAB_GLOBE' 'BRSCH' '10' text-047.
perform build_fieldcat using l_pos 'G_TAB_GLOBE' 'BRTXT' '30' text-048.
perform build_fieldcat using l_pos 'G_TAB_GLOBE' 'WGBEZ' '30' text-049.
perform build_fieldcat using l_pos 'G_TAB_GLOBE' 'ZTERM' '10' text-045.
perform build_fieldcat using l_pos 'G_TAB_GLOBE' 'MWSKZ' '10' text-046.
endform. " call_fieldcat
&----
*& Form build_fieldcat
&----
text
----
-->P_L_POS text
-->P_1269 text
-->P_1270 text
-->P_1271 text
-->P_TEXT_010 text
----
form build_fieldcat using u_pos type any
value(u_1269) type any
value(u_1270) type any
value(u_1271) type any
u_text type any.
data: l_wa_fieldcat type slis_fieldcat_alv.
add 1 to u_pos.
if u_1270 = 'EBELN' or u_1270 = 'LIFNR' or u_1270 = 'MATNR' .
l_wa_fieldcat-key = 'X'.
else.
clear: l_wa_fieldcat-key.
endif.
l_wa_fieldcat-col_pos = u_pos.
l_wa_fieldcat-tabname = u_1269.
l_wa_fieldcat-fieldname = u_1270.
l_wa_fieldcat-outputlen = u_1271.
l_wa_fieldcat-seltext_m = u_text.
append l_wa_fieldcat to l_tab_fieldcat.
endform. " build_fieldcat
&----
*& Form set_pf_status
&----
text
----
-->RT_EXTAB text
----
form set_pf_status using rt_extab type slis_t_extab.
set pf-status 'ZSTANDARD'.
"Copy of 'STANDARD' pf_status from fgroup SALV
endform. "set_pf_status
&----
*& Form call_alv_grid
&----
text
----
--> p1 text
<-- p2 text
----
form call_alv_grid .
if g_tab_globe[] is initial.
message i024(zsmep).
else.
report = sy-repid.
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER = ' '
I_BUFFER_ACTIVE = ' '
i_callback_program = report
i_callback_pf_status_set = 'SET_PF_STATUS'
i_callback_user_command = 'USER_COMMAND'(004)
I_CALLBACK_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_GRID_SETTINGS =
IS_LAYOUT =
it_fieldcat = l_tab_fieldcat
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT =
IT_EVENTS =
IT_EVENT_EXIT =
IS_PRINT =
IS_REPREP_ID =
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
I_HTML_HEIGHT_TOP = 0
I_HTML_HEIGHT_END = 0
IT_ALV_GRAPHICS =
IT_HYPERLINK =
IT_ADD_FIELDCAT =
IT_EXCEPT_QINFO =
IR_SALV_FULLSCREEN_ADAPTER =
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
tables
t_outtab = g_tab_globe.
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.
endif.
endform. " call_alv_grid
&----
*& Form user_command
&----
text
----
-->R_UCOMM text
-->RS_SELFIELD text
----
form user_command using r_ucomm like sy-ucomm
rs_selfield type slis_selfield.
data: lv_evrtn type evrtn.
clear :lv_evrtn.
read table g_tab_globe into g_wa_globe index rs_selfield-tabindex.
case r_ucomm.
WHEN '&IC1'.
when 'MD04'.
if g_wa_globe is initial.
message i000(zf_mes) with text-048.
exit.
endif.
if g_wa_globe-matnr is not initial and g_wa_globe-werks is not initial.
set parameter id 'MAT' field g_wa_globe-matnr.
set parameter id 'WRK' field g_wa_globe-werks.
call transaction 'MD04' and skip first screen .
else.
message i000(zf_mes) with text-045.
exit.
endif.
when 'EDIT'.
if g_wa_globe is initial.
message i000(zf_mes) with text-048.
exit.
endif.
if g_wa_globe-bsart = 'NB'.
set parameter id 'BES' field g_wa_globe-ebeln.
call transaction 'ME22N' and skip first screen.
elseif g_wa_globe-bsart = 'LP' or g_wa_globe-bsart = 'LPA'.
lv_evrtn = g_wa_globe-ebeln.
set parameter id 'SAG' field g_wa_globe-ebeln.
call transaction 'ME32L' and skip first screen .
endif.
when 'DISPLAY' or '&IC1'.
if g_wa_globe is initial.
message i000(zf_mes) with text-048.
exit.
endif.
if g_wa_globe-bsart = 'NB'.
set parameter id 'BES' field g_wa_globe-ebeln.
call transaction 'ME23N' and skip first screen .
elseif g_wa_globe-bsart = 'LP' or g_wa_globe-bsart = 'LPA'.
lv_evrtn = g_wa_globe-ebeln.
set parameter id 'SAG' field g_wa_globe-ebeln.
call transaction 'ME33L' and skip first screen .
endif.
WHEN 'MMBE'.
IF g_wa_globe IS INITIAL.
MESSAGE i000(zf_mes) WITH text-048.
EXIT.
ENDIF.
SET PARAMETER ID 'MAT' FIELD g_wa_globe-matnr.
SET PARAMETER ID 'WRK' FIELD g_wa_globe-werks.
CALL TRANSACTION 'MMBE'." AND SKIP FIRST SCREEN .
SUBMIT rmmmbestn.
when 'ME2N'.
if g_wa_globe is initial.
message i000(zf_mes) with text-048.
exit.
endif.
submit rm06en00
with en_ebeln-low = g_wa_globe-ebeln
with listu = 'BEST'
and return.
when 'MK03'.
if g_wa_globe is initial.
message i000(zf_mes) with text-048.
exit.
endif.
if g_wa_globe-lifnr is not initial.
set parameter id 'LIF' field g_wa_globe-lifnr.
call transaction 'MK03' and skip first screen .
else.
message i000(zf_mes) with text-047.
exit.
endif.
when: 'EXIT' or 'CANC' or 'BACK'.
leave to screen 0.
endcase.
endform. "user_command
regards,
seshu.
‎2007 May 31 10:57 AM
Hello,
DO like this:
data: G_CALLBACK_USER_COMMAND TYPE SLIS_FORMNAME.
G_CALLBACK_USER_COMMAND = 'F_ALV_USER_COMMAND'.
*--- ALV List Display
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = G_PROGNAME
I_CALLBACK_USER_COMMAND = G_CALLBACK_USER_COMMAND
IT_FIELDCAT = G_T_FIELDCAT
* IT_EVENTS = IT_EVENTS
TABLES
T_OUTTAB = G_T_OUTTAB
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 FELDLIST_PROCESS.
DATA:
L_INDEX TYPE SYTABIX.
*--- Feldliste bearbeiten
LOOP AT G_T_FIELDCAT INTO G_R_FIELDCAT.
L_INDEX = SY-TABIX.
CASE G_R_FIELDCAT-FIELDNAME.
WHEN 'PRATX'.
G_R_FIELDCAT-KEY = 'X'.
G_R_FIELDCAT-SELTEXT_L = TEXT-U01.
G_R_FIELDCAT-SELTEXT_M = TEXT-U01.
G_R_FIELDCAT-SELTEXT_S = TEXT-U01.
G_R_FIELDCAT-REPTEXT_DDIC = TEXT-U01.
WHEN 'POSID'.
G_R_FIELDCAT-OUTPUTLEN = 18.
G_R_FIELDCAT-HOTSPOT = 'X'.
G_R_FIELDCAT-KEY = 'X'.
WHEN 'POST1'.
G_R_FIELDCAT-OUTPUTLEN = 40.
WHEN 'STTXT_INT'.
G_R_FIELDCAT-HOTSPOT = 'X'.
WHEN 'STTXT_EXT'.
G_R_FIELDCAT-HOTSPOT = 'X'.
WHEN 'ERDAT_VE'.
G_R_FIELDCAT-KEY = SPACE.
G_R_FIELDCAT-SELTEXT_L = TEXT-004.
G_R_FIELDCAT-SELTEXT_M = TEXT-004.
G_R_FIELDCAT-SELTEXT_S = TEXT-004.
G_R_FIELDCAT-REPTEXT_DDIC = TEXT-004.
WHEN 'NETPR_VE'.
G_R_FIELDCAT-KEY = SPACE.
G_R_FIELDCAT-SELTEXT_L = TEXT-003.
G_R_FIELDCAT-SELTEXT_M = TEXT-003.
G_R_FIELDCAT-SELTEXT_S = TEXT-003.
G_R_FIELDCAT-REPTEXT_DDIC = TEXT-003.
WHEN 'ERDAT_UM'.
G_R_FIELDCAT-KEY = SPACE.
G_R_FIELDCAT-SELTEXT_L = TEXT-007.
G_R_FIELDCAT-SELTEXT_M = TEXT-007.
G_R_FIELDCAT-SELTEXT_S = TEXT-007.
G_R_FIELDCAT-REPTEXT_DDIC = TEXT-007.
WHEN 'NETPR_UM'.
G_R_FIELDCAT-KEY = SPACE.
G_R_FIELDCAT-SELTEXT_L = TEXT-005.
G_R_FIELDCAT-SELTEXT_M = TEXT-005.
G_R_FIELDCAT-SELTEXT_S = TEXT-005.
G_R_FIELDCAT-REPTEXT_DDIC = TEXT-005.
WHEN 'WWGFE'.
G_R_FIELDCAT-KEY = SPACE.
G_R_FIELDCAT-SELTEXT_L = TEXT-006.
G_R_FIELDCAT-SELTEXT_M = TEXT-006.
G_R_FIELDCAT-SELTEXT_S = TEXT-006.
G_R_FIELDCAT-REPTEXT_DDIC = TEXT-006.
WHEN 'IST'.
G_R_FIELDCAT-KEY = SPACE.
G_R_FIELDCAT-SELTEXT_L = TEXT-008.
G_R_FIELDCAT-SELTEXT_M = TEXT-008.
G_R_FIELDCAT-SELTEXT_S = TEXT-008.
G_R_FIELDCAT-REPTEXT_DDIC = TEXT-008.
WHEN 'PLAN'.
G_R_FIELDCAT-KEY = SPACE.
G_R_FIELDCAT-SELTEXT_L = TEXT-009.
G_R_FIELDCAT-SELTEXT_M = TEXT-009.
G_R_FIELDCAT-SELTEXT_S = TEXT-009.
G_R_FIELDCAT-REPTEXT_DDIC = TEXT-009.
WHEN 'OBLIGO'.
G_R_FIELDCAT-KEY = SPACE.
G_R_FIELDCAT-SELTEXT_L = TEXT-010.
G_R_FIELDCAT-SELTEXT_M = TEXT-010.
G_R_FIELDCAT-SELTEXT_S = TEXT-010.
G_R_FIELDCAT-REPTEXT_DDIC = TEXT-010.
WHEN 'WIP'.
G_R_FIELDCAT-KEY = SPACE.
G_R_FIELDCAT-SELTEXT_L = TEXT-U21.
G_R_FIELDCAT-SELTEXT_M = TEXT-U21.
G_R_FIELDCAT-SELTEXT_S = TEXT-U21.
G_R_FIELDCAT-REPTEXT_DDIC = TEXT-U21.
ENDCASE.
MODIFY G_T_FIELDCAT FROM G_R_FIELDCAT INDEX L_INDEX.
ENDLOOP.
ENDFORM. " FELDLIST_PROCESS
*&---------------------------------------------------------------------*
*& Form GET_PSP_STATUS
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM GET_PSP_STATUS.
DATA:
L_T_JCDS TYPE SORTED TABLE OF JCDS WITH UNIQUE KEY OBJNR STAT CHGNR,
L_R_JCDS TYPE JCDS,
L_INDEX TYPE SYTABIX.
FIELD-SYMBOLS:
<L_FS_STATUS> TYPE TY_STATUS.
*--- Alle gewünschte Status zur Objeknummern zurücklesen
IF NOT G_T_PRPS[] IS INITIAL.
SELECT JEST~OBJNR JEST~STAT JEST~INACT JEST~CHGNR
* jcds~usnam jcds~udate jcds~utime
JSTO~OBTYP JSTO~STSMA
INTO CORRESPONDING FIELDS OF TABLE G_T_STATUS
FROM JEST
* INNER JOIN jcds ON jest~objnr = jcds~objnr
* AND jest~stat = jcds~stat
* AND jest~chgnr = jcds~chgnr
LEFT OUTER JOIN JSTO ON JEST~OBJNR = JSTO~OBJNR
FOR ALL ENTRIES IN G_T_PRPS
WHERE JEST~OBJNR EQ G_T_PRPS-OBJNR.
* AND jest~inact EQ space.
ENDIF.
SORT G_T_STATUS BY OBJNR STAT.
LOOP AT G_T_STATUS ASSIGNING <L_FS_STATUS>.
IF <L_FS_STATUS>-STAT+0(1) EQ 'I'.
*--- Systemstatus
SELECT SINGLE TXT04 TXT30
INTO (<L_FS_STATUS>-ITXT04, <L_FS_STATUS>-ITXT30)
FROM TJ02T
WHERE ISTAT EQ <L_FS_STATUS>-STAT
AND SPRAS EQ SY-LANGU.
ELSEIF <L_FS_STATUS>-STAT+0(1) EQ 'E'.
*--- Userstatus (Anwenderstatus)
SELECT SINGLE TXT04 TXT30
INTO (<L_FS_STATUS>-ETXT04, <L_FS_STATUS>-ETXT30)
FROM TJ30T
WHERE STSMA EQ <L_FS_STATUS>-STSMA
AND ESTAT EQ <L_FS_STATUS>-STAT
AND SPRAS EQ SY-LANGU.
ENDIF.
ENDLOOP.
ENDFORM. " GET_PSP_STATUS
*&---------------------------------------------------------------------*
*& Form F_USER_COMMAND_ALV
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM F_ALV_USER_COMMAND USING R_UCOMM LIKE SY-UCOMM
RS_SELFIELD TYPE SLIS_SELFIELD.
CASE R_UCOMM.
WHEN '&IC1'.
*--- Hotspot selektion
CASE RS_SELFIELD-FIELDNAME.
WHEN 'POSID'.
*------ PSP-Element
*-------- Click auf PSP Element -> PSP Element anzeigen (CJ12)
SET PARAMETER ID 'PSP' FIELD SPACE.
SET PARAMETER ID 'PRO' FIELD RS_SELFIELD-VALUE.
CALL TRANSACTION 'CJ12' AND SKIP FIRST SCREEN.
WHEN 'STTXT_INT'.
*------ Systemstatus
G_STTXT_INT = RS_SELFIELD-VALUE.
*-------- G_T_LEGENDE erfüllen
PERFORM F_FILL_G_T_LEGENDE_INT.
G_R_LAYOUT-WINDOW_TITLEBAR = 'Systemstatus'(004).
PERFORM F_STATUS_LEGENDE_POPUP.
WHEN 'STTXT_EXT'.
*------ Anwenderstatus
G_STTXT_EXT = RS_SELFIELD-VALUE.
*-------- G_T_LEGENDE erfüllen
PERFORM F_FILL_G_T_LEGENDE_EXT.
G_R_LAYOUT-WINDOW_TITLEBAR = 'Anwenderstatus'(005).
PERFORM F_STATUS_LEGENDE_POPUP.
ENDCASE.
ENDCASE.
ENDFORM. "F_USER_COMMAND_ALV
‎2007 May 31 11:01 AM
Hi Srikanth,
You can use object oriented methodolgy. Track the event "double_click" and in the handler method of the event do the necessary changes. See the following document for reference.
Award points if found useful.
Regards
Indrajit
‎2007 May 31 11:11 AM
Please dont confuse me...write some simple code ....
Can i write like this ...
AT LINE-SELECTION.
GET CURSOR FIELD FNAM VALUE FVAL.
MOVE LS_VERSION-GUID TO FVAL.
MOVE GWA_REP_TAB-PO TO FVAL.
CASE SY-LSIND.
WHEN 1.
WRITE : 'HELLO'.
ENDCASE.
But this is not working....
‎2007 May 31 11:17 AM
Hi Srikanth,
At line-selection event will not get triggered..
pass a form name say 'USER_COMMAND' in the fn module 'REUSE_ALV_GRID_DISPLAY'.
now we need to handle the double click event in this form. this form will get trigerred for any user action. for double click fn code will be &IC1
r_ucomm will have the value of the function code and the rs_selfield will have the name of the field.
if you have to go to another program when you double clicl VBELN
FORM USER_COMMAND USING R_UCOMM LIKE SY-UCOMM
RS_SELFIELD TYPE SLIS_SELFIELD.
CASE R_UCOMM.
WHEN '&IC1'.
CASE RS_SELFIELD-FIELDNAME.
WHEN 'VBELN'.
...call your program here....
endcase.
endcase.
Regards,
Vidya.
‎2007 May 31 11:32 AM
Hi Srikanth ,
You need to do the following
1. In the parameter I_CALLBACK_PROGRAM of the FM pass the program name , using a varaibale of type sy-repid.
2. In the parameter I_CALLBACK_USER_COMMAND , specify the name of a subroutine which will be triggred when user performs some function. e.g.
<b> I_CALLBACK_USER_COMMAND = 'USER_COMMAND'</b>
3. Now create a subroutine with the same name and with two paramaters one for the user command and the other containing the the details of the column on which user has performed the operation.
e.g.
<b>FORM USER_COMMAND USING R_UCOMM LIKE SY-UCOMM
RS_SELFIELD TYPE SLIS_SELFIELD.
endform.</b>
4. Now in the feild RS_SELFIELD-VALUE you will have the value of the column on which the user clicked.
Use this value to call your second report using submit / call transaction.
I would advice you to create the subroutine and put a breakpoint on the subroutine and see what all values are passed to both the parameters to have a better understanding .
Hope this helps
Regards
Arun
‎2007 May 31 12:16 PM
Thanks for u reply...
But here i m using the classes rather than FMs
CALL METHOD cl_gui_alv_grid->set_table_for_first_display
how to develop here.....
‎2007 May 31 12:31 PM
Hi Srikanth,
Please check the link i sent in my first reply to your post.
Award points if found useful.
Regards
Indrajit
‎2007 May 31 12:32 PM
Hi Srikanth ,
Since you are using Objects to display the ALV , so you need to create a local class to handle the event double click .
Here are the stepis for the same.
1. Define a class in your program , and in it define method to handle double click event.
e.g.
class event_handler definition.
public section.
methods : handle_double_click
for event double_click
of cl_gui_alv_grid
importing e_row .
endclass.2. Implement the class e.g.
class event_handler implementation.
method handle_double_click.
read table <Internal table > into wa index e_row-index.
* Here e_row-index will contain the index of the entry on which the user clicked.
* So read it and hence you get the value.and do rest of processing
endmethod.
endclass3. In the program create a varaibale with ref to the class.
e.g. Data : handler type ref to event_handler .
4. Create an instance of this class and set it as handler for your grid
create object handler.
set handler handler->handle_double_click for <Instance of grid >.This must solve your problem.
Regards
Arun
‎2007 May 31 12:43 PM
Hi Arun,
Thanks for u r reply...
But i m unable to understand the code u wrote...can u send me ur mail ID so that i can u my exact code so that u can get the idea....
‎2007 May 31 12:58 PM
Hi Srikant ,
You can mail me at a.ramachandran@hotmail.com.
If you dont lind could you please tell me what did you not understand , so that i can tell you in a better way.
Regards
Arun
‎2007 May 31 1:19 PM
‎2007 May 31 1:34 PM
Hi Srikanth ,
Went through the code , please refer to the steps i have provided , it should work.
I will just sum it up again , to handle event in ALV implemented using Objects , you need to create a local class which will handle the events.
So the steps are here
1. Define a class
2. Implement the class.
3. Deine a varaible for the class.
4. Create an instance of the class and set it as handler for the grid.
try this and do feel free to revert back in case of further queries.
Regards
Arun
‎2007 May 31 2:36 PM
im unable to write the code..how to declare the code exactly......
Pls help
‎2007 May 31 2:52 PM
Hi Srikanth ,
Just copy the code i have written in my previous post , put a break point on the read table statement and execute the program.
please do the following.
a )Step 1 and 2 , after the tables decleration at the beginning of your program.
<b>In Step 2 , replace <internal table> with gt_rep_tab</b>
b) After step a) has been done do step 3.( Next line after endclass)
c) Goto MODULE status_0900 OUTPUT ,
before the statement ALL METHOD cs_alv_grid->set_table_for_first_display
write
<b>create object handler.
set handler handler->handle_double_click for cs_alv_grid.</b>
When you execute the program it stops and the varaible e_row-index will ahve the index of the item on which the user clicked.
Please do this and tell me the result.
Regards
Arun
Assign points if reply is helpful
Message was edited by:
Arun R
‎2007 May 31 5:20 PM
Thanks..
but it is giving syntax error as "statement is not accessible"
it is giving after the this statement -->
class event_handler definition.
public section.
methods : handle_double_click
for event double_click
of cl_gui_alv_grid
importing e_row .
endclass.
class event_handler implementation.
method handle_double_click.
read table gt_rep_tab1 into gwa_rep_tab1 index e_row-index.
Here e_row-index will contain the index of the entry on which the user clicked.
So read it and hence you get the value.and do rest of processing
endmethod.
endclass.
Pls help...
‎2007 May 31 12:29 PM
Hi Srikanth,
there is an event called 'double_click' in class cl_gui_alv_grid.
we need to handle this event in our program.
class event_handler definition.
public section.
methods: handle_double_click
FOR EVENT double_click OF cl_gui_alv_grid IMPORTING e_row e_column.
endclass.
class event_handler implementation.
method handle_double_click.
now write your code here...
endmethod.
endclass.
after your start-of-selection event..
data: obj_event type ref to event_handler.
create obj_event.
SET HANDLER obj_event->on_double_click FOR grid1
Regards,
Vidya.