Google

REPORT FOR SHIPPING INVOICE DETAILS

REPORT Z_SALES_ORDER_SHIPPING_INVOICE_DETAILS NO STANDARD PAGE HEADING line-size 140.

**** report for displaying the sales order shipping and invoice details

tables : vbak , " sales document header

vbap , " sales document item details

vttp , " shipment item

likp , " delivery document header

lips , " sales delivery doc items

vbrk , " billing document header

vbrp. " billing document item details

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

parameters : p_vkorg like vbak-vkorg default '1000',

p_vtweg like vbak-vtweg default '10',

p_spart like vbak-spart default '00'.

select-options : s_erdat for likp-erdat default '19970101' to'19970130'.

selection-screen end of block b1.

data : begin of itab1 occurs 0,

vbeln like vbak-vbeln, " sales document number

auart like vbak-auart, " sales doc type

erdat like vbak-erdat, " creation date

vstel like vbap-vstel, " shipping point

lgort like vbap-lgort, " storage location

end of itab1.

data : begin of itab2 occurs 0.

* include structure itab1.

data: vgbel like lips-vgbel, " document of the ref docu

d_vbeln like lips-vbeln, " delivery no

lfdat like likp-lfdat, " delivery date

i_vbeln like vbrk-vbeln, " invoice number

fkdat_rl like vbrk-fkdat_rl, " invoice date num

tknum like vttp-tknum, " shipment number

netwr like vbrk-netwr, " invoice net value

end of itab2.

DATA : BEGIN OF ITAB3 OCCURS 0.

INCLUDE STRUCTURE ITAB1.

INCLUDE STRUCTURE ITAB2.

DATA : END OF ITAB3.

start-of-selection.

select vk~vbeln vk~auart vk~erdat vp~vstel vp~lgort

* into table itab2

into corresponding fields of itab1

from vbak as vk inner join vbap as vp

on vk~vbeln = vp~vbeln

where vk~vkorg = p_vkorg and vk~vtweg = p_vtweg and vk~spart = p_spart

and vk~vbeln = vp~vbeln AND vk~erdat in s_erdat.

append itab1. clear itab1.

endselect.

select lp~vgbel lp~vbeln lk~lfdat vp~vbeln vk~fkdat_rl vk~netwr

into (itab2-vgbel,itab2-d_vbeln, itab2-lfdat,itab2-i_vbeln, itab2-fkdat_rl,itab2-netwr)

* corresponding fields of itab2 from ( ( ( lips as lp inner join likp as lk

on lp~vbeln = lk~vbeln ) inner join vbrp as vp on lp~vbeln = vp~vgbel and

lp~posnr = vp~posnr ) inner join vbrk as vk on vp~vbeln = vk~vbeln )

for all entries in itab1 where lp~vgbel = itab1-vbeln and

lp~vbeln = lk~vbeln and lp~vbeln = vp~vgbel and lp~posnr = vp~posnr.

APPEND itab2. * MODIFY ITAB2. clear itab2.

endselect.

LOOP AT ITAB1.

READ TABLE ITAB2 WITH KEY ITAB1-VBELN.

MOVE-CORRESPONDING ITAB1 TO ITAB3. MOVE-CORRESPONDING ITAB2 TO ITAB3.

APPEND ITAB3. CLEAR ITAB3.

ENDLOOP.

TOP-OF-PAGE.

WRITE : / ' sales order shipping and invoice details ' color 3.

END-OF-SELECTION.

* loop at itab1.

* write : /10 itab1-vbeln, 25 itab1-auart, 30 itab1-erdat, 40

*itab1-vstel, 50 itab1-lgort.

* endloop.

loop at itab3.

AT FIRST.

write : /2 itab3-vbeln,

10 itab3-auart,

20 itab3-erdat,

35 itab3-vstel,

55 itab3-lgort,

65 itab3-vgbel,

75 itab3-d_vbeln,

85 itab3-lfdat,

95 itab3-fkdat_rl,

110 itab3-netwr.

endloop.

FORMAT INTENSIFIED COLOR 3 on.

write : /2 'itab3-vbeln',

10 'itab3-auart',

20 'itab3-erdat',

35 'itab3-vstel',

55 'itab3-lgort',

65 'itab3-vgbel',

70 'itab3-d_vbeln',

85 'itab3-lfdat',

95 'itab3-fkdat_rl',

110 'itab3-netwr'.

ENDAT.

Project---object ---3

REPORT ZSALESRPT_VIN LINE-COUNT 23 LINE-SIZE 150.

" TO GENERATE PERFORMANCE OF SALES GROUP IN" PARTICULAR SALES AREA FOR SPECIFIED PERIOD

TABLES : VBAK. " NAME OF THE TABLE

DATA: BEGIN OF ITAB OCCURS 0, " CREATING A INTERNAL TABLE

VKORG LIKE VBAK-VKORG, " SALES ORGANISATION

VTWEG LIKE VBAK-VTWEG, " SALES GROUP

SPART LIKE VBAK-SPART, " SALES DIVISION

AUDAT LIKE VBAK-AUDAT, " SALES DOCUMENT CREATION DATE

VBELN LIKE VBAK-VBELN, " SALES ORDER NUMBER

NAME1 LIKE KNA1-NAME1, " CUSTOMER NAME

KUNNR LIKE KNA1-KUNNR, " CUSTOMER NUMBER

VKGRP LIKE VBAK-VKGRP, " SALES GROUP

VKBUR LIKE VBAK-VKBUR, " SALES OFFICE

NETWR LIKE VBAK-NETWR, " NET VALUE OF EACH ORDER

END OF ITAB.

SELECTION-SCREEN BEGIN OF BLOCK BLOCK1 WITH FRAME TITLE TEXT-OO1.

SELECT-OPTIONS:

VKORG FOR VBAK-VKORG, " INPUT FIELDS TO INTERACT WITH

VTWEG FOR VBAK-VTWEG, " END USERS

SPART FOR VBAK-SPART,

AUDAT FOR VBAK-AUDAT.

SELECTION-SCREEN END OF BLOCK BLOCK1.

*write : ZVKORG-LOW,ZVTWEG-LOW,ZSPART-HIGH.

*RETRIEVING THE INFORMATION FROM TWO TABLES BY USING SELECT

SELECT A~NAME1 A~KUNNR B~VKGRP B~VBELN B~VKBUR B~NETWR

FROM VBAK AS B INNER JOIN KNA1 AS A ON A~KUNNR = B~KUNNR INTO

CORRESPONDING FIELDS OF TABLE ITAB WHERE VKORG IN VKORG AND VTWEG IN VTWEG AND SPART IN SPART.

SORT ITAB BY VKGRP.

WRITE : /2 'DOCUMENT' COLOR 5, 22 'CUSTOMER NO' COLOR 5, 42 'C-NAME' COLOR 5, 62 'S-GROUP' COLOR 5, 82 'S-ORDER' COLOR 5.

LOOP AT ITAB.

AT FIRST.

WRITE:/'THIS IS FOR SALES GROUP'. "SKIP 2.

ENDAT.

AT NEW VKGRP.ULINE.

*WRITE :/1(3) SY-VLINE , 4(20) SY-VLINE,24(20) SY-VLINE, 44(20) SY-VLINE

* 64(20) SY-VLINE. WRITE :/ ITAB-VKGRP.

ENDAT.

WRITE :/2 ITAB-VBELN , 22 ITAB-KUNNR , 42 ITAB-NAME1 , 62 ITAB-VKGRP , 82 ITAB-NETWR .

AT LAST.

WRITE :/ 'IT IS OVER'.

ENDAT.

ENDLOOP.