Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

custom program for work order data

arpita_churi3
Active Participant
0 Likes
888

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

1 ACCEPTED SOLUTION
Read only

arpita_churi3
Active Participant
0 Likes
833

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

4 REPLIES 4
Read only

Former Member
0 Likes
832

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

Read only

RaymondGiuseppi
Active Contributor
0 Likes
832

When selecting

  • Text table: add the language code, 4 char text is language dependent
  • User/External stauts add the status profile (table JSTO to identify from OBJNR, and add the key to TJ30* tables)

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

Read only

jogeswararao_kavala
Active Contributor
0 Likes
832

Arpita

Your task will be easier, if you make use of fm STATUS_READ.

Read only

arpita_churi3
Active Participant
0 Likes
834

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