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

Retrieving the Process type

former_member699182
Participant
0 Likes
1,674

Hello All,

I have a requirement to retrieve the Process Type (DIA, UPD, BGD, etc - the ones u see under type column in Process Overview SM50)

and check in a program if the type BGD exists or not.

Is the information stored in some table (I assume it is kernel information as I couldnt trace it but not sure).

How do i go about it?

Any ideas please?

Thanks!


1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,626

Hi Gita,

Use function module TH_WPINFO and you will get an output table WPLIST which will have your desired result and in that table you can use a READ statement with your program name matching field W_REPORT and you can check if it is run in background from field WP_TYP. Hope this helps.

Thanks,

Naveen

9 REPLIES 9
Read only

Former Member
0 Likes
1,627

Hi Gita,

Use function module TH_WPINFO and you will get an output table WPLIST which will have your desired result and in that table you can use a READ statement with your program name matching field W_REPORT and you can check if it is run in background from field WP_TYP. Hope this helps.

Thanks,

Naveen

Read only

0 Likes
1,626

Thank you Naveen. The exporting param has an SRVNAME which i assume is the app server name. Do u know how to determine the app server name?

Read only

0 Likes
1,626

I think you can leave it blank and it does bring the data. And when you leave blank then the system brings the default which is the system that we are executing the function. That is my understanding.

Read only

0 Likes
1,626

I would like to display NG if atleast one BGD type is present and display OK if no BGD type is present.

(OK or NG only once in the screen)

READ TABLE t_wplist WITH KEY WP_TYP = 'BGD' TRANSPORTING NO FIELDS.

IF SY-SUBRC = 0.

WRITE: 'NG'.

ELSE.

WRITE: 'OK'.

ENDIF.

Tried using read table instead of using loop at or work area but dont seem to get it right.

The read table does not read all the rows isnt it??

Please help.

Read only

0 Likes
1,626

Hi Gita,

Read table scans the entire internal table and finds the first successful record based on the condition.

And as per your code it should work. Could you paste your exact code that you used and I can check if there is anything missing.

Thanks,

Naveen

Read only

former_member699182
Participant
0 Likes
1,626

Changed the source as given below.

NG works fine since there are BGD type processes but not sure if OK will work fine since I cdnt check it.

OK should be executed if there is no BGD process type.

Is the logic correct?

LOOP AT t_wplist.

IF t_wplist-wp_typ <> 'BGD'.

  CONTINUE.

ELSE.

   WRITE: 'NG'.

   EXIT.

ENDIF.

   WRITE: 'OK'.

ENDLOOP.

Thanks.

Read only

0 Likes
1,626

You can use like below:

LOOP AT t_wplist where wp_typ <> 'BGD'.

write : 'OK'.

EXIT.

ENDLOOP.

if not sy-subrc is initial

WRITE: 'NG'.

Endif

Read only

0 Likes
1,626

Naveen, will this not write OK and then exit when it encounters a wp_typ that is not BGD?

I actually want it to search the loop until it encounters BGD and if it does then print NG and exit. Else, print OK.

How about the below way? Though am not sure what the "IF NOT SY-SUBRC IS INITIAL" means. Is it the same as IF SY-SUBRC <> 0?

LOOP AT t_wplist where wp_typ = 'BGD'.

  WRITE : 'NG'.

  EXIT.

ENDLOOP.

  IF NOT SY-SUBRC IS INITIAL.

  WRITE: 'OK'.

ENDIF.

Thanks

Read only

0 Likes
1,626

The one you have coded should be fine.

IF not sy-subrc is initial is same as if sy-subrc <> 0