2007 Jul 12 10:41 AM
With out Using any ALVS .
SALESORDER REPORT
TABLES : VBAK,
VBAP,
KNA1.
INPUT FIELDS : Sales Document (RANGE)----
(vbak-vbeln)
Document Date (Date Received/Sent).(RANGE)----
(vbak-audat)
Sold-to party (PARAMETERS)----
(kna1-kunnr)
O/P FIELDS :
Sales Document----
(vbak-vbeln)
Document Date (Date Received/Sent)----
(vbak-audat)
Sales Document Item----
(vbap-posnr)
Short text for sales order item----
(vbap-arktx)
Material Number----
(vbap-matnr)
Cumulative order quantity in sales units----
(VBAP-KWMENG)
Requested delivery date----
(VBAP-CMKUA)
CUSTMER NUMBER(Sold-to party) -
(kna1-kunnr)
CUSTMER NAME -
(KNA1-NAME1)
CUSTMER CONTRY----
(KNA1-LAND1)
Net Value of the Sales Order in Document Currency----
(VBAK-NETWR)
Sales Organization----
(VBAK-KORG)
Name of Person who Created the Object----
(VBAK-ERNAM)
================================================================================
VBAK :
(KNA1-KUNNR)
Sales Document----
(VBAK-VBELN)
Document Date (Date Received/Sent)----
(VBAK-AUDAT)
Net Value of the Sales Order in Document Currency----
(VBAK-NETWR)
Sales Organization----
(VBAK-KORG)
Name of Person who Created the Object----
(VBAK-ERNAM)
VBAP:
Sales Document Item----
(VBAP-POSNR)
Short text for sales order item----
(VBAP-ARKTX)
Material Number----
(VBAP-MATNR)
Cumulative order quantity in sales units----
(VBAP-KWMENG)
Requested delivery date----
(VBAP-CMKUA)
KNA1:
CUSTMER NUMBER(Sold-to party) -
(KNA1-KUNNR)
CUSTMER NAME -
(KNA1-NAME1)
CUSTMER CONTRY----
(KNA1-LAND1)
====================================================================================================
TABLES : VBAK,
VBAP,
KNA1.
INPUT FIELDS : Sales Document (RANGE)
Document Date (Date Received/Sent).(RANGE)
Sold-to party (PARAMETERS)
O/P FIELDS :
Sales Document ....... VBAK-VBELN
Document Date (Date Received/Sent).....VBAK-AUDAT
CUSTMER NUMBER(Sold-to party)................VBAK-KUNNR
Net Value of the Sales Order in Document Currency.....VBAK-NETWR
Sales Organization......................................................VBAK-KORG
Name of Person who Created the Object..................VBAK-ERNAM
Sales Document Item ...............VBAP-POSNR
Short text for sales order item..........VBAP-ARKTX
Material Number.............................VBAP-MATNR
Cumulative order quantity in sales units............VBAP-KWMENG
Requested delivery date.................VBAP-CMKUA
CUSTMER NAME..................KNA1-NAME1
CUSTMER CONTRY..........................KNA1-LAND1
2007 Jul 12 11:51 AM
Here is the sample code, please make the necessary modifications...
REPORT ZTEST LINE-SIZE 103 LINE-COUNT 35(5) NO STANDARD PAGE
HEADING.
*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.
*SELECTION SCREEN VALIDATION
AT SELECTION-SCREEN ON CUST_NO.
LOOP AT SCREEN.
IF CUST_NO-LOW < 1 OR CUST_NO-HIGH > 5000.
MESSAGE E001(ZTJ1).
ENDIF.
ENDLOOP.
*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 user-command.
IF SY-UCOMM = 'IONE'.
PERFORM SALES_ORD.
ENDIF.
IF SY-UCOMM = 'ITWO'.
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-UCOMM = 'IONE'.
ULINE.
FORMAT COLOR 1.
WRITE : 'SALES ORDER DETAILS'.
ULINE.
FORMAT COLOR 1 OFF.
FORMAT COLOR 3.
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.
FORMAT COLOR 3 OFF.
*TOP OF PAGE FOR 2ND SECONDARY LIST
IF SY-UCOMM = 'ITWO'.
ULINE.
FORMAT COLOR 1.
WRITE : 'ITEM DETAILS'.
ULINE.
FORMAT COLOR 1 OFF.
FORMAT COLOR 3.
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.
FORMAT COLOR 3 OFF.
*END OF PAGE
END-OF-PAGE.
ULINE.
WRITE :'USER :',SY-UNAME,/,'DATE :', SY-DATUM, 85 'END OF PAGE:',
SY-PAGNO.
SKIP.
&----
*& Form SALES_ORD
*&
*& FIRST SECONDARY LIST FORM
&----
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
*&
*& SECOND SECONDARY LIST FORM
&----
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. " ITEM_DET
Regards,
Pavan.