‎2009 Sep 01 5:40 AM
Hello Experts,
I am working on PM module where I am preparing a report for ATPCHECK.
My select statement is not working.
I have to select all the active status from jest table.
select STAT from JEST into itab-STAT where objnr = ITAB-objnr
AND INACT eq 'X'.But than I need to apply a check where I just need 2 active status 'I0002' and 'I0340'.
Is there a way to select all active status fields and than just these 2 active fields.
Thanks and Regrds,
Nikhil.
‎2009 Sep 01 5:50 AM
Hi,
Check this if it helps,
data: begin of i_stat occurs 0,
objnr like jest-objnr,
stat like jest-stat,
end of i_stat.
select OBJNR STAT
from JEST
into table i_stat
for all entries in itab
where objnr = ITAB-objnr
AND INACT NE 'X'. " If you want to get the active status.
loop at i_stat where stat = 'I0002' OR stat = 'I0340'.
read table itab with key objnr = i_stat-objnr.
if sy-subrc = 0.
move-corresponding it_stat to itab.
modify itab index sy-index.
endif.
endloop.
Regards,
Vikranth
endloop
‎2009 Sep 01 5:49 AM
Use FM STATUS_READ
Import Parameters Value
CLIENT 180
OBJNR
ONLY_ACTIVE 'X'
Tables Value
STATUS 0 EntriesThen DELETE ITAB where STAT NOT IN ('I0002' , 'I0340)'
‎2009 Sep 01 5:50 AM
SELECT pobjnr ppspnr pvbukr ppost1 pzzmattermanager pzzclient qstat qinact
INTO TABLE gt_proj_temp
FROM ( proj AS p INNER JOIN jest AS q ON pobjnr = qobjnr )
WHERE zzmattermanager IN so_pernr AND
( qstat = 'E0010' OR qstat = 'E0015') AND q~inact = ' '.
IF sy-subrc = 0.
SELECT kunnr name1
INTO TABLE gt_kna1
FROM kna1
FOR ALL ENTRIES IN gt_proj_temp
WHERE kunnr = gt_proj_temp-zzclient.
LOOP AT gt_proj_temp INTO gs_proj_temp.
READ TABLE gt_kna1 INTO gs_kna1 WITH KEY kunnr = gs_proj_temp-zzclient.
IF sy-subrc = 0.
gs_proj-objnr = gs_proj_temp-objnr.
gs_proj-pspnr = gs_proj_temp-pspnr.
gs_proj-vbukr = gs_proj_temp-vbukr.
gs_proj-post1 = gs_proj_temp-post1.
gs_proj-zzmattermanager = gs_proj_temp-zzmattermanager.
gs_proj-kunnr = gs_kna1-kunnr.
gs_proj-name1 = gs_kna1-name1.
APPEND gs_proj TO gt_proj.
CLEAR gs_proj.
ENDIF.
ENDLOOP.
ENDIF.
IF gv_lines = 0.
MESSAGE e003(z01).
ENDIF.
IF NOT gt_proj[] IS INITIAL.
SELECT pernr ename FROM pa0001 INTO TABLE gt_pa0001
FOR ALL ENTRIES IN gt_proj
WHERE pernr = gt_proj-zzmattermanager.
ENDIF.
ENDIF.
IF NOT gt_proj[] IS INITIAL.
SELECT objnr stat INTO TABLE gt_jest FROM jest
FOR ALL ENTRIES IN gt_proj
WHERE objnr = gt_proj-objnr AND stat = 'I0046' AND inact = ' '.
ENDIF.
‎2009 Sep 01 5:50 AM
Hi,
Check this if it helps,
data: begin of i_stat occurs 0,
objnr like jest-objnr,
stat like jest-stat,
end of i_stat.
select OBJNR STAT
from JEST
into table i_stat
for all entries in itab
where objnr = ITAB-objnr
AND INACT NE 'X'. " If you want to get the active status.
loop at i_stat where stat = 'I0002' OR stat = 'I0340'.
read table itab with key objnr = i_stat-objnr.
if sy-subrc = 0.
move-corresponding it_stat to itab.
modify itab index sy-index.
endif.
endloop.
Regards,
Vikranth
endloop
‎2009 Sep 01 5:50 AM
Hi,
Is there any value in itab-objnr, while your select is getting executed.
Probably you need to specify some parameter/select-options from selection screen or a hard-coded value.
Check it in debug mode, if itab is already populated, check if you have itab-objnr in header, else you would need to loop/read it.
Regards,
Amit
‎2009 Sep 01 5:55 AM
Hi,
In the select statement make the changes as shown.
loop at itab.
select STAT from JEST appending corresponding fields of table ITAB for all entries in ITAB
where objnr = itab-objnr
and INACT = 'X'.
endloop.
then use loop at statemnt with where condition.
Regards,
Rajesh Kumar
‎2009 Sep 01 8:27 AM
‎2009 Sep 01 9:34 AM
Hi,
PLz try this code.
select OBJNR STAT
from JEST
into table i_stat
for all entries in itab
where objnr = ITAB-objnr
AND INACT NE 'X'
AND stat in ('I0002','I0340').
Regards,
Archana