2007 Feb 05 4:47 PM
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.
2007 Feb 05 4:52 PM
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.
2007 Feb 05 4:52 PM
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.
2007 Feb 05 5:02 PM
it gives me an erorr... can't recognise 'IS'
Message was edited by:
Anwarul Kabir
2007 Feb 05 5:17 PM
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.
2007 Feb 05 5:20 PM
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
2007 Feb 05 6:18 PM
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.
2007 Feb 05 6:24 PM
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...
2007 Feb 05 5:23 PM
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^
2007 Feb 05 6:33 PM
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