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

help on this report

Former Member
0 Likes
603

Hi,

I wrote this report discount analysis, when I debug it is showing values in 'getdata' but not in 'processdata'. Can you pl look at my code and let me know what is wrong with it. when i execute , it is giving '0' as value, but correct no of records.

pl help me.

Thanks

Veni.

REPORT ZSD_DISCOUNT_ANALYSIS .

TOP-OF-PAGE.

WRITE 3 'Discount Analysis'

COLOR COL_HEADING.

ULINE.

************************************************************************

  • T A B L E S *

************************************************************************

tables: vbrk, konv.

----


  • GLOBAL DATA

----


data: x type i, y type i, l type i.

data: g_repid like sy-repid.

data:begin of it_vbrk occurs 0,

vbeln like vbrk-vbeln,

knumv like vbrk-knumv,

fkdat like vbrk-fkdat,

end of it_vbrk.

data:begin of it_konv occurs 0,

knumv like konv-knumv,

kschl like konv-kschl,

kwert like konv-kwert,

kunnr like konv-kunnr,

end of it_konv.

data: begin of it_output occurs 0,

vbeln like vbrk-vbeln,

kwert like konv-kwert,

end of it_output.

************************************************************************

  • S E L E C T I O N S C R E E N *

************************************************************************

selection-screen: begin of block b1 with frame title text-001.

select-options:

s_vbeln for vbrk-vbeln,

s_fkdat for vbrk-fkdat,

s_kschl for konv-kschl,

s_kunnr for konv-kunnr,

s_knumv for konv-knumv.

selection-screen: end of block b1.

----


  • START-OF-SELECTION

----


start-of-selection.

perform get_data.

perform process_data.

perform display_data.

----


  • END-OF-SELECTION

----


end-of-selection.

&----


*& Form get_data

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


form get_data.

  • Get data from VBRK

select vbeln

knumv

fkdat

from vbrk

into table it_vbrk

where vbeln in s_vbeln

and fkdat in s_fkdat.

  • Get data from KONV

select knumv

kschl

kwert

kunnr

from konv

into table it_konv

where kschl in s_kschl

  • and kunnr in s_kunnr

and knumv in s_knumv.

endform. " get_data

&----


*& Form process_data

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM process_data.

loop at it_vbrk.

read table it_konv

WITH KEY knumv = it_vbrk-knumv.

if sy-subrc = 0.

move konv-kwert to it_output-kwert.

move vbrk-vbeln to it_output-vbeln.

append it_output.

clear it_output.

endif.

endloop.

ENDFORM. "process_data

*& Form display_data

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


form display_data.

define new_grid.

y = sy-linno. y = y + 2.

skip to line y.

x = sy-colno. position x. write '|'.

end-of-definition.

define write_grid.

x = sy-colno. y = sy-linno. position x.

write: &1, '|'.

l = sy-colno - x + 1.

x = x - 2. y = y + 1. skip to line y. position x.

uline at x(l).

y = y - 1. x = sy-colno. skip to line y. position x.

end-of-definition.

FORMAT COLOR COL_HEADING.

write:/1 'Billing Document',

20 'Condition Value'.

  • skip 1.

loop at it_output.

format color COL_TOTAL.

new_grid.

write_grid: it_output-vbeln,

it_output-kwert.

format color off.

endloop.

endform. " display_data

1 ACCEPTED SOLUTION
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
583

This doesn't see right to me.




FORM process_data.
loop at it_vbrk.
read table it_konv
WITH KEY knumv = it_vbrk-knumv.
if sy-subrc = 0.
<b>move konv-kwert to it_output-kwert.
move vbrk-vbeln to it_output-vbeln.</b>
append it_output.
clear it_output.
endif.
endloop.
ENDFORM. "process_data


Shouldn't it be.....




FORM process_data.
loop at it_vbrk.
read table it_konv
WITH KEY knumv = it_vbrk-knumv.
if sy-subrc = 0.
<b>move it_konv-kwert to it_output-kwert.
move it_vbrk-vbeln to it_output-vbeln.</b>
append it_output.
clear it_output.
endif.
endloop.
ENDFORM. "process_data

Regards,

Rich Heilman

Hi,

I wrote this report discount analysis, when I debug it is showing values in 'getdata' but not in 'processdata'. Can you pl look at my code and let me know what is wrong with it. when i execute , it is giving '0' as value, but correct no of records.

pl help me.

Thanks

Veni.

REPORT ZSD_DISCOUNT_ANALYSIS .

TOP-OF-PAGE.

WRITE 3 'Discount Analysis'

COLOR COL_HEADING.

ULINE.

************************************************************************

  • T A B L E S *

************************************************************************

tables: vbrk, konv.

----


  • GLOBAL DATA

----


data: x type i, y type i, l type i.

data: g_repid like sy-repid.

data:begin of it_vbrk occurs 0,

vbeln like vbrk-vbeln,

knumv like vbrk-knumv,

fkdat like vbrk-fkdat,

end of it_vbrk.

data:begin of it_konv occurs 0,

knumv like konv-knumv,

kschl like konv-kschl,

kwert like konv-kwert,

kunnr like konv-kunnr,

end of it_konv.

data: begin of it_output occurs 0,

vbeln like vbrk-vbeln,

kwert like konv-kwert,

end of it_output.

************************************************************************

  • S E L E C T I O N S C R E E N *

************************************************************************

selection-screen: begin of block b1 with frame title text-001.

select-options:

s_vbeln for vbrk-vbeln,

s_fkdat for vbrk-fkdat,

s_kschl for konv-kschl,

s_kunnr for konv-kunnr,

s_knumv for konv-knumv.

selection-screen: end of block b1.

----


  • START-OF-SELECTION

----


start-of-selection.

perform get_data.

perform process_data.

perform display_data.

----


  • END-OF-SELECTION

----


end-of-selection.

&----


*& Form get_data

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


form get_data.

  • Get data from VBRK

select vbeln

knumv

fkdat

from vbrk

into table it_vbrk

where vbeln in s_vbeln

and fkdat in s_fkdat.

  • Get data from KONV

select knumv

kschl

kwert

kunnr

from konv

into table it_konv

where kschl in s_kschl

  • and kunnr in s_kunnr

and knumv in s_knumv.

endform. " get_data

&----


*& Form process_data

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM process_data.

loop at it_vbrk.

read table it_konv

WITH KEY knumv = it_vbrk-knumv.

if sy-subrc = 0.

move konv-kwert to it_output-kwert.

move vbrk-vbeln to it_output-vbeln.

append it_output.

clear it_output.

endif.

endloop.

ENDFORM. "process_data

*& Form display_data

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


form display_data.

define new_grid.

y = sy-linno. y = y + 2.

skip to line y.

x = sy-colno. position x. write '|'.

end-of-definition.

define write_grid.

x = sy-colno. y = sy-linno. position x.

write: &1, '|'.

l = sy-colno - x + 1.

x = x - 2. y = y + 1. skip to line y. position x.

uline at x(l).

y = y - 1. x = sy-colno. skip to line y. position x.

end-of-definition.

FORMAT COLOR COL_HEADING.

write:/1 'Billing Document',

20 'Condition Value'.

  • skip 1.

loop at it_output.

format color COL_TOTAL.

new_grid.

write_grid: it_output-vbeln,

it_output-kwert.

format color off.

endloop.

endform. " display_data

3 REPLIES 3
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
584

This doesn't see right to me.




FORM process_data.
loop at it_vbrk.
read table it_konv
WITH KEY knumv = it_vbrk-knumv.
if sy-subrc = 0.
<b>move konv-kwert to it_output-kwert.
move vbrk-vbeln to it_output-vbeln.</b>
append it_output.
clear it_output.
endif.
endloop.
ENDFORM. "process_data


Shouldn't it be.....




FORM process_data.
loop at it_vbrk.
read table it_konv
WITH KEY knumv = it_vbrk-knumv.
if sy-subrc = 0.
<b>move it_konv-kwert to it_output-kwert.
move it_vbrk-vbeln to it_output-vbeln.</b>
append it_output.
clear it_output.
endif.
endloop.
ENDFORM. "process_data

Regards,

Rich Heilman

Read only

0 Likes
583

Thank you Rich, It solved my problem.

-Veni.

Read only

Former Member
0 Likes
583

Veni,

Correct your move statements in process data.

Move it_konv.........

Move it_vbrk......

Regards,

KV