‎2009 Feb 04 9:31 AM
Hi,
In my code the value there are 2 values in a internal table.The value in header is 0 but the next two lines have values in it.I have given the codn such that "if the internal table in not initial it must perform some actions" but though the table has value and as the header value is 0 its not performing the action.How to remove the 0 value.I tried with clear also its not working ou
‎2009 Feb 04 9:39 AM
Hi,
You should write the code in below way. Consider ITAB is your internal table.
IF not ITAB[] is initial.
do some processing.
ENDIF.
Remember [] indicates internal table body. Internal table having Header & Body. Header contains one record at a time whereas body can multiple.
Regards,
Amit
‎2009 Feb 04 9:33 AM
hi,
refresh the header..for better solution..please paste ur code..
Rgds.,
subash
‎2009 Feb 04 9:35 AM
Hello Saranya,
You wrote:
if the internal table in not initial it must perform some actions
Try the stmt as:
IF ITAB[] IS NOT INITIAL.
* Code ur logic
ENDIF.
To address the table body instead of the header line in a statement, you can append [] e.g., ITAB[]
For internal tables without header line, the table body is always usedBR,
Suhas
Edited by: Suhas Saha on Feb 4, 2009 3:08 PM
‎2009 Feb 04 9:35 AM
‎2009 Feb 04 9:35 AM
Hi,
You might have declared the internal table with header line..so in that case your condition should be like this ..
IF NOT itab[] IS INITIAL.
" Do processing
ENDIF.
‎2009 Feb 04 9:36 AM
hi,
Make sure that the check your performing is with respect to the body of the table
i.e.
if you are using a internal table with a header line, the condition should go like this
if t_tab[] is not initial.
endif.
where t_tab is a internal table with header line and if the table has got entries in it this condition shall work.
‎2009 Feb 04 9:36 AM
Hi,
Test the following Code hope will solve out your problem,
TYPES: BEGIN OF t_test,
name(50),
END OF t_test.
DATA: it TYPE STANDARD TABLE OF t_test WITH HEADER LINE.
it-name = 'AAA'.
APPEND it TO it.
it-name = 'BBB'.
APPEND it TO it.
it-name = 'CCC'.
APPEND it TO it.
CLEAR: it, " TO clear the Header
it[]. " To Clear the Body.
IF it IS INITIAL.
WRITE: / 'Header is Clear'.
ENDIF.
IF it[] IS INITIAL.
WRITE: / 'Body is Clear'.
ENDIF.Kind Regards,
Faisal
Edited by: Faisal Altaf on Feb 4, 2009 2:38 PM
‎2009 Feb 04 9:43 AM
Code is
loop at gi_final.
clear gi_table.
if gt_table is not initial.
perform process.
endif.
endloop.
the value present in gi_table is
0000 | 000 | 00000000 | 00000000 | 0 | 0.00 |
0071 |**** |*********|** |*******|*******| 0 | 0.00 |
‎2009 Feb 04 9:44 AM
if gt_table is not initial.
right
if gi_table is not initial.
and loop at gi_table only to have value in the header.
Cheers,
Surinder
Edited by: SURINDER SINGH OBEROI on Feb 4, 2009 3:15 PM
‎2009 Feb 04 9:48 AM
Have declared gt_final as internal table as
DATA: BEGIN OF gt_final OCCURS 0,
some fields
end of gt_final
‎2009 Feb 04 9:50 AM
hi,
taking gt_final as ur internal table,
gt_table as ur header...
so in order to check whether ur internal table has values or not..
u should write
if gt_final[] is not initial.
perform process..
endif..
to clear 0's in ur header , u can refresh it...
Rgds.,
subash
‎2009 Feb 04 9:54 AM
‎2009 Feb 04 9:37 AM
‎2009 Feb 04 9:38 AM
Hi Saranya,
As far as i have understood you are using a table with header line....
If so.... then please check if your condition with if is similar to the one give below
data: itab type table of <structure_name> with header line.
if itab[] is not initial.
your statement follows here *****
endif.
hope this resolves your issue
Regards,
Siddarth
‎2009 Feb 04 9:39 AM
Hi,
You should write the code in below way. Consider ITAB is your internal table.
IF not ITAB[] is initial.
do some processing.
ENDIF.
Remember [] indicates internal table body. Internal table having Header & Body. Header contains one record at a time whereas body can multiple.
Regards,
Amit