cancel
Showing results for 
Search instead for 
Did you mean: 

abap help

Former Member
0 Kudos

hi folks,

I have two questions.

Here is the code.

select knumv kposn kschl krech kawrt kbetr kwert

from konv into table cdata for all entries in adinvoiceitab where konv~knumv = adinvoiceitab-knumv and

konv~kposn = adinvoiceitab-kposn.

loop at cdata into wac where knumv = wa-knumv.

case wac-kschl.

when 'ZRAT'.

if wac-kbetr = ' ' AND wac-kwert = ' '.

continue.

else.

p = p / 10.

if p < 1.

rate+0(1) = '-'.

endif.

i = p.

c = i.

shift c right deleting trailing '-'.

concatenate rate c '%' into rate.

condense rate no-gaps.

MOVE rate to w_accitab-zrate.

clear rate.

MOVE wac-kwert to w_accitab-zsubtotal.

endif.

Here I loop the data (numeric value) and convert it to character, concatenate % to the number.

My question is if the numeric value is 0 the internal table value should be blank because the value '0' is displaying in the form and I do not want that value.

How to do that?

Second question : From the query it is clearly evident that I am getting the records for various condition types from table KONV the important fields for me is 'kbetr' 'kschl' and 'kwert'.

For this Statement I only want records that have values in 'kbetr' and 'kwert' and how can i modify the query to get only these records and remove the other.

Thanks in advance.

Santhosh

Accepted Solutions (0)

Answers (1)

Answers (1)

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

1) you can check to make sure that you have something other than 0 before building the ZRATE.



<b>     if i = 0.
          clear w_accitab-zrate.
        else.</b>
          i = p.
          c = i.
          shift c right deleting trailing '-'.
          concatenate rate c '%' into rate.
          condense rate no-gaps.
          move rate to w_accitab-zrate.
          clear rate.
<b>        endif.</b>

Regards,

Rich Heilman

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

2)



select knumv kposn kschl krech kawrt kbetr kwert
            from konv
               into table cdata for all entries in adinvoiceitab
                 where konv~knumv = adinvoiceitab-knumv
                   and konv~kposn = adinvoiceitab-kposn
<b>                   and konv~kbetr > 0
                   and konv~kwert > 0.</b>

Regards,

Rich Heilman

Former Member
0 Kudos

check this out...

when 'ZSED'.

if wac-kbetr = ' ' AND wac-kwert = ' '.

continue.

else.

p = wac-kbetr.

p = p / 10.

if p < 1.

rate+0(1) = '-'.

endif.

if i = 0.

clear w_accitab-zrate.

else.

i = p.

c = i.

shift c right deleting trailing '-'.

concatenate rate c '%' into rate.

condense rate no-gaps.

MOVE rate to w_accitab-zrate.

clear rate.

MOVE wac-kwert to w_accitab-zsubtotal.

endif.

when 'ZAC1'.

The error: 'when' is allowed only after the case statement.

Former Member
0 Kudos

The code is working but the '0' continues to come in the form.

Santhosh

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

Then in your form, make sure the code is like this.

&THE_FIELD(Z)&

Regards,

Rich Heilman