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: 

urgent help required..

Former Member
0 Kudos

hi experts..

I am checking a condition in my report.

what i want is the report should display the ones only which satisfies the following 3 conditions . But presently its displaying for all the conditions.

My code is as follows. dont know what should i add to display only those 3 conditions. please help me.

IF wa_konv-kschl = 'ZGC1'.

wa_konv-kbetr1 = wa_konv-kbetr.

ELSEIF wa_konv-kschl = 'ZGC2'.

wa_konv-kbetr2 = wa_konv-kbetr.

ELSEIF wa_konv-kschl = 'ZGC3'.

wa_konv-kbetr3 = wa_konv-kbetr.

ENDIF.

if sy-subrc = 0.

wa_final-kbetr1 = wa_final-kbetr1 + wa_konv-kbetr1.

wa_final-kbetr2 = wa_final-kbetr2 + wa_konv-kbetr2.

wa_final-kbetr3 = wa_final-kbetr3 + wa_konv-kbetr3.

endif.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

Try as follows:

IF wa_konv-kschl = 'ZGC1'.

wa_final-kbetr1 = wa_final-kbetr1 + wa_konv-kbetr.

ELSEIF wa_konv-kschl = 'ZGC2'.

wa_final-kbetr2 = wa_final-kbetr2 + wa_konv-kbetr.

ELSEIF wa_konv-kschl = 'ZGC3'.

wa_final-kbetr3 = wa_final-kbetr3 + wa_konv-kbetr.

ENDIF.

3 REPLIES 3

former_member386202
Active Contributor
0 Kudos

Hi,

Do like this

IF wa_konv-kschl = 'ZGC1'.

wa_konv-kbetr1 = wa_konv-kbetr.

wa_final-kbetr1 = wa_final-kbetr1 + wa_konv-kbetr1.

ELSEIF wa_konv-kschl = 'ZGC2'.

wa_konv-kbetr2 = wa_konv-kbetr.

wa_final-kbetr2 = wa_final-kbetr2 + wa_konv-kbetr2.

ELSEIF wa_konv-kschl = 'ZGC3'.

wa_konv-kbetr3 = wa_konv-kbetr.

wa_final-kbetr3 = wa_final-kbetr3 + wa_konv-kbetr3.

ENDIF.

Regards,

PRashant

Former Member
0 Kudos

Hi,

Try as follows:

IF wa_konv-kschl = 'ZGC1'.

wa_final-kbetr1 = wa_final-kbetr1 + wa_konv-kbetr.

ELSEIF wa_konv-kschl = 'ZGC2'.

wa_final-kbetr2 = wa_final-kbetr2 + wa_konv-kbetr.

ELSEIF wa_konv-kschl = 'ZGC3'.

wa_final-kbetr3 = wa_final-kbetr3 + wa_konv-kbetr.

ENDIF.

former_member156446
Active Contributor
0 Kudos

why dont u select only those 3 condition types and move...

select blah blah blaaa

where kschl in ('ZGC1' , 'ZGC2', 'ZGC3').

case wa_konv-kschl

when 'ZGC1'.

wa_konv-kbetr1 = wa_konv-kbetr.

when 'ZGC2'.

wa_konv-kbetr2 = wa_konv-kbetr.

when 'ZGC3'.

wa_konv-kbetr3 = wa_konv-kbetr.

endcase.

or

LOOP AT lt_citm_z2 INTO wa_citm_z2 WHERE

knumv = wa_citm_z1-knumv

AND kposn = wa_citm_z1-posnr.

MOVE wa_citm_z2-kwert TO wa_citm_z-zztobook.

AT NEW knumv.

CLEAR lv_count.

lv_count = 1.

ENDAT.

CASE lv_count.

WHEN 1.

MOVE wa_citm_z2-kschl_06 TO wa_citm_z-kschl_06.

MOVE wa_citm_z2-kbetr_06 TO wa_citm_z-kbetr_06.

WHEN 2.

MOVE wa_citm_z2-kschl_06 TO wa_citm_z-kschl_07.

MOVE wa_citm_z2-kbetr_06 TO wa_citm_z-kbetr_07.

WHEN 3.

MOVE wa_citm_z2-kschl_06 TO wa_citm_z-kschl_08.

MOVE wa_citm_z2-kbetr_06 TO wa_citm_z-kbetr_08.

WHEN 4.

MOVE wa_citm_z2-kschl_06 TO wa_citm_z-kschl_09.

MOVE wa_citm_z2-kbetr_06 TO wa_citm_z-kbetr_09.

WHEN 5.

MOVE wa_citm_z2-kschl_06 TO wa_citm_z-kschl_10.

MOVE wa_citm_z2-kbetr_06 TO wa_citm_z-kbetr_10.

WHEN OTHERS.

MOVE wa_citm_z2-kschl_06 TO wa_citm_z-kschl_06.

MOVE wa_citm_z2-kbetr_06 TO wa_citm_z-kbetr_06.

ENDCASE.

lv_count = lv_count + 1.

APPEND wa_citm_z TO lt_citm_z.

APPEND wa_citm_d TO lt_citm_d.

ENDLOOP.