Application Development 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: 

SELECT-OPTIONS - combining 2 fields

Former Member
0 Kudos

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

Former Member
0 Kudos

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

karol_seman
Active Participant
0 Kudos

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

0 Kudos

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.

0 Kudos

Thank you SO much, you all answered my question,

Punita

0 Kudos

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

former_member156446
Active Contributor
0 Kudos

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.

Former Member
0 Kudos

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

Rob

former_member188685
Active Contributor
0 Kudos

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.

Former Member
0 Kudos

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