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: 

sales reports

Former Member
0 Kudos

sales document details report that displays all the sales orders along with delivery and billing document details as per user defined date range and/or order type. User had the option of calling specific transactions to get further details of the selected document.

how to do this

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi Sonti

hope this will help you.

REPORT ZVRDOC0 no standard page heading

line-size 300

line-count 50(5).

TABLES : vbak, "Sales Document Header Level

vbap, "Sales Document Header Level

kna1. "General Data in customer Master

*INTERNAL TABLE T_VBAP

DATA : Begin of t_vbap occurs 0,

vbeln like vbap-vbeln,

matnr like vbap-matnr,

posnr like vbap-posnr,

arktx like vbap-arktx,

kwmeng like vbap-kwmeng,

cmkua like vbap-cmkua,

end of t_vbap.

*INTERNAL TABLE T_TAB.

DATA : Begin of t_tab occurs 0,

vbeln like vbak-vbeln,

kunnr like vbak-kunnr,

audat like vbak-audat,

netwr like vbak-netwr,

vkorg like vbak-vkorg,

name1 like kna1-name1,

land1 like kna1-land1,

end of t_tab.

*INTERNAL TABLE T_FINAL.

DATA : Begin of t_final occurs 0,

vbeln like vbap-vbeln,

kunnr like vbak-kunnr,

matnr like vbap-matnr,

posnr like vbap-posnr,

arktx like vbap-arktx,

kwmeng like vbap-kwmeng,

cmkua like vbap-cmkua,

audat like vbak-audat,

netwr like vbak-netwr,

vkorg like vbak-vkorg,

name1 like kna1-name1,

land1 like kna1-land1,

end of t_final.

SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE text-bO3.

parameters : P_kunnr like vbak-kunnr.

select-options : S_vbeln for vbak-vbeln,

S_audat for vbak-audat.

SELECTION-SCREEN END OF BLOCK B1.

start-of-selection.

select vbeln matnr posnr arktx kwmeng cmkua from vbap

into corresponding fields of table t_vbap where vbeln in S_vbeln .

IF sy-subrc EQ 0.

select vbakkunnr vbakvbeln vbakaudat vbaknetwr vbak~vkorg

kna1name1 kna1land1 into table t_Tab from

vbak join kna1 on kna1kunnr = vbakkunnr

FOR ALL ENTRIES IN t_vbap

where vbak~vbeln = t_vbap-Vbeln and

vbak~kunnr = p_kunnr and

vbak~audat in S_audat .

ENDIF.

*end-of-selection.

loop at t_vbap.

read table t_tab with key vbeln = t_vbap-vbeln.

move :

t_vbap-vbeln to t_final-vbeln,

t_vbap-matnr to t_final-matnr,

t_vbap-posnr to t_final-posnr,

t_vbap-arktx to t_final-arktx,

t_vbap-kwmeng to t_final-kwmeng,

t_vbap-cmkua to t_final-cmkua,

t_tab-kunnr to t_final-kunnr,

t_tab-audat to t_final-audat,

t_tab-netwr to t_final-netwr,

t_tab-vkorg to t_final-vkorg,

t_tab-name1 to t_final-name1,

t_tab-land1 to t_final-land1.

append t_final.

clear t_Final.

endloop.

sort t_Final by vbeln Kunnr matnr posnr .

loop at t_final.

at new vbeln.

write : /1 SY-VLINE, 2 t_final-vbeln color 5 inverse.

ULINE /1(250).

endat.

write : /1 SY-VLINE, 2 t_final-vbeln color 5 inverse,

20 SY-VLINE, 21 t_final-posnr color 5 inverse,

40 SY-VLINE, 41 t_final-matnr color 5 inverse,

60 SY-VLINE, 61 t_final-arktx color 4 inverse,

80 SY-VLINE, 81 t_final-kwmeng color 4 inverse,

100 SY-VLINE, 101 t_final-cmkua color 4 inverse,

120 SY-VLINE, 121 t_final-kunnr color 3 inverse,

140 SY-VLINE, 141 t_final-audat color 3 inverse,

160 SY-VLINE, 161 t_final-netwr color 2 inverse,

180 SY-VLINE, 181 t_final-vkorg color 2 inverse,

210 SY-VLINE, 211 t_final-name1 color 1 inverse,

230 SY-VLINE, 231 t_final-land1 color 1 inverse,

250 SY-VLINE.

at end of vbeln.

sum.

ULINE /1(250).

write: /60 SY-VLINE, 'Total' ,

81 t_final-kwmeng color 4 inverse ,100 SY-VLINE,

101 t_final-cmkua color 4 inverse,120 SY-VLINE.

ULINE /1(250).

endat.

at last.

SKIP 2.

sum.

ULINE /1(250).

write: /1 SY-VLINE, 60 SY-VLINE, 'Grand Total' ,

81 t_final-kwmeng color 4 inverse , 100 SY-VLINE ,

101 t_final-cmkua color 4 inverse,120 SY-VLINE.

ULINE /1(250).

endat.

endloop.

TOP-OF-PAGE.

ULINE /50(24).

WRITE : /50 SY-VLINE , 52 'SALES ORDER DETAILS' COLOR 5,

73 SY-VLINE.

ULINE /50(24).

ULINE .

WRITE: /10 'CURRENT DATE :', 25 SY-DATUM COLOR 1 INVERSE,

100 'CURRENT TIME :', 115 SY-UZEIT color 5 INVERSE.

WRITE: /10 'USERNAME :', 25 SY-UNAME COLOR 1 INVERSE,

100 'PAGE NO :', 113 SY-PAGNO COLOR 5 INVERSE.

WRITE: /10 'LOGON CLIENT :', 25 SY-MANDT COLOR 1 INVERSE,

100 'COLON N0 :', 114 SY-COLNO COLOR 5 INVERSE.

WRITE: /10 'CURRENT REPROT:', 25 SY-REPID COLOR 1 INVERSE,

100 'LANGUAGE :', 116 SY-LANGU COLOR 5 INVERSE.

ULINE.

ULINE /1(250).

write : /1 SY-VLINE, 2 'SALES DOC NO' color 6 inverse,

20 SY-VLINE, 21 'SALES DOC ITEM' color 6 inverse,

40 SY-VLINE,41 'MATERIAL NO' color 6 inverse,

60 SY-VLINE, 61 'SHORT SALES TEXT' color 6 inverse,

80 SY-VLINE, 81 'CUMM ORDER SALES' color 6 inverse,

100 SY-VLINE, 101 'CREDIT DATA' color 6 inverse,

120 SY-VLINE, 121 'CUSTOMER NO' color 6 inverse,

140 SY-VLINE, 141 'DOC DATE' color 6 inverse,

160 SY-VLINE, 161 'NET VALUE SALES' color 6 inverse,

180 SY-VLINE, 181 'SALES ORG' color 6 inverse,

210 SY-VLINE, 211 'CUSTOMER NAME' color 6 inverse,

230 SY-VLINE, 231 'CUSTOMER CONTY' color 6 inverse,

250 SY-VLINE.

ULINE /1(250).

END-OF-PAGE.

ULINE.

WRITE: /45 ' THIS IS END OF PAGE FOR SALES DOCUMENT DETAILS'

COLOR 6 .

reward pts if help.

4 REPLIES 4

Former Member
0 Kudos

Hi Sonti

hope this will help you.

REPORT ZVRDOC0 no standard page heading

line-size 300

line-count 50(5).

TABLES : vbak, "Sales Document Header Level

vbap, "Sales Document Header Level

kna1. "General Data in customer Master

*INTERNAL TABLE T_VBAP

DATA : Begin of t_vbap occurs 0,

vbeln like vbap-vbeln,

matnr like vbap-matnr,

posnr like vbap-posnr,

arktx like vbap-arktx,

kwmeng like vbap-kwmeng,

cmkua like vbap-cmkua,

end of t_vbap.

*INTERNAL TABLE T_TAB.

DATA : Begin of t_tab occurs 0,

vbeln like vbak-vbeln,

kunnr like vbak-kunnr,

audat like vbak-audat,

netwr like vbak-netwr,

vkorg like vbak-vkorg,

name1 like kna1-name1,

land1 like kna1-land1,

end of t_tab.

*INTERNAL TABLE T_FINAL.

DATA : Begin of t_final occurs 0,

vbeln like vbap-vbeln,

kunnr like vbak-kunnr,

matnr like vbap-matnr,

posnr like vbap-posnr,

arktx like vbap-arktx,

kwmeng like vbap-kwmeng,

cmkua like vbap-cmkua,

audat like vbak-audat,

netwr like vbak-netwr,

vkorg like vbak-vkorg,

name1 like kna1-name1,

land1 like kna1-land1,

end of t_final.

SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE text-bO3.

parameters : P_kunnr like vbak-kunnr.

select-options : S_vbeln for vbak-vbeln,

S_audat for vbak-audat.

SELECTION-SCREEN END OF BLOCK B1.

start-of-selection.

select vbeln matnr posnr arktx kwmeng cmkua from vbap

into corresponding fields of table t_vbap where vbeln in S_vbeln .

IF sy-subrc EQ 0.

select vbakkunnr vbakvbeln vbakaudat vbaknetwr vbak~vkorg

kna1name1 kna1land1 into table t_Tab from

vbak join kna1 on kna1kunnr = vbakkunnr

FOR ALL ENTRIES IN t_vbap

where vbak~vbeln = t_vbap-Vbeln and

vbak~kunnr = p_kunnr and

vbak~audat in S_audat .

ENDIF.

*end-of-selection.

loop at t_vbap.

read table t_tab with key vbeln = t_vbap-vbeln.

move :

t_vbap-vbeln to t_final-vbeln,

t_vbap-matnr to t_final-matnr,

t_vbap-posnr to t_final-posnr,

t_vbap-arktx to t_final-arktx,

t_vbap-kwmeng to t_final-kwmeng,

t_vbap-cmkua to t_final-cmkua,

t_tab-kunnr to t_final-kunnr,

t_tab-audat to t_final-audat,

t_tab-netwr to t_final-netwr,

t_tab-vkorg to t_final-vkorg,

t_tab-name1 to t_final-name1,

t_tab-land1 to t_final-land1.

append t_final.

clear t_Final.

endloop.

sort t_Final by vbeln Kunnr matnr posnr .

loop at t_final.

at new vbeln.

write : /1 SY-VLINE, 2 t_final-vbeln color 5 inverse.

ULINE /1(250).

endat.

write : /1 SY-VLINE, 2 t_final-vbeln color 5 inverse,

20 SY-VLINE, 21 t_final-posnr color 5 inverse,

40 SY-VLINE, 41 t_final-matnr color 5 inverse,

60 SY-VLINE, 61 t_final-arktx color 4 inverse,

80 SY-VLINE, 81 t_final-kwmeng color 4 inverse,

100 SY-VLINE, 101 t_final-cmkua color 4 inverse,

120 SY-VLINE, 121 t_final-kunnr color 3 inverse,

140 SY-VLINE, 141 t_final-audat color 3 inverse,

160 SY-VLINE, 161 t_final-netwr color 2 inverse,

180 SY-VLINE, 181 t_final-vkorg color 2 inverse,

210 SY-VLINE, 211 t_final-name1 color 1 inverse,

230 SY-VLINE, 231 t_final-land1 color 1 inverse,

250 SY-VLINE.

at end of vbeln.

sum.

ULINE /1(250).

write: /60 SY-VLINE, 'Total' ,

81 t_final-kwmeng color 4 inverse ,100 SY-VLINE,

101 t_final-cmkua color 4 inverse,120 SY-VLINE.

ULINE /1(250).

endat.

at last.

SKIP 2.

sum.

ULINE /1(250).

write: /1 SY-VLINE, 60 SY-VLINE, 'Grand Total' ,

81 t_final-kwmeng color 4 inverse , 100 SY-VLINE ,

101 t_final-cmkua color 4 inverse,120 SY-VLINE.

ULINE /1(250).

endat.

endloop.

TOP-OF-PAGE.

ULINE /50(24).

WRITE : /50 SY-VLINE , 52 'SALES ORDER DETAILS' COLOR 5,

73 SY-VLINE.

ULINE /50(24).

ULINE .

WRITE: /10 'CURRENT DATE :', 25 SY-DATUM COLOR 1 INVERSE,

100 'CURRENT TIME :', 115 SY-UZEIT color 5 INVERSE.

WRITE: /10 'USERNAME :', 25 SY-UNAME COLOR 1 INVERSE,

100 'PAGE NO :', 113 SY-PAGNO COLOR 5 INVERSE.

WRITE: /10 'LOGON CLIENT :', 25 SY-MANDT COLOR 1 INVERSE,

100 'COLON N0 :', 114 SY-COLNO COLOR 5 INVERSE.

WRITE: /10 'CURRENT REPROT:', 25 SY-REPID COLOR 1 INVERSE,

100 'LANGUAGE :', 116 SY-LANGU COLOR 5 INVERSE.

ULINE.

ULINE /1(250).

write : /1 SY-VLINE, 2 'SALES DOC NO' color 6 inverse,

20 SY-VLINE, 21 'SALES DOC ITEM' color 6 inverse,

40 SY-VLINE,41 'MATERIAL NO' color 6 inverse,

60 SY-VLINE, 61 'SHORT SALES TEXT' color 6 inverse,

80 SY-VLINE, 81 'CUMM ORDER SALES' color 6 inverse,

100 SY-VLINE, 101 'CREDIT DATA' color 6 inverse,

120 SY-VLINE, 121 'CUSTOMER NO' color 6 inverse,

140 SY-VLINE, 141 'DOC DATE' color 6 inverse,

160 SY-VLINE, 161 'NET VALUE SALES' color 6 inverse,

180 SY-VLINE, 181 'SALES ORG' color 6 inverse,

210 SY-VLINE, 211 'CUSTOMER NAME' color 6 inverse,

230 SY-VLINE, 231 'CUSTOMER CONTY' color 6 inverse,

250 SY-VLINE.

ULINE /1(250).

END-OF-PAGE.

ULINE.

WRITE: /45 ' THIS IS END OF PAGE FOR SALES DOCUMENT DETAILS'

COLOR 6 .

reward pts if help.

0 Kudos

can you tell how to give points to you

Former Member
0 Kudos

In two ways we can do this.

1. vbfa may contains all the information of sales order details like delivery and billing document.

2. from vbak u can retrieve the sales order information

and from likp / lips u can get delivery information based on sales order

(LIPS-vgbel = vbak-vbeln) and (LIPS-vgpos = vbak-posnr)

and from vbrk / vbrp u can get billing information based on sales order

(vbrp-aubel = vbak-vbeln) and (vbrp-aupos = vbak-posnr)

Rewards the points if help ful

Madhavi

0 Kudos

how to give points to you