Posted: Wed Sep 05, 2007 4:04 pm Post subject: ALV with Call Transaction (using Parameter ID)
Code:
REPORT ZRFQDOWNLOAD no standard page heading
message-id zz.
*----------------------------------------------------------------------*
* TABLES DECLARATION
*----------------------------------------------------------------------*
tables : ekko, " Purch. Header
ekpo, " Purch. Item
lfa1, " Vendor Master
T024E, " Purc. Organisation
t001w, " Plant
t023, " Material Group
mara. " Internal Material Nr / MPN Material Nr
type-pools : slis.
*----------------------------------------------------------------------*
* STRUCTURE DECLARATION
*----------------------------------------------------------------------*
data : begin of st_rfq,
ebeln type EKKO-ebeln, "RFQ Number
ebelp type EKPO-EBELP, "RFQ Line Number
bedat type EKKO-BEDAT, "RFQ date generated
matnr type EKPO-MATNR, "Part #
MAKTX1 type MAKT-MAKTX, "Description
ematn type EKPO-EMATN, "MPN Material Number
MAKTX type MAKT-MAKTX, "Description
KTMNG type EKPO-KTMNG, "Qty
MEINS type EKPO-MEINS, "UOM Quoted
lifnr type ekko-lifnr, "Vendor number
NAME1 type LFA1-NAME1, "Vendor Name
mfrnr like ekpo-mfrnr, " Manufacturer Number
name11 like lfa1-name1, " Manufacturer Name
MFRPN type EKPO-MFRPN, "Manufacturer part Number
angdt like ekko-angdt, " Quotation Due Date
kdatb like ekko-kdatb, " Validity Start Date
kdate like ekko-kdate, " Validity End Date
end of st_rfq.
*----------------------------------------------------------------------*
* INTERNAL TABLE, WORK AREA DECLARATION
*----------------------------------------------------------------------*
data : it_rfq like table of st_rfq,
wa_rfq like line of it_rfq.
data : it_fieldcat type slis_t_fieldcat_alv,
wa_fieldcat like line of it_fieldcat,
it_top_of_page type slis_t_listheader,
wa_top_of_page like line of it_top_of_page,
wa_layout type slis_layout_alv.
DATA : it_message TYPE STANDARD TABLE OF solisti1 INITIAL SIZE 0
WITH HEADER LINE.
DATA : it_attach TYPE STANDARD TABLE OF solisti1 INITIAL SIZE 0
WITH HEADER LINE.
data : t_receivers LIKE somlreci1 OCCURS 0 WITH HEADER LINE,
t_attachment type solisti1 OCCURS 0 WITH HEADER LINE,
t_packing_list LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE,
w_doc_data LIKE sodocchgi1,
w_cnt TYPE i.
************************************************************************
* INITIALIZATION
************************************************************************
Initialization.
*Put the default values in selection screen,
perform put_default_values.
************************************************************************
* SELECTION-SCREEN
************************************************************************
**Selection Criterion
selection-screen begin of block b1 with frame title text-001.
select-options : s_lifnr for EKKO-LIFNR MEMORY ID LIF
MATCHCODE OBJECT KRED. "Vendor
select-options : s_ekorg for EKKO-EKORG. "Purch. Organization
select-options : s_submi for EKKO-SUBMI. "Collective Number
select-options : s_ebeln for EKKO-EBELN. "Document Number
select-options : s_bedat for EKKO-BEDAT. "Document date
select-options : s_werks for EKPO-WERKS. "Plant
select-options : s_matkl for EKPO-MATKL. "Material Group
select-options : s_matnr for EKPO-MATNR. "Internal Material Number
select-options : s_ematn for EKPO-EMATN. "MPN Material Number
select-options : s_mfrnr for EKpO-MFRnr. "Manufacturer Number
select-options : s_mfrpn for EKPO-MFRPN. "Manufacturer Part no
select-options : s_angdt for EKkO-angdt. "Deadline for bid/quotation
select-options : s_kdatb for EKkO-kdatb. "Start of validity period
select-options : s_kdate for EKkO-kdate. "End of validity period
select-options : s_statu for ekpo-statu. "Status of purchasing document
selection-screen end of block b1.
************************************************************************
* AT SELECTION-SCREEN
************************************************************************
at selection-screen on value-request for p_fpath.
*Get the file name and path on Presentation Server
perform get_filename_path changing p_fpath.
at selection-screen.
at selection-screen on s_lifnr.
*Validation for Vendor
if not s_lifnr[] is initial.
select lifnr from lfa1
up to 1 rows
into lfa1-lifnr
where lifnr in s_lifnr.
endselect.
if sy-subrc ne 0.
message e999 with 'Please enter a valid Vendor Number'(057).
endif.
endif.
at selection-screen on s_mfrnr.
if not s_mfrnr[] is initial.
select lifnr from lfa1
up to 1 rows
into lfa1-lifnr
where lifnr in s_mfrnr.
endselect.
if sy-subrc ne 0.
message e999 with 'Please enter a valid Manufacturer Number'(006).
endif.
endif.
at selection-screen on s_ekorg.
*Validation for Purch. Organisation
if not s_ekorg[] is initial.
select ekorg from t024e "#EC *
into t024e-ekorg
up to 1 rows
where ekorg in s_ekorg.
endselect.
if sy-subrc ne 0.
message e999 with
'Please enter a valid Purc. Organization'(056).
endif.
endif.
at selection-screen on s_ebeln.
*Validation for RFQ Number
if not s_ebeln[] is initial.
select ebeln from ekko "#EC *
into ekko-ebeln
up to 1 rows
where ebeln in s_ebeln.
endselect.
if sy-subrc ne 0.
message e999 with 'Please enter a valid RFQ Number'(055).
endif.
endif.
at selection-screen on s_werks.
*Validation for Plant
if not s_werks[] is initial.
select werks from t001w "#EC *
into t001w-werks
up to 1 rows
where werks in s_werks.
endselect.
if sy-subrc ne 0.
message e999 with 'Please enter a valid Plant'(054).
endif.
endif.
at selection-screen on s_matkl.
*Validation for Material Group
if not s_matkl[] is initial.
select matkl from t023 "#EC *
into t023-matkl
up to 1 rows
where matkl in s_matkl.
endselect.
if sy-subrc ne 0.
message e999 with 'Please enter a valid Material group'(053).
endif.
endif.
at selection-screen on s_matnr.
*Validation for Internal Material Nr
if not s_matnr[] is initial.
select matnr from mara "#EC *
into mara-matnr
up to 1 rows
where matnr in s_matnr.
endselect.
if sy-subrc ne 0.
message e999 with
'Please enter a valid Internal Material Number'(052).
endif.
endif.
at selection-screen on s_ematn.
*Validation for MPN Material Number
if not s_ematn[] is initial.
select matnr from mara "#EC *
into mara-matnr
up to 1 rows
where matnr in s_ematn.
endselect.
if sy-subrc ne 0.
message e999 with 'Please enter a valid MPN Material Number'(051).
endif.
endif.
*&---------------------------------------------------------------------*
*& Form fetch_rfq_det
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM fetch_rfq_det .
select k~ebeln p~ebelp k~bedat p~matnr m~maktx
p~ematn n~maktx p~KTMNG p~MEINS k~lifnr
l~name1 p~mfrnr f~name1 p~MFRPN k~angdt
k~kdatb k~kdate
into table it_rfq
from ekko as k
inner join ekpo as p
on k~ebeln = p~ebeln
inner join makt as m
on p~matnr = m~matnr
and m~spras = sy-langu
inner join makt as n
on p~ematn = n~matnr
and n~spras = sy-langu
inner join lfa1 as l
on k~lifnr = l~lifnr
left outer join lfa1 as f
on f~lifnr = p~mfrnr
where k~bstyp = 'A'
and k~LOEKZ = space
and p~LOEKZ = space
and k~lifnr in s_lifnr
and k~ekorg in s_ekorg
and k~SUBMI in s_submi
and k~EBELN in s_ebeln
and k~BEDAT in s_bedat
and p~WERKS in s_werks
and p~MATKL in s_MATKL
and p~MATNR in s_MATNR
and p~EMATN in s_EMATN
and p~mfrnr in s_mfrnr
and p~MFRPN in s_MFRPN
and k~angdt in s_angdt
and k~kdatb in s_kdatb
and k~kdate in s_kdate
and p~statu in s_statu.
if sy-subrc ne 0.
message s999 with 'No records found'(050).
stop. "#EC *
endif.
ENDFORM. " fetch_rfq_det
*&---------------------------------------------------------------------*
*& Form fieldcat_alv
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM fieldcat_alv .
data : wrk_pos type numc3.
*&---------------------------------------------------------------------*
*& Form user_command1
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM user_command1 using ucomm type sy-ucomm
selfield type slis_selfield. "#EC CALLED
case ucomm.
when '&IC1'.
read table it_rfq into wa_rfq index selfield-tabindex.
if sy-subrc eq 0.
if selfield-fieldname = 'EBELN' " RFQ Number
and not wa_rfq-ebeln is initial.
set parameter id 'ANF' field wa_rfq-ebeln.
call transaction 'ME43' and skip first screen.
elseif selfield-fieldname = 'MATNR'. " Internal Material Number
set parameter id 'MAT' field wa_rfq-matnr.
call transaction 'MM03' and skip first screen.
elseif selfield-fieldname = 'EMATN'. " MPN Material Number
set parameter id 'MAT' field wa_rfq-ematn.
call transaction 'MM03' and skip first screen.
elseif selfield-fieldname = 'LIFNR'. " Manufacturer
set parameter id 'LIF' field wa_rfq-lifnr.
call transaction 'MK03' and skip first screen.
elseif selfield-fieldname = 'MFRNR'. " Manufacturer
set parameter id 'LIF' field wa_rfq-mfrnr.
call transaction 'MK03' and skip first screen.
endif.
endif.
endcase.
ENDFORM. " user_command1
*&---------------------------------------------------------------------*
*& Form top_of_page
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM top_of_page . "#EC CALLED
data wrk_head(60).
DATA wrk_date(10).
DATA wrk_time(10).
CLEAR wa_top_of_page.
CLEAR wrk_head.
CONCATENATE 'RFQ Report'(043) ''
INTO wrk_head.
wa_top_of_page-typ = 'H'.
wa_top_of_page-info = wrk_head.
APPEND wa_top_of_page TO it_top_of_page.
* CONCATENATE sy-datum+6(2) '-' sy-datum+4(2) '-' sy-datum(4)
* INTO wrk_date.
write sy-datum to wrk_date.
write sy-uzeit to wrk_time.
CLEAR wa_top_of_page.
wa_top_of_page-key = 'Reporting Date:'(040).
wa_top_of_page-typ = 'S'.
wa_top_of_page-info = wrk_date.
APPEND wa_top_of_page TO it_top_of_page.
* CONCATENATE sy-uzeit(2) ':' sy-uzeit+2(2) ':' sy-uzeit+4(2)
* INTO wrk_time.
*&---------------------------------------------------------------------*
*& Form put_default_values
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM put_default_values.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum
All product names are trademarks of their respective companies. SAPNET.RU websites are in no way affiliated with SAP AG. SAP, SAP R/3, R/3 software, mySAP, ABAP, BAPI, xApps, SAP NetWeaver and any other are registered trademarks of SAP AG. Every effort is made to ensure content integrity. Use information on this site at your own risk.