10-16-2007 5:11 AM
i wanna write a bdc for displaying the particular transaction.
and the tcode is XK03
this has to executed after the generation of the alv report.
i.e., after executing the report we get some vendor numbers, based on the selection
of the particular vendor we have to go into the display mode of that particular vendor
if anyone knows this please reply ASAP
10-16-2007 6:03 AM
Vamsi,
What u need in this case is an interactive ALV. Ie, when a vendor is clicked oon alv your txn must be called
see below code. it calls MM02...
report z_alv_interactive.
tables : lfa1,ekko,ekpo.
select-options : vendor for lfa1-lifnr.
data : begin of itab occurs 0,
lifnr like lfa1-lifnr,
name1 like lfa1-name1,
end of itab.
data : begin of jtab occurs 0,
ebeln like ekko-ebeln,
aedat like ekko-aedat,
end of jtab.
data : begin of ktab occurs 0,
ebelp like ekpo-ebelp,
matnr like ekpo-matnr,
end of ktab.
type-pools : slis.
data : repid like sy-repid.
data :lfa1_b type slis_t_fieldcat_alv,
lfa1_w type slis_fieldcat_alv,
ekko_b type slis_t_fieldcat_alv,
ekko_w type slis_fieldcat_alv,
ekpo_b type slis_t_fieldcat_alv,
ekpo_w type slis_fieldcat_alv,
events_b type slis_t_event,
events_w type slis_alv_event.
perform get_val.
repid = sy-repid.
select lifnr name1 from lfa1 into table itab where lifnr in vendor.
*perform val USING USER_COMMAND sel.
call function 'REUSE_ALV_LIST_DISPLAY'
exporting
i_callback_program = repid
it_fieldcat = lfa1_b
it_events = events_b
tables
t_outtab = itab.
&----
*& Form GET_VAL
&----
text this is to put column headings
----
form get_val.
lfa1_w-fieldname = 'LIFNR'.
lfa1_w-ref_tabname = 'LFA1'.
lfa1_w-ref_fieldname = 'LIFNR'.
append lfa1_w to lfa1_b.
lfa1_w-fieldname = 'NAME1'.
lfa1_w-ref_tabname = 'LFA1'.
lfa1_w-ref_fieldname = 'NAME1'.
append lfa1_w to lfa1_b.
ekko_w-fieldname = 'EBELN'.
ekko_w-ref_tabname = 'EKKO'.
ekko_w-ref_fieldname = 'EBELN'.
append ekko_w to ekko_b.
ekko_w-fieldname = 'AEDAT'.
ekko_w-ref_tabname = 'EKKO'.
ekko_w-ref_fieldname = 'AEDAT'.
append ekko_w to ekko_b.
ekpo_w-fieldname = 'EBELP'.
ekpo_w-ref_tabname = 'EKPO'.
ekpo_w-ref_fieldname = 'EBELP'.
append ekpo_w to ekpo_b.
ekpo_w-fieldname = 'MATNR'.
ekpo_w-ref_tabname = 'EKPO'.
ekpo_w-ref_fieldname = 'MATNR'.
append ekpo_w to ekpo_b.
events_w-name = 'USER_COMMAND'.
events_w-form = 'VAL'.
append events_w to events_b.
endform. "GET_VAL
&----
*& Form VAL
&----
text
----
-->USER_COMMANtext
-->SEL text for retrieving data
----
form val using user_command like sy-ucomm sel type slis_selfield.
data : ven(10) type n,
po(10) type n.
data : mat(10) type c.
if sel-fieldname = 'LIFNR'.
ven = sel-value.
select ebeln aedat from ekko into table jtab where lifnr = ven.
call function 'REUSE_ALV_LIST_DISPLAY'
exporting
i_callback_program = repid
I_STRUCTURE_NAME = EKKO_B
it_fieldcat = ekko_b
it_events = events_b
tables
t_outtab = jtab.
endif.
if sel-fieldname = 'EBELN'.
po = sel-value.
select ebelp matnr from ekpo into table ktab where ebeln = po.
call function 'REUSE_ALV_POPUP_TO_SELECT'
exporting
i_title = 'ITEM DETAILS'
i_tabname = 'EKPO'
it_fieldcat = ekpo_b
i_callback_program = repid
importing
es_selfield = sel
tables
t_outtab = ktab.
endif.
logic to select a record
if sel-fieldname = 'MATNR'.
mat = sel-value.
set parameter id 'MAT' field mat.
call transaction 'MM02' and skip first screen.
endif.
endform. "VAL
Reward if helpful,
Karthik