‎2014 Nov 05 2:07 AM
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!
‎2014 Nov 05 2:14 AM
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
‎2014 Nov 05 2:14 AM
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
‎2014 Nov 05 3:00 AM
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?
‎2014 Nov 05 3:02 AM
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.
‎2014 Nov 05 4:52 AM
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.
‎2014 Nov 05 5:09 AM
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
‎2014 Nov 05 5:07 AM
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.
‎2014 Nov 05 5:16 AM
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
‎2014 Nov 05 5:41 AM
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
‎2014 Nov 05 6:03 AM
The one you have coded should be fine.
IF not sy-subrc is initial is same as if sy-subrc <> 0