2008 Dec 22 7:03 AM
Moderator message: do not use ALL CAPITALS in the subject line
Hi Experts,
I have one query in ALL ENTRIES KEYWORD.
Actually I am putting one select query as
SELECT LIFNR LAND1 FROM LFA1 INTO TABLE ITAB FOR ALL ENTRIES IN JTAB WHERE NAME2 = JTAB-NAME2.
Here my JTAB having one entry but the value in field JTAB-NAME2 is blank.
My problem is that i am getting here SY-SUBRC = 4 after the above mentioned query.
Whereas in table LFA1 we have entries where NAME2 equal to blank.
Any idea how I can get here sy-subrc = 0 as we have entry in table LFA1.
Please suggest.
Regards,
Neha
Edited by: Matt on Dec 22, 2008 9:16 AM
Moderator message: do not use ALL CAPITALS in the subject line
Hi Experts,
I have one query in ALL ENTRIES KEYWORD.
Actually I am putting one select query as
SELECT LIFNR LAND1 FROM LFA1 INTO TABLE ITAB FOR ALL ENTRIES IN JTAB WHERE NAME2 = JTAB-NAME2.
Here my JTAB having one entry but the value in field JTAB-NAME2 is blank.
My problem is that i am getting here SY-SUBRC = 4 after the above mentioned query.
Whereas in table LFA1 we have entries where NAME2 equal to blank.
Any idea how I can get here sy-subrc = 0 as we have entry in table LFA1.
Please suggest.
Regards,
Neha
Edited by: Matt on Dec 22, 2008 9:16 AM
2008 Dec 22 7:17 AM
Hi,
u write your code below this manner
SELECT LIFNR LAND1 FROM LFA1 INTO TABLE ITAB
FOR ALL ENTRIES IN JTAB
WHERE
NAME2 = JTAB-NAME2
AND
NAME2 = ' '.
I think your problem will be solve.
Regards
Tarapada D.
2008 Dec 22 7:24 AM
Hi Neha,
Try like this:
SELECT LIFNR LAND1 FROM LFA1 INTO TABLE ITAB FOR ALL ENTRIES IN JTAB WHERE NAME2 = JTAB-NAME2 and NAME2 = ' '.it will take the blank values.Thn i think u will get sy-subrc =0.
Hope it helps.
Regards,
Rahul
2008 Dec 22 7:24 AM
Hello,
When u r writing FOR ALL ENTIERS statement u need check table Is Initail or not...
thank u,
Santhosh
2008 Dec 22 7:25 AM
hi,you can write
SELECT LIFNR LAND1 FROM LFA1 INTO TABLE ITAB
FOR ALL ENTRIES IN JTAB WHERE
NAME2 = JTAB-NAME2 or
NAME2 = space.
thanks
2008 Dec 22 7:52 AM
SELECT LIFNR LAND1 FROM LFA1 INTO TABLE ITAB
FOR ALL ENTRIES IN JTAB WHERE
NAME2 = JTAB-NAME2 and
NAME2 = space.
2008 Dec 22 7:54 AM
Hi Neha,
If u have that Name2 in selection screen , then make it as mandatory .
Or write your query as told by other's before this.
2008 Dec 22 8:04 AM
Please check all the entries in table JTAB .
If in internal table JTAB you find other fields (a part from NAME2 ) desimilar to the entries of LFA1 the query is going to fail.
I am sure this is the reason for Sy-SUBRC = 0.
EX.
As you say NAME2 = ' ' in JTAB the other field of jtab let it be jtab-LIFNR = '10020' .
then in table LFA1 no such entry with field LIFNR = 10020 would be there .even if
its there then its NAME2 field must be having some data.
2008 Dec 22 8:17 AM
2008 Dec 22 8:43 AM
Hi neha,
Remember while using FOR ALL ENTERIES statement the referencing table or field declared with where clause should not be empty. it should have atleast one record. Otherwise System take it as there is no WHERE clause and selects the all records of that client.
Regards,
Vikas
2008 Dec 22 11:56 AM
Hi Neha,
As far as my knowledge goes FOR ALL ENTRIES is a dangerous SQL query since any harm if happens will be for all the entries in the database table.Please be careful and ensure that you mention the where clause.
Now coming to your query
name2 can either be blank or should hold data,
hence its advisable to use the following code
SELECT LIFNR LAND1
FROM LFA1
INTO TABLE ITAB
FOR ALL ENTRIES IN JTAB
WHERE NAME2 = JTAB-NAME2 or NAME2 = ' '.
hope this gives sy-surc = 0,the solution
thanks
srikanth.p
2008 Dec 25 1:12 PM
SELECT matnr werks
FROM marc INTO TABLE i1_marc where matnr IN s_matnr
AND werks in s_werks AND mmsta = '10'.
if not i1_marc is inintial.
SELECT matnr werks
FROM mast INTO TABLE i_mast
for all entries in i1_marc
where matnr = i1_marc-matnr
AND werks = i1_marc-werks.
2008 Dec 26 5:12 AM
data: i1_marc type table of marc with header line.
SELECT matnr werks
FROM marc INTO TABLE i1_marc where matnr IN s_matnr
AND werks in s_werks AND mmsta = '10'.
if not i1_marc[] is inintial.
SELECT matnr werks
FROM mast INTO TABLE i_mast
for all entries in i1_marc
where matnr = i1_marc-matnr
AND werks = i1_marc-werks
thanks and regards.
SWATI GUPTA
Edited by: swati gupta on Dec 26, 2008 6:12 AM
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |