2009 Dec 03 11:33 AM
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
2009 Dec 03 12:04 PM
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
2009 Dec 03 11:39 AM
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 .
2009 Dec 03 11:41 AM
2009 Dec 03 11:48 AM
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 .
2009 Dec 03 11:51 AM
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
2009 Dec 03 11:50 AM
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.
2009 Dec 03 11:56 AM
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
2009 Dec 03 12:04 PM
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
| User | Count |
|---|---|
| 6 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |