2009 Sep 02 8:07 AM
Hello Experts,
My if condition is not working is there some syntax i am missing.
SELECT a~aufnr
a~auart
a~objnr
a~werks
b~stat
C~RSNUM
D~KZEAR
D~XLOEK INTO CORRESPONDING FIELDS OF TABLE itab
FROM aufk AS A JOIN jest AS B
ON a~objnr EQ b~objnr
INNER JOIN AFKO AS C ON C~AUFNR = A~AUFNR
INNER JOIN RESB AS D ON D~RSNUM = C~RSNUM
WHERE a~aufnr IN s_aufnr AND
b~stat IN ('I0002','I0340').from here i get my itab-kzear = X AND ITAB-XLOEK =X
if itab-kzear eq 'X' OR ITAB-XLOEK eq 'X'.
SELECT a~aufnr
a~auart
a~objnr
a~werks
b~stat
C~RSNUM
D~KZEAR
D~XLOEK INTO CORRESPONDING FIELDS OF TABLE itab
FROM aufk AS A JOIN jest AS B
ON a~objnr EQ b~objnr
INNER JOIN AFKO AS C ON C~AUFNR = A~AUFNR
INNER JOIN RESB AS D ON D~RSNUM = C~RSNUM
WHERE a~aufnr IN s_aufnr AND
b~stat IN ('I0002','I0340', 'I0045').
ENDIF.Please let me kno what can be done.
Thanks and Regrds,
Nikhil.
Hello Experts,
My if condition is not working is there some syntax i am missing.
SELECT a~aufnr
a~auart
a~objnr
a~werks
b~stat
C~RSNUM
D~KZEAR
D~XLOEK INTO CORRESPONDING FIELDS OF TABLE itab
FROM aufk AS A JOIN jest AS B
ON a~objnr EQ b~objnr
INNER JOIN AFKO AS C ON C~AUFNR = A~AUFNR
INNER JOIN RESB AS D ON D~RSNUM = C~RSNUM
WHERE a~aufnr IN s_aufnr AND
b~stat IN ('I0002','I0340').from here i get my itab-kzear = X AND ITAB-XLOEK =X
if itab-kzear eq 'X' OR ITAB-XLOEK eq 'X'.
SELECT a~aufnr
a~auart
a~objnr
a~werks
b~stat
C~RSNUM
D~KZEAR
D~XLOEK INTO CORRESPONDING FIELDS OF TABLE itab
FROM aufk AS A JOIN jest AS B
ON a~objnr EQ b~objnr
INNER JOIN AFKO AS C ON C~AUFNR = A~AUFNR
INNER JOIN RESB AS D ON D~RSNUM = C~RSNUM
WHERE a~aufnr IN s_aufnr AND
b~stat IN ('I0002','I0340', 'I0045').
ENDIF.Please let me kno what can be done.
Thanks and Regrds,
Nikhil.
2009 Sep 02 8:11 AM
Hi,
ITAB is an internal table. How can you use that directly in the IF statemetn.
You need to pass it to the work area and use it in the IF statement
Regards
Ansari
2009 Sep 02 8:11 AM
HI,
You have put if condition on internal table your internal table should be with header line to work your code.
check internal table with header line.
other wise use work area. & put loop on internal table or use read table statment to populate work area.
Regards,
Rahul Wagh
2009 Sep 02 8:17 AM
Hi, Nikhil
Use the Logic Bellow hope will solve out your problem,
DATA: select_ok(2).
READ TABLE itab WITH KEY kzear = 'X'. " Add These Lines of Code Just After 1st Select
IF sy-subrc EQ 0.
select_ok = 'OK'.
ENDIF.
READ TABLE itab WITH KEY xloek = 'X'.
IF sy-subrc EQ 0.
select_ok = 'OK'.
ENDIF.
IF select_ok = 'OK'.
* do your 2nd Select Here
ENDIF.Please reply back if not solve.
Best Regards,
Faisal
2009 Sep 02 8:18 AM
Hi,
Try this way,
SELECT a~aufnr
a~auart
a~objnr
a~werks
b~stat
C~RSNUM
D~KZEAR
D~XLOEK INTO CORRESPONDING FIELDS OF TABLE itab
FROM aufk AS A JOIN jest AS B
ON a~objnr EQ b~objnr
INNER JOIN AFKO AS C ON C~AUFNR = A~AUFNR
INNER JOIN RESB AS D ON D~RSNUM = C~RSNUM
WHERE a~aufnr IN s_aufnr AND
b~stat IN ('I0002','I0340').
loop at itab.
if itab-kzear = X AND ITAB-XLOEK =X.
SELECT single a~aufnr
a~auart
a~objnr
a~werks
b~stat
C~RSNUM
D~KZEAR
D~XLOEK APPENDING TABLE itab
FROM aufk AS A JOIN jest AS B
ON a~objnr EQ b~objnr
INNER JOIN AFKO AS C ON C~AUFNR = A~AUFNR
INNER JOIN RESB AS D ON D~RSNUM = C~RSNUM
WHERE a~aufnr IN s_aufnr AND
b~stat IN ('I0002','I0340', 'I0045').
endif.
endloop.
Regards,
Vikranth
2009 Sep 02 8:27 AM
hi Vikrant,
Its not working it does not accept appending table in joins
Thanks,
Nikhil.
Hi Fiasal,
Your statemnent is working will debugg it and let you know if my report wrks properly
Thanks,
Nikhil.
2009 Sep 02 8:35 AM
Hello NIkhil,
Can you please explain what exactly are you trying to achieve through this coding (i mean the business requirement)?
May be this will help us in suggesting a better solution.
Awaiting your response.
BR,
Suhas
2009 Sep 02 8:38 AM
>
> Hi Fiasal,
>
> Your statemnent is working will debugg it and let you know if my report wrks properly
>
> Thanks,
>
> Nikhil.
If no than Please Explain Your Requirement for the 2nd Select
Regard,
Faisal
2009 Sep 02 8:47 AM
Hello Suhas,
My business requirement is that I have to book the number of PM orders checking it from RESB tABLE.
I get my order no from afko table field name aufnr than I need to take reservation no rsnum from resb and compare it.
Than checking from rsnum in resb I need to check the positions from table resb field name if RESB-KZEAR = u2018Xu2019 RESB-XLOEK =
X.
If these fields found are X than I need to set a status from Jest table
stat = I0045.
I am working on Pm Module.
Hope its clear now.
Thanks and Regrds,
Nikhil.
2009 Sep 02 8:21 AM
hi nikhil,
add these two condition to your where condition of select statement.
2009 Sep 02 8:28 AM
hi,
You have to use your 2nd select query inside the loop at itab.
loop at itab where kzear =X OR kloek = X.
SELECT single a~aufnr
a~auart
a~objnr
a~werks
b~stat
C~RSNUM
D~KZEAR
D~XLOEK APPENDING TABLE itab
FROM aufk AS A JOIN jest AS B
ON aobjnr EQ bobjnr
INNER JOIN AFKO AS C ON CAUFNR = AAUFNR
INNER JOIN RESB AS D ON DRSNUM = CRSNUM
WHERE a~aufnr IN s_aufnr AND
b~stat IN ('I0002','I0340', 'I0045').
endloop.
hope it will work.
regards,
Lokesh
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |