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

internal table

Former Member
0 Likes
629

Suppose I have an internal table in which for some records all the columns are zero. I don’t want to display this records having zero values for all the columns in the final output. How do we do it?

7 REPLIES 7
Read only

JozsefSzikszai
Active Contributor
0 Likes
593

hi Jamnun,

you did not mention, if you display the content of the internal table the classical way or with ALV...

classic:

LOOP AT itab WHERE field NE 0.

WRITE ...

ENDLOOP.

ALV:

you have to delete the entries from the internal table before passing to the FM.

hope this helps

ec

Read only

Former Member
0 Likes
593

Jamnun,

As per ur Question,

U have an Internal Table with Some fields,Among that fields , Some of them are Null values.

If U know that fields,which r having Null values, filter those fields(Using Codition) at the Write Statement in the End-of-selection.

Hope It s Helpful.

Thanks,

Shiva

Read only

0 Likes
593

Use this function Module

CONVERSION_EXIT_MATN1_OUTPUT.

ex.

DATA: v_number TYPE N.

v_number = 00000000009.

CALL FUNCTION 'CONVERSION_EXIT_MATN1_OUTPUT

EXPORTING

input = v_number

IMPORTING

output = v_number_aux.

write: v_number_aux.

Regards, Balbino

Read only

Former Member
0 Likes
593

You can use this way

data: begin of it_vbap occurs 0,

vbeln type vbap-vbeln,

netwr type vbap-netwr,

end of it_vbap.

select vbeln netwr from vbap into table it_vbap up to 50 rows.

data: count type sy-tabix.

loop at it_vbap.

count = sy-tabix.

if it_vbap-netwr is initial.

delete it_vbap index count.

endif.

endloop.

loop at it_vbap.

write: it_vbap-vbeln, it_vbap-netwr.

endloop.

Read only

Former Member
0 Likes
593

Hi,

I think what you can do is, first delete those particular records from the internal table prior to diplaying them in the output.One way to do that would be to use the keyword 'DELETE'.

An e.g. would be:

Delete itab from wa where f1 = space f2 -= space f3 = space and so on.I think you have to check for all the fields and then only delete the row.The reason for this being that at any time any other record can have any field empty so you just can check for some fields.You have check for all the fields being empty and then delete it.

Hope it works,

Thanks,

Sandeep.

Read only

Former Member
0 Likes
593

There are two ways:

1. Add another column in the internal table and keep the sum value there of all the columns and while writing check if this new field is not ZERO write otherwise don't.

2. Declare a another parameter type CHAR(1) and While writing (looping....) check if any one field has NON ZERO, set this flag and write the values then reset the flag otherwise don't.

Hope it helps.

Read only

Former Member
0 Likes
593

Hi,

You can do as below:


loop at itab.
"Assuming if dmbtr is equal to zero then that line items should not be displayed.

   if itab-dmbtr eq 0.
     delete itab.
     clear itab.
     exit.
  else.
     write : itab-fieldnames.
  endif.

endloop.

Thanks,

Sriram POnna.