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

classical report coding

Former Member
0 Likes
745

can anybody send coding for classical report?

4 REPLIES 4
Read only

Former Member
0 Likes
606

hi,

check the code below

&----


*& Report ZWK12346

*&

&----


*&

*&

&----


REPORT zwk12346 LINE-SIZE 160 LINE-COUNT 35(3) NO STANDARD PAGE HEADING.

......................................................................

...............DECLARATION OF TABLES..................................

......................................................................

TABLES: mkpf,

mseg,

makt.

  • .....................................................................*

  • .............AT SELECTION SCREEN.....................................*

  • .....................................................................*

SELECT-OPTIONS b FOR mkpf-mblnr. "Document no.

PARAMETERS: a TYPE mkpf-mjahr. "Document year.

DATA: am TYPE mseg-dmbtr VALUE 0.

  • .....................................................................*

.................DECLARATION OF WORK AREA.............................

  • .....................................................................*

DATA: BEGIN OF wa,

mblnr TYPE mkpf-mblnr,

mjahr TYPE mkpf-mjahr,

budat TYPE mkpf-budat,

matnr TYPE mseg-matnr,

maktx TYPE makt-maktx,

werks TYPE mseg-werks,

dmbtr TYPE mseg-dmbtr,

END OF wa.

  • .....................................................................*

  • ..............INTERNAL TABLE DELARATION..............................*

  • .....................................................................*

DATA: itab LIKE STANDARD TABLE OF wa.

  • .....................................................................*

...............CONSTANT...............................................

......................................................................

......................................................................

...............GLOBAL VARIABLES.......................................

......................................................................

......................................................................

..............TOP-OF-PAGE.............................................

......................................................................

TOP-OF-PAGE.

FORMAT COLOR COL_HEADING.

WRITE: / sy-uline(150).

WRITE:/ sy-vline,

3 'Document No.',

17 sy-vline,

20 'Document Year',

37 sy-vline,

38 'Posting Date',

54 sy-vline,

56 'Material No.',

72 sy-vline,

74 'Description',

118 sy-vline,

120 'Plant',

130 sy-vline,

132 'Amount',

150 sy-vline.

WRITE: / sy-uline(150).

FORMAT RESET.

  • ....................................................................*

.............END-OF-PAGE.............................................

.....................................................................

END-OF-PAGE.

WRITE: / sy-uline(150).

FORMAT COLOR COL_TOTAL.

WRITE: /128 'Total', am.

  • ....................................................................*

......................START OF SELECTION.............................

.....................................................................

START-OF-SELECTION.

SELECT mmblnr mmjahr mbudat qmatnr pmaktx qwerks q~dmbtr INTO CORRESPONDING FIELDS OF TABLE itab

FROM ( ( mkpf AS m INNER JOIN mseg AS q ON mmblnr = qmblnr )

INNER JOIN makt AS p ON pmatnr = qmatnr )

WHERE m~mjahr = a.

..............Exit if Data is not fetched............................

.....................................................................

IF sy-subrc NE 0.

WRITE: / 'No data selected'.

EXIT.

ENDIF.

.....................................................................

.....................END OF SELECTION................................

.....................................................................

LOOP AT itab INTO wa.

WRITE:/ sy-vline,

3 wa-mblnr COLOR COL_KEY,

17 sy-vline COLOR COL_KEY,

20 wa-mjahr COLOR COL_KEY,

37 sy-vline,

38 wa-budat,54 sy-vline,

56 wa-matnr COLOR COL_KEY,

72 sy-vline,

74 wa-maktx,

118 sy-vline,

120 wa-werks,

130 sy-vline,

132 wa-dmbtr,

150 sy-vline.

ENDLOOP.

WRITE: / sy-uline(150).

regards,

Navneeth.K

Read only

Former Member
0 Likes
606

Hi,

*"Selection screen elements............................................

parameters:

p_name(20) type c obligatory, " User name

p_fname(10) type c modif id sc1, " First name

p_lname(10) type c modif id sc1, " Second name

p_eid(10) type c modif id sc1. " Employee id

*" Data declarations...................................................

"----


  • Work variables *

"----


data

w_uname like sy-uname. " User name

"----


  • AT SELECTION-SCREEN OUTPUT EVENT *

"----


at selection-screen output.

perform user_name.

"----


  • AT SELECTION-SCREEN ON FIELD EVENT *

"----


at selection-screen on p_name.

perform employee_details.

"----


  • END-OF-SELECTION EVENT *

"----


end-of-selection.

perform user_details.

&----


*& Form USER_NAME

----


  • This subroutine enters user name is valid *

----


  • There are no interface parameters to be passed to this subroutine. *

----


form user_name .

w_uname = sy-uname.

loop at screen.

if p_name ne w_uname or p_name is initial.

if screen-group1 = 'SC1'.

screen-active = 0.

else.

screen-active = 1.

endif. " ENDIF SCREEN..

modify screen.

endif. " ENDIF P_NAME..

endloop. " ENDLOOP

endform. " USER_NAME

----


  • Form EMPLOYEE_DETAILS *

----


  • This subroutine checks user name is valid . *

----


  • There are no interface parameters to be passed to this subroutine. *

----


form employee_details .

if p_name ne w_uname.

message 'The user name is wrong'(005) type 'E'.

endif.

endform. " EMPLOYEE_DETAILS

----


  • Form USER_DETAILS *

----


  • This subroutine writes user details . *

----


  • There are no interface parameters to be passed to this subroutine. *

----


FORM user_details .

if p_name eq w_uname.

if p_fname is initial.

message 'Fill all fields'(006) type 'I'.

else.

write:

/ 'User Name :'(001) , sy-uname,

/ 'First Name:'(002) , p_fname,

/ 'Last Name:'(003) , p_lname,

/ 'Employee id:'(004) , p_eid.

endif.

endif. " ENDIF P_NAME..

endform. " USER_DETAILS

regrds,

ananth

Read only

Former Member
0 Likes
606

crazy to post a question like this. what exactly u wann.

Read only

Former Member
0 Likes
606

hi

<b>Classical Reports</b>

These are the most simple reports. Programmers learn this one first. It is just an output of data using the Write statement inside a loop.

Classical reports are normal reports. These reports are not having any sub reports. IT IS HAVING ONLY ONE SCREEN/LIST FOR OUTPUT.

Events In Classical Reports.

INTIALIZATION: This event triggers before selection screen display.

AT-SELECTION-SCREEN: This event triggers after proccesing user input still selection screen is in active mode.

START OF SELECTION: Start of selection screen triggers after proceesing selection screen.

END-OF-SELECTION : It is for Logical Database Reporting.

for <b>Example</b> refer to link

http://www.sapmaterial.com/?gclid=CN322K28t4sCFQ-WbgodSGbK2g

hope it will clear ur doubt

regards

ravish

<b>plz dont forget to reward points if helpful</b>