Wednesday, December 24, 2008

Interactive Report Program Demo

Program for Interavtive Report

The above code is used to accept Customer No and display Customer Details in the Primary List and Sales Order Details and Item Details in the Secondary List.

************************************************************************************
REPORT ZINTERACTIVE_REPORT LINE-SIZE 103 LINE-COUNT 35(5) NO STANDARDPAGEHEADING.
*TABLES DECLARATION
TABLES : KNA1, VBAK, VBAP.
*SELECT OPTIONS
SELECT-OPTIONS: CUST_NO FOR KNA1-KUNNR.
*INITIALIZATION
INITIALIZATION.
CUST_NO-LOW = '01'.CUST_NO-HIGH = '5000'.CUST_NO-SIGN = 'I'.CUST_NO-OPTION = 'BT'.APPEND CUST_NO.
*BASIC LIST SELECTION
START-OF-SELECTION.
SELECT KUNNR NAME1 ORT01 LAND1

INTO (KNA1-KUNNR, KNA1-NAME1,KNA1-ORT01,KNA1-LAND1)
FROM KNA1 WHERE KUNNR IN CUST_NO.
WRITE:/1 SY-VLINE, KNA1-KUNNR UNDER 'CUSTOMER NO.' HOTSPOT ON, 16 SY-VLINE, KNA1-NAME1 UNDER 'NAME', 61 SY-VLINE, KNA1-ORT01 UNDER 'CITY', 86 SY-VLINE, KNA1-LAND1 UNDER 'COUNTRY', 103 SY-VLINE.
HIDE: KNA1-KUNNR.
ENDSELECT.
ULINE.
*SECONDARY LIST ACCESS
AT LINE-SELECTION.
IF SY-LSIND = 1.

PERFORM SALES_ORD.
ENDIF.
IF SY-LSIND = 2.
PERFORM ITEM_DET.
ENDIF.
*TOP OF PAGE
TOP-OF-PAGE.
FORMAT COLOR 1.
WRITE : 'CUSTOMER DETAILS'.
FORMAT COLOR 1 OFF.
ULINE.
FORMAT COLOR 3.
WRITE : 1 SY-VLINE, 3 'CUSTOMER NO.', 16 SY-VLINE, 18 'NAME', 61 SY-VLINE, 63 'CITY',

86 SY-VLINE,
88 'COUNTRY', 103 SY-VLINE.
ULINE.
FORMAT COLOR 3 OFF.
*TOP OF PAGE FOR SECONDARY LISTS
TOP-OF-PAGE DURING LINE-SELECTION.
*TOP OF PAGE FOR 1ST SECONDARY LIST
IF SY-LSIND = 1.
ULINE.
FORMAT COLOR 1.
WRITE : 'SALES ORDER DETAILS'.

ULINE.

WRITE : 1 SY-VLINE, 3 'CUSTOMER NO.', 16 SY-VLINE, 18 'SALES ORDER NO.', 40 SY-VLINE, 42 'DATE',

60 SY-VLINE, 62 'CREATOR', 85 SY-VLINE, 87 'DOC DATE', 103 SY-VLINE. ULINE.
ENDIF.
*TOP OF PAGE FOR 2ND SECONDARY LIST
IF SY-LSIND = 2.
ULINE.

WRITE : 'ITEM DETAILS'.
ULINE.
WRITE : 1 SY-VLINE, 3 'SALES ORDER NO.', 40 SY-VLINE, 42 'SALES ITEM NO.', 60 SY-VLINE,

62 'ORDER QUANTITY', 103 SY-VLINE. ULINE.
ENDIF.
*END OF PAGE
END-OF-PAGE.
ULINE.WRITE :'USER :',SY-UNAME,/,'DATE :', SY-DATUM, 85 'END OF PAGE:',SY-PAGNO. SKIP.
*Form SALES_ORD
FORM SALES_ORD .
SELECT KUNNR VBELN ERDAT ERNAM AUDAT

INTO (VBAK-KUNNR, VBAK-VBELN, VBAK-ERDAT, VBAK-ERNAM, VBAK-AUDAT)
FROM VBAK WHERE KUNNR = KNA1-KUNNR.
WRITE:/1 SY-VLINE, VBAK-KUNNR UNDER 'CUSTOMER NO.' HOTSPOT ON, 16 SY-VLINE, VBAK-VBELN

UNDER 'SALES ORDER NO.' HOTSPOT ON, 40 SY-VLINE, VBAK-ERDAT UNDER 'DATE', 60 SY-VLINE,
VBAK-ERNAM UNDER 'CREATOR', 85 SY-VLINE, VBAK-AUDAT UNDER 'DOC DATE', 103 SY-VLINE.
HIDE : VBAK-VBELN.ENDSELECT.
ULINE.
ENDFORM. " SALES_ORD
*Form ITEM_DET
FORM ITEM_DET .
SELECT VBELN POSNR KWMENG INTO (VBAP-VBELN, VBAP-POSNR, VBAP-KWMENG)

FROM VBAP WHERE VBELN = VBAK-VBELN.
WRITE : /1 SY-VLINE, VBAP-VBELN UNDER 'SALES ORDER NO.', 40 SY-VLINE, VBAP-POSNR UNDER

'SALES ITEM NO.', 60 SY-VLINE, VBAP-KWMENG UNDER 'ORDER QUANTITY', 103 SY-VLINE.
ENDSELECT.
ULINE.

ENDFORM.
****************************************************************************************************************************************
Selection Screen
Accept Customer No range


Primary List:
Customer Details

Secondary List :Item Details






1 comment:

magnific said...

Hi there,I enjoy reading through your article post, I wanted to write a little comment to support you and wish you a good continuationAll the best for all your blogging efforts.
Appreciate the recommendation! Let me try it out.
Keep working ,great job!
Awesome post
http://www.sapficoonlinetraining.in/

Post a Comment