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

help to solve query

0 Likes
1,267

hello

i m new in abap so please help me in following query.

there are two field on selection screen . REGIO and WERKS

I need to pick the regio and respective werks from T001W the need to pass werks in ZRB_CRHDR then pick all data.

when we leave regio blank and enter WERKS then it goes directly in ZRB_CRHDR and pick all data..

I have written following code but not successful

SELECT

REGIO

WERKS INTO TABLE I_FINAL12

FROM T001W WHERE

REGIO IN REGION .

IF NOT I_FINAL[] IS INITIAL .

SELECT

WERKS

AUART

ZRB_SCHPD

ZRB_STAMT

INTO TABLE I_ZRB_CRHDR

FROM ZRB_CRHDR

FOR ALL ENTRIES IN I_FINAL WHERE

WERKS = I_FINAL-WERKS AND

WERKS IN PLANT AND

ZRB_SCHPD IN DATE AND

SPART = DIVISION .

ENDIF .

please help

thanks in advance

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,241

Hello,

Try this,



if not regio is initial.

SELECT
REGIO
WERKS INTO TABLE I_FINAL12
FROM T001W WHERE
REGIO IN REGION .

if sy-subrc = 0.

SELECT
WERKS
AUART
ZRB_SCHPD
ZRB_STAMT
INTO TABLE I_ZRB_CRHDR
FROM ZRB_CRHDR
FOR ALL ENTRIES IN I_FINAL WHERE
WERKS = I_FINAL-WERKS AND
ZRB_SCHPD IN DATE AND
SPART = DIVISION .
endif.

else.

SELECT
WERKS
AUART
ZRB_SCHPD
ZRB_STAMT
INTO TABLE I_ZRB_CRHDR
FROM ZRB_CRHDR
WHERE WERKS IN PLANT AND
ZRB_SCHPD IN DATE AND
SPART = DIVISION .

endif.

Vikranth

hello

i m new in abap so please help me in following query.

there are two field on selection screen . REGIO and WERKS

I need to pick the regio and respective werks from T001W the need to pass werks in ZRB_CRHDR then pick all data.

when we leave regio blank and enter WERKS then it goes directly in ZRB_CRHDR and pick all data..

I have written following code but not successful

SELECT

REGIO

WERKS INTO TABLE I_FINAL12

FROM T001W WHERE

REGIO IN REGION .

IF NOT I_FINAL[] IS INITIAL .

SELECT

WERKS

AUART

ZRB_SCHPD

ZRB_STAMT

INTO TABLE I_ZRB_CRHDR

FROM ZRB_CRHDR

FOR ALL ENTRIES IN I_FINAL WHERE

WERKS = I_FINAL-WERKS AND

WERKS IN PLANT AND

ZRB_SCHPD IN DATE AND

SPART = DIVISION .

ENDIF .

please help

thanks in advance

7 REPLIES 7
Read only

Former Member
0 Likes
1,241

Hi,

Well, the name of your internal table is wrong


IF NOT I_FINAL12[] IS INITIAL . "Note

SELECT

WERKS
AUART
ZRB_SCHPD
ZRB_STAMT

INTO TABLE I_ZRB_CRHDR
FROM ZRB_CRHDR
FOR ALL ENTRIES IN I_FINAL12 WHERE "Note
WERKS = I_FINAL12-WERKS AND  "Note
WERKS IN PLANT AND
ZRB_SCHPD IN DATE AND
SPART = DIVISION .

ENDIF .

Read only

0 Likes
1,241

THANKS FOR REPLY BUT IT NOT WORKING.

Read only

0 Likes
1,241

THANKS FOR REPLY BUT IT NOT WORKING.

SELECT

REGIO

WERKS INTO TABLE I_FINAL

FROM T001W WHERE

REGIO IN REGION .

IF NOT I_FINAL[] IS INITIAL .

SELECT

WERKS

AUART

ZRB_SCHPD

ZRB_STAMT

INTO TABLE I_ZRB_CRHDR

FROM ZRB_CRHDR

FOR ALL ENTRIES IN I_FINAL WHERE

WERKS = I_FINAL-WERKS AND

WERKS IN PLANT AND

ZRB_SCHPD IN DATE AND

SPART = DIVISION .

ENDIF .

Read only

0 Likes
1,241

Hi,

-> Check if the internal table I_FINAL is getting populated with values

->

 SPART = DIVISION 

What is this Division? Is this some constant?

-> Are you sure these are the select option names? REGION, PLANT, DATE

Read only

former_member217544
Active Contributor
0 Likes
1,241

Hi Vikram,

You have included two conditions for WERKS:


FOR ALL ENTRIES IN I_FINAL WHERE
WERKS = I_FINAL-WERKS AND
WERKS IN PLANT AND
ZRB_SCHPD IN DATE AND
SPART = DIVISION .

What does Plant contains?

Regards,

Swarna Munukoti.

Read only

0 Likes
1,241

hi swarna

FOR ALL ENTRIES IN I_FINAL WHERE

WERKS = I_FINAL-WERKS AND (1)

WERKS IN PLANT AND (2)

ZRB_SCHPD IN DATE AND

SPART = DIVISION .

plant is selection screen variable

werks is a plant code ..first time (1) it is come from i_final when we enter region in selection screen & second times (2) it come from when we enter code on selection screen "plant " .

plesase read my first post it will help u to resolve ur query...

thanks

Edited by: vikram00797 on Dec 3, 2009 12:58 PM

Read only

Former Member
0 Likes
1,242

Hello,

Try this,



if not regio is initial.

SELECT
REGIO
WERKS INTO TABLE I_FINAL12
FROM T001W WHERE
REGIO IN REGION .

if sy-subrc = 0.

SELECT
WERKS
AUART
ZRB_SCHPD
ZRB_STAMT
INTO TABLE I_ZRB_CRHDR
FROM ZRB_CRHDR
FOR ALL ENTRIES IN I_FINAL WHERE
WERKS = I_FINAL-WERKS AND
ZRB_SCHPD IN DATE AND
SPART = DIVISION .
endif.

else.

SELECT
WERKS
AUART
ZRB_SCHPD
ZRB_STAMT
INTO TABLE I_ZRB_CRHDR
FROM ZRB_CRHDR
WHERE WERKS IN PLANT AND
ZRB_SCHPD IN DATE AND
SPART = DIVISION .

endif.

Vikranth