‎2008 Jun 17 9:37 AM
Hi,
I have one sap-script having selection screen as below,
selection-screen : begin of block b1 with frame title text-001.
parameter: p_bukrs for bkpf-bukrs.
select-options : p_belnr for bkpf-belnr.
parameter: p_gjahr for bkpf-gjahr.
selection-screen : end of block b1 .
my requirement is to display each company code, document Number and fiscal year in one page.
iam able to display single document on one page. but not able to display when p_belnr is in ranges in different page and how to fatch the data from select-options and how to put loop on it.
any idea, Pl let me know.
Thanks,
Vamsykrishna.
‎2008 Jun 17 9:41 AM
loop at s_matnr .
r_ranges-low = s_matnr-low.
r_ranges-sign = 'I'.
r_ranges-option = 'EQ'.
r_ranges-high = s_matnr-high.
append r_ranges.
endloop.
loop at r_ranges.
write:/ r_ranges-low.
endloop.
‎2008 Jun 17 9:44 AM
Hi,
Check the below code...
Select BELNR from BSEG into table i_bseg where belnr in p_belnr and bukrs = p_bukrs.
If sy-subrc = 0.
Loop at i_bseg.
<Implement your logic>.
Endloop.
endif.
Rgds,
Bujji
‎2008 Jun 17 9:45 AM
Hi
Before printing the data u should store the document to be printed in an internal table sorted by company code fyscal year and doc. number.
In this way y can know when a new page has to printed: as soon as change company code or fyscal year or doc. number:
selection-screen : begin of block b1 with frame title text-001.
parameter: p_bukrs type bkpf-bukrs.
select-options : p_belnr for bkpf-belnr.
parameter: p_gjahr type bkpf-gjahr.
selection-screen : end of block b1 .
data t_bkpf type standard table of bkpf.
start-of-selection.
select * from bkpf into table t_bkpf where bukrs = p_bukrs
and belnr in p_belnr
and gjahr = p_gjahr.
sort t_bkpf by bukrs gjahr belnr.Max
‎2008 Jun 17 9:51 AM
Yes and you can loop through the internal table and at every new document number start a new page.
‎2008 Jun 17 9:47 AM
Hi,
try to populate all BELNR available in BKPF by passing only BELNR into internal table. this will give the range of values for the p_belnr that u gave in sel-screen
regards,
madhu
‎2008 Jun 17 9:57 AM
When selecting data from database say from BKPF use IN operator with the select-option in the where cluse like:
Select bukrs
belnr
gjahr
......
from BKPF into table i_bkpf << it contains all the document nos
where bukrs = p_bukrs
and belnr in p_belnr
and gjahr = p_gjahr.
if sy-subrc = 0.
loop at i_bkpf. << for each document no call the sapscript form
call function 'WRITE_FORM'
.........
endloop.
Regards,
Joy.