Application Development 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: 

Need Help with CALL FUNCTION 'HR_TIME_RESULTS_GET'

Former Member
0 Kudos
443

Hi

I am using this function to get ZL and some other table from B2 Structure.

CALL FUNCTION 'HR_TIME_RESULTS_GET'
   EXPORTING
     get_pernr = PERNR-PERNR
     get_pabrj = it_t549q-pabrj
     get_pabrp = it_t549q-pabrp
   TABLES
     GET_TBUFF     = TGETBUFF
     get_zl = it_zl
     get_pt = it_PT
     get_alp = it_ALP
     get_c1 = it_C1
   EXCEPTIONS
     no_period_specified = 1
     wrong_cluster_version = 2
     no_read_authority = 3
     cluster_archived = 4
     technical_error = 5.

My problem is I want to do some thing if the IT_ZL or IT_PT tables returned empty. In other words there r no data for the parameter I passed.

Can anyone tell me what should be the code? I am using this


IF it_ZL EQ '' And it_PT EQ ''.
ELSE.
ENDIF.

But its not catching it.

Please help.

1 ACCEPTED SOLUTION

Former Member
0 Kudos
190

change this way...

IF it_ZL[] is initial And it_PT[] is itinaitl.

ELSE.

ENDIF.

as these are internal tables u have write conditions as above.

8 REPLIES 8

Former Member
0 Kudos
191

change this way...

IF it_ZL[] is initial And it_PT[] is itinaitl.

ELSE.

ENDIF.

as these are internal tables u have write conditions as above.

0 Kudos
190

it gives me an erorr... can't recognise 'IS'

Message was edited by:

Anwarul Kabir

0 Kudos
190

Actually its working but its catching for all condintion...

I mean even if there are data in ZL and PT it says Zl is Initial and pt is Initial and does what it suppose to do when they r empty and never does the thing it suppose to do when they are not empty.

Former Member
0 Kudos
190

IF it_ZL[] is initial and it_PT[] is initial.

write whatever u want.

ELSEIF not it_ZL[] is initial and not it_pt[] is initial.

write ur code.

ELSEIF not it_ZL[] is initial or not it_pt[] is initial.

write ur code.

ENDIF.

This way it is working for me...

REWARD POINTS....

Message was edited by:

Ramesh Babu Chirumamilla

0 Kudos
190

IF it_ZL[] is initial and it_PT[] is initial.

This will be true when they are empty?

Or this will

ELSEIF not it_ZL[] is initial and not it_pt[] is initial.

0 Kudos
190

IN debug mode

When its returning empty or not In the filed mode it shows

ZL = Non-charlike structure

PT = 000000000000000000 (When Empty)

PT= 2007..... (WHen Not empty)

Why is it doing this? When there r data in ZL in Table mode it shows all data but in field mode it shows the message...

Former Member
0 Kudos
190

hi

good

wrong->

IF it_ZL EQ '' And it_PT EQ ''.

ELSE.

ENDIF.

right->

IF NOT it_ZL EQ IS INITIAL AND NOT it_PT IS NOT INITIAL.

ELSE.

ENDIF.

thanks

mrutyun^

Former Member
0 Kudos
190

Solved it another way by using a local variable and changing the flag when it goes in the loop and when it doesn't


FLAG = 0.
CALL FUNCTION 'HR_TIME_RESULTS_GET'
   EXPORTING
     get_pernr = PERNR-PERNR
     get_pabrj = it_t549q-pabrj
     get_pabrp = it_t549q-pabrp
   TABLES
     GET_TBUFF     = TGETBUFF
     get_zl = it_zl
     get_pt = it_PT
     get_alp = it_ALP
     get_c1 = it_C1
   EXCEPTIONS
     no_period_specified = 1
     wrong_cluster_version = 2
     no_read_authority = 3
     cluster_archived = 4
     technical_error = 5.

  LOOP AT it_pt.
         FLAG = 1.
         DO stuff with the data...
  ENDLOOP.
  If Flag =0.
    DO STuff with Empty Table...
  End if

Message was edited by:

Anwarul Kabir