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 - combining 2 fields

Former Member
0 Likes
2,150

Hello Gurus,

The requirement is to combine bseg-ebeln and bseg-kblnr into one S_variable. The user will either enter ebeln or kblnr. How to do this?

SELECTION-SCREEN BEGIN OF BLOCK block_1 WITH FRAME TITLE text-t01.

SELECT-OPTIONS:

s_ebeln FOR bseg-ebeln,

  • or for bseg-kblnr,

s_kblnr FOR bseg-kblnr,

s_confd FOR fmtc_schno-confd.

SELECTION-SCREEN END OF BLOCK block_1.

Thank you very much,

Punita

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,372

Hi,

You can display the select-options with char10 dataelement...and then use OR condition in the where clause accordingly.

SELECT ..FROM bseg ..WHERE..ebeln IN so_podoc OR kblnr IN so_podoc.

Thanks

Naren

8 REPLIES 8
Read only

karol_seman
Active Participant
0 Likes
1,372

Hi,

I am not sure how you mean to combine it into one select-option. How can you then distinguish whether you have to check ebeln or kblnr field in the table bseg?

The best is to have two select-options and then make select like

SELECT * FROM bseg into table it_bseg where

ebeln in so_ebeln and kblnr in so_kblnr.

It will work correctly also if only one select option is filled ...

Or if you have different idea, please specify and we can discuss.

Regards,

Karol

Read only

0 Likes
1,372

Hi,

Thank you,

Business has one text box and they will enter either purchase document number (EBELN) or KBLNR (documnt # for ear marked funds). The search should happen for both the fields in BSEG table.

Punita.

Read only

0 Likes
1,372

Thank you SO much, you all answered my question,

Punita

Read only

0 Likes
1,372

Neither field is a key for BSEG, so this will not work in a production environment. You would have to search the relevant tables where there are keys, but what would you do if they are in both tables?

Rob

Read only

former_member156446
Active Contributor
0 Likes
1,372

ebeln or kblnr


at selection screen.

select single ebeln 
           from ... into ..
if sy-subrc eq 0.
flag = 'X'.
else.
flag = 'Y'.
endif.


write two different selects and based on the flag get data.

if flag = 'X'.
select...

where..
eblen in so_value.

else.
select..

where kblnr in so_value.

Read only

Former Member
0 Likes
1,372

So, how does the program tell if it's a PO or an earmarked document?

Rob

Read only

Former Member
0 Likes
1,372

it is not possible, conditionally display them in selection screen if you want , with the help of some radio button or checkbox , using the event at selection-screen output you can hide them using loop at screen logic. but you cannot have a single field to hold the two variables.

Read only

Former Member
0 Likes
1,373

Hi,

You can display the select-options with char10 dataelement...and then use OR condition in the where clause accordingly.

SELECT ..FROM bseg ..WHERE..ebeln IN so_podoc OR kblnr IN so_podoc.

Thanks

Naren