on 03-28-2008 6:20 AM
Hi friends can any one share me the procedure to create sap script with table that has to be displayed....
Hi
i am sending script program you go through it.
types:begin of st_lfa1,
lifnr type lfa1-lifnr,
name1 type lfa1-name1,
land1 type lfa1-land1,
ort01 type ort01,
regio type regio,
end of st_lfa1.
types:begin of st_ekko,
ebeln type ekko-ebeln,
bukrs type ekko-bukrs,
aedat type ekko-aedat,
ernam type ekko-ernam,
bstyp type ekko-bstyp,
lifnr type ekko-lifnr,
end of st_ekko.
types:begin of st_ekpo,
ebeln type ekpo-ebeln,
ebelp type ekpo-ebelp,
loekz type ekpo-loekz,
aedat type ekpo-aedat,
matnr type ekpo-matnr,
netwr type ekpo-netwr,
end of st_ekpo.
&--
data:wa_lfa1 type st_lfa1,
it_lfa1 type standard table of st_lfa1,
wa_ekko type st_ekko,
it_ekko type standard table of st_ekko,
wa_ekpo type st_ekpo,
it_ekpo type standard table of st_ekpo.
&--
data:total type ekpo-netwr,
v_ebeln type ekko-ebeln.
data: v_item(20) type c.
&--
selection-screen begin of block b1 with frame title text-001.
parameters p_purdoc like v_ebeln.
selection-screen end of block b1.
start-of-selection.
perform get_data_from_ekko.
perform get_data_from_lfa1.
perform get_data_from_ekpo.
&--
loop at it_ekpo into wa_ekpo.
total = total + wa_ekpo-netwr.
clear wa_ekpo.
endloop.
&--
call function 'OPEN_FORM'
exporting
device = 'PRINTER'
form = 'Z_50886_VENDOR'
language = sy-langu
exceptions
canceled = 1
device = 2
form = 3
options = 4
unclosed = 5
mail_options = 6
archive_error = 7
invalid_fax_number = 8
more_params_needed_in_batch = 9
spool_error = 10
codepage = 11
others = 12
.
if sy-subrc <> 0.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
endif.
&--
read table it_ekko into wa_ekko index 1.
call function 'WRITE_FORM'
exporting
element = 'HEAD'
window = 'HEADER'
exceptions
element = 1
function = 2
type = 3
unopened = 4
unstarted = 5
window = 6
bad_pageformat_for_print = 7
spool_error = 8
codepage = 9
others = 10
.
if sy-subrc <> 0.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
endif.
&--
loop at it_ekpo into wa_ekpo.
concatenate wa_ekko-ebeln wa_ekpo-ebelp into v_item.
call function 'WRITE_FORM'
exporting
element = 'ITEM'
window = 'MAIN'
exceptions
element = 1
function = 2
type = 3
unopened = 4
unstarted = 5
window = 6
bad_pageformat_for_print = 7
spool_error = 8
codepage = 9
others = 10
.
if sy-subrc <> 0.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
endif.
endloop.
&--
read table it_lfa1 into wa_lfa1 index 1.
call function 'WRITE_FORM'
exporting
element = 'VENDOR'
window = 'ADDRESS'
exceptions
element = 1
function = 2
type = 3
unopened = 4
unstarted = 5
window = 6
bad_pageformat_for_print = 7
spool_error = 8
codepage = 9
others = 10.
if sy-subrc <> 0.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
endif.
&--
call function 'WRITE_FORM'
exporting
window = 'TOTAL'
exceptions
element = 1
function = 2
type = 3
unopened = 4
unstarted = 5
window = 6
bad_pageformat_for_print = 7
spool_error = 8
codepage = 9
others = 10
.
if sy-subrc <> 0.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
endif.
&--
call function 'CLOSE_FORM'
exceptions
unopened = 1
bad_pageformat_for_print = 2
send_error = 3
spool_error = 4
codepage = 5
others = 6
.
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 get_data_from_ekko
&----
form get_data_from_ekko .
select ebeln
bukrs
aedat
ernam
bstyp
lifnr
from ekko into table it_ekko where ebeln = p_purdoc.
endform. " get_data_from_ekko
&----
*& Form get_data_from_lfa1
&----
form get_data_from_lfa1 .
if not it_ekko[] is initial.
select lifnr
name1
land1
ort01
regio
from lfa1 into table it_lfa1 for all entries in it_ekko where
lifnr = it_ekko-lifnr.
endif.
endform. " get_data_from_lfa1
&----
*& Form get_data_from_ekpo
&----
form get_data_from_ekpo .
if not it_ekko[] is initial.
select ebeln
ebelp
loekz
aedat
matnr
netwr
from ekpo into table it_ekpo
where ebeln = p_purdoc.
endif.
you also go through these links.
http://www.sap-img.com/sapscripts/create-scripts-of-your-own-using-standard-scripts.htm
http://www.sap-img.com/sapscripts/a-sample-sap-scripts-reports.htm
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Go thru the below link:
It has step by step approach...
Regards,
Narendra.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
6 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.