Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

select options problem

Former Member
0 Likes
655

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.

6 REPLIES 6
Read only

Former Member
0 Likes
631

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.

Read only

Former Member
0 Likes
631

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

Read only

Former Member
0 Likes
631

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

Read only

0 Likes
631

Yes and you can loop through the internal table and at every new document number start a new page.

Read only

Former Member
0 Likes
631

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

Read only

Former Member
0 Likes
631

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.