2016 Jun 08 12:50 PM
Hi All,
I have developed a report report which displays work orders with input as Order Number , Type , Plant , Status Inclusive and Status exclusive.
Status can be System status and system status.
We have written code as follows:
*status check-> status inclusive
IF s_stai1 IS NOT INITIAL.
*** user status
SELECT a~objnr
FROM jest AS a INNER JOIN tj30t AS b
ON a~stat = b~estat
INTO TABLE lt_stat_inc
FOR ALL ENTRIES IN gt_viaufks
WHERE a~objnr = gt_viaufks-objnr
AND a~inact = ' '
AND b~txt04 IN s_stai1.
****system status
SELECT a~objnr
FROM jest AS a INNER JOIN tj02t AS b
ON a~stat = b~istat
APPENDING TABLE lt_stat_inc
FOR ALL ENTRIES IN gt_viaufks
WHERE a~objnr = gt_viaufks-objnr
AND a~inact = ' '
AND b~txt04 IN s_stai1.
IF lt_stat_inc IS NOT INITIAL.
ls_selopt-sign = 'I'.
ls_selopt-option = 'EQ'.
LOOP AT lt_stat_inc INTO ls_stat.
ls_selopt-low = ls_stat-objnr.
APPEND ls_selopt TO lt_selopt.
CLEAR: ls_selopt-low,ls_stat.
ENDLOOP.
IF NOT lt_selopt IS INITIAL.
**delete the entries from that
DELETE gt_viaufks WHERE objnr NOT IN lt_selopt.
CLEAR : lt_selopt.
ENDIF.
ENDIF." status exclusive
ENDIF ."if selection passed
*status exclusive
IF s_stae1 IS NOT INITIAL.
*user status
SELECT a~objnr
FROM jest AS a INNER JOIN tj30t AS b
ON a~stat = b~estat
INTO TABLE lt_stat_exc
FOR ALL ENTRIES IN gt_viaufks
WHERE a~objnr = gt_viaufks-objnr
AND a~inact = ' '
AND b~txt04 IN s_stae1.
*system status
SELECT a~objnr
FROM jest AS a INNER JOIN tj02t AS b
ON a~stat = b~istat
APPENDING TABLE lt_stat_exc
FOR ALL ENTRIES IN gt_viaufks
WHERE a~objnr = gt_viaufks-objnr
AND a~inact = ' '
AND b~txt04 IN s_stae1.
IF lt_stat_exc IS NOT INITIAL.
ls_selopt-sign = 'I'.
ls_selopt-option = 'EQ'.
LOOP AT lt_stat_exc INTO ls_stat.
ls_selopt-low = ls_stat-objnr.
APPEND ls_selopt TO lt_selopt.
CLEAR: ls_selopt-low,ls_stat.
ENDLOOP.
IF NOT lt_selopt IS INITIAL.
**delete the entries from that
DELETE gt_viaufks WHERE objnr IN lt_selopt.
CLEAR : lt_selopt.
ENDIF.
ENDIF."status exclusive
ENDIF."if selection passed
I have given input as
Inclusive : System status - 2RTS
Exclusive : User status CRTD
Now issue is it is not giving right output as i have given user status as CRTD but there is system status also CRTD .
so it is giving output having system status and user status as CRTD. It should not fetch orders which is having CRTD as system status.
Please help.
Thanks,
Arpita
2016 Jun 17 7:42 AM
issue Solved.
I am using BAPI_ALM_ORDER_GET_DETAIL to get the user status and system status in ls_header.
and then i am comparing the value from BAPI with Inclusive and Exclusive values from selection screen S_INCL1 and S_EXCL1 with system status and user status.
If S_INCL1 is present IS IN ls_header- sys_status OR ls_header- userstatus IS IN S_INCL1 then process that order.
If S_INCL1 is present IS NOT IN ls_header- sys_status OR ls_header- userstatus IS NOT IN S_INCL1 then don't process that record.
simillarly for Exclusive S_EXCl1.
Thanks,
Arpita
2016 Jun 08 1:05 PM
Hi,
Its purely based on your conditions, check your internal table data by debugging the program. May be you are missing/wrongly written some conditions to delete the status.
Regards,
Venu
2016 Jun 08 1:06 PM
When selecting
Also JEST-STAT begins with 'I' for internal/system status, 'E' for external/user status. Nevertheless,
in Customizing don't mess internal/system with external/user codes for every implemented language, There are some OSSnotes on this.
Regards,
Raymond
2016 Jun 13 6:08 AM
Arpita
Your task will be easier, if you make use of fm STATUS_READ.
2016 Jun 17 7:42 AM
issue Solved.
I am using BAPI_ALM_ORDER_GET_DETAIL to get the user status and system status in ls_header.
and then i am comparing the value from BAPI with Inclusive and Exclusive values from selection screen S_INCL1 and S_EXCL1 with system status and user status.
If S_INCL1 is present IS IN ls_header- sys_status OR ls_header- userstatus IS IN S_INCL1 then process that order.
If S_INCL1 is present IS NOT IN ls_header- sys_status OR ls_header- userstatus IS NOT IN S_INCL1 then don't process that record.
simillarly for Exclusive S_EXCl1.
Thanks,
Arpita