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

condition based on selection screen.

aris_hidalgo
Contributor
0 Likes
503

Hello experts,

I have been trying to analyze this problem for quite some time. my boss wants me to modify a certain report where in when a user enters a material number with or w/o a date in the selection screen the first select statement would not be used and instead a second one would be used which I can't figure out how to do it. in the first select statement, the material no that the user enters is retrieved from COOI table but my boss wants me to use instead EBAN table for the comparison of matnr. Also, in the 2nd select statement I would get ebeln. And what i'm thinking is that the whole report would be affected. I have posted below the code guys. So please bear with me as I new to ABAP. Thanks you so much!

**here is the selection screen**

SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.

PARAMETERS: pa_bukrs LIKE t001-bukrs OBLIGATORY DEFAULT 'GLOB'.

SELECT-OPTIONS: so_psphi FOR prps-psphi,

so_ebeln FOR ekko-ebeln,

so_lifnr FOR ekko-lifnr,

so_matnr FOR ekpo-matnr.

  • so_augdt FOR bseg-augdt.

PARAMETERS: pa_augdt LIKE bseg-augdt.

SELECTION-SCREEN END OF BLOCK b1.

**here is the select statement I am trying to modify**

SELECT apsphi brefbn b~lifnr

FROM prps AS a INNER JOIN cooi AS b

ON aobjnr = bobjnr

INTO CORRESPONDING FIELDS OF it_hdr

WHERE a~psphi IN so_psphi

AND a~pbukr = pa_bukrs

AND a~erdat LE v_budat

  • AND a~erdat in so_augdt

AND b~refbn IN so_ebeln

AND b~lifnr IN so_lifnr

AND b~matnr IN so_matnr

AND b~rfart = 'P'

OR b~rfart EQ space.

SELECT SINGLE name1 FROM lfa1 INTO it_hdr-name1

WHERE lifnr = it_hdr-lifnr.

IF NOT pa_augdt IS INITIAL.

  • IF NOT so_augdt[] IS INITIAL.

CLEAR ekko.

SELECT SINGLE * FROM ekko

WHERE ebeln = it_hdr-refbn

  • AND bedat IN so_augdt.

AND bedat LE pa_augdt.

IF sy-subrc EQ 0.

APPEND it_hdr.

CLEAR it_hdr.

ENDIF.

ELSE.

APPEND it_hdr.

CLEAR it_hdr.

ENDIF.

ENDSELECT.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
476

Hi,

In Start-of-selection event,

check select option for material.

If it is initial, use second select statement,

otherwise use the first one.

It wont affect the whole report.

Hope this helps...

Regards,

Shashank

3 REPLIES 3
Read only

hymavathi_oruganti
Active Contributor
0 Likes
476

let so_matnr be the select option for matnr.

u can do like below.

if so_matnr is initial.

use first select statement.

else.

use the second select

Read only

Former Member
0 Likes
476

Hi viraylab

for the first probelm

if so_matnr is initial.

<then execute the first select statement>

else

<then execute the second statement>.

endif.

Read only

Former Member
0 Likes
477

Hi,

In Start-of-selection event,

check select option for material.

If it is initial, use second select statement,

otherwise use the first one.

It wont affect the whole report.

Hope this helps...

Regards,

Shashank