100% found this document useful (1 vote)
3K views6 pages

ABAP Interactive Report

The document describes an ABAP interactive report that displays purchase order header and item details. It includes the data declarations, selection screen, events, and subroutines used to retrieve and display the purchase order data when a user clicks on a value.

Uploaded by

Debesh Swain
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
3K views6 pages

ABAP Interactive Report

The document describes an ABAP interactive report that displays purchase order header and item details. It includes the data declarations, selection screen, events, and subroutines used to retrieve and display the purchase order data when a user clicks on a value.

Uploaded by

Debesh Swain
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

ABAP Interactive Report

Interactive report:

Click on any EBELN Value .

Debesh

Page 0

ABAP Interactive Report

Click on any EBELP Value .

Code :
*&---------------------------------------------------------------------*
*& Report ZTEST_INTERACTIVE_PURCH_ORD
*&
*&---------------------------------------------------------------------*
*& Developer : Debesh
*& Date
: 1st Feb,2013
*&---------------------------------------------------------------------*
* Interactive report for displaying purchase order header/item details *
*&---------------------------------------------------------------------*
REPORT

ztest_interactive_purch_ord.

** Data Declaration **
TABLES : ekko.
TYPES : BEGIN OF ty_ekko,
ebeln TYPE ebeln,
bstyp TYPE ebstyp,

By Debesh

Page 1

ABAP Interactive Report


bsart TYPE esart,
lifnr TYPE elifn,
bedat TYPE ebdat,
waers TYPE waers,
wkurs TYPE wkurs,
END OF ty_ekko.
TYPES : BEGIN OF ty_ekpo,
ebeln TYPE ebeln,
ebelp TYPE ebelp,
aedat TYPE paedt,
matnr TYPE matnr,
bukrs TYPE bukrs,
werks TYPE werks,
lgort TYPE lgort_d,
bednr TYPE bednr,
matkl TYPE matkl,
infnr TYPE infnr,
peinh TYPE epein,
netwr TYPE brtwr,
END OF ty_ekpo.
DATA : lt_ekpo
lt_ekko
ls_ekpo
ls_ekko

TYPE
TYPE
TYPE
TYPE

STANDARD TABLE OF ty_ekpo,


STANDARD TABLE OF ty_ekko,
ty_ekpo,
ty_ekko.

DATA : lv_loc TYPE i.

** Selection Screen **
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
SELECT-OPTIONS : s_ebeln FOR ekko-ebeln NO INTERVALS .
SELECTION-SCREEN END OF BLOCK b1.
** Events **
CHECK s_ebeln IS NOT INITIAL.
START-OF-SELECTION.
PERFORM sub_get_data.
CHECK lt_ekko IS NOT INITIAL.
PERFORM sub_display_record.
AT LINE-SELECTION.
PERFORM sub_interactive.
TOP-OF-PAGE.
PERFORM sub_header.

By Debesh

Page 2

ABAP Interactive Report


** Subroutines **
*&---------------------------------------------------------------------*
*&
Form SUB_GET_DATA
*&---------------------------------------------------------------------*
*
text
*----------------------------------------------------------------------*
FORM sub_get_data .
SELECT ebeln bstyp bsart lifnr
bedat waers wkurs
FROM ekko
INTO TABLE lt_ekko
WHERE ebeln IN s_ebeln.
IF sy-subrc IS INITIAL.
SORT lt_ekko BY ebeln.
SELECT ebeln ebelp aedat matnr bukrs werks
lgort bednr matkl infnr peinh netwr
FROM ekpo
INTO TABLE lt_ekpo
FOR ALL ENTRIES IN lt_ekko
WHERE ebeln = lt_ekko-ebeln.
IF sy-subrc IS INITIAL.
SORT lt_ekpo BY ebeln ebelp.
ENDIF.
ELSE .
MESSAGE text-002 TYPE 'I'.
LEAVE TO SCREEN 0.
ENDIF.
ENDFORM.
" SUB_GET_DATA
*&---------------------------------------------------------------------*
*&
Form SUB_INTERACTIVE
*&---------------------------------------------------------------------*
*
text
*----------------------------------------------------------------------*
FORM sub_interactive .
CASE sy-lsind.
WHEN 1.
WRITE : sy-uline(80),
/'Line Item Details',
/ sy-uline(80).
NEW-LINE.
WRITE :
10 'ebelp' COLOR 1,
20 'aedat',
32 'matnr',
40 'bukrs',

By Debesh

Page 3

ABAP Interactive Report


50 'werks',
/ sy-uline(60).
LOOP AT lt_ekpo INTO ls_ekpo WHERE ebeln = ls_ekko-ebeln.
NEW-LINE.
ON CHANGE OF ls_ekpo-ebelp.
WRITE: /10 ls_ekpo-ebelp COLOR 4,
20 ls_ekpo-aedat,
33 ls_ekpo-matnr,
40 ls_ekpo-bukrs,
50 ls_ekpo-werks.
HIDE : ls_ekpo-ebelp.
ENDON.
ENDLOOP.
WHEN 2.
READ TABLE lt_ekpo INTO ls_ekpo WITH KEY ebelp = ls_ekpo-ebelp.
IF sy-subrc IS INITIAL.
WRITE : sy-uline(80),
/'More details of purchase line item',
/ sy-uline(80).
NEW-LINE.
WRITE :
10 'matkl',
20 'infnr',
40 'peinh',
55 'netwr',
/ sy-uline(70).
NEW-LINE.
WRITE :
/10 ls_ekpo-matkl,
20 ls_ekpo-infnr,
40 ls_ekpo-peinh,
50 ls_ekpo-netwr.
ENDIF.
ENDCASE.
ENDFORM.
" SUB_INTERACTIVE
*&---------------------------------------------------------------------*
*&
Form SUB_HEADER
*&---------------------------------------------------------------------*
*
text
*----------------------------------------------------------------------*
FORM sub_header .
NEW-LINE.
WRITE : 'Purchase order header details '.
WRITE : / 'Date

By Debesh

', sy-datum.

Page 4

ABAP Interactive Report


WRITE : / sy-uline(80).
ENDFORM.
" SUB_HEADER
*&---------------------------------------------------------------------*
*&
Form SUB_DISPLAY_RECORD
*&---------------------------------------------------------------------*
*
text
*----------------------------------------------------------------------*
FORM sub_display_record .
LOOP AT lt_ekko INTO ls_ekko.
AT FIRST.
NEW-LINE.
WRITE : sy-uline(80),
/10 'ebeln' COLOR 1 ,
22 'bstyp' ,
30 'bsart' ,
40 'lifnr' ,
50 'bedat' ,
62 'waers' ,
70 'wkurs' ,
sy-uline(80).
ENDAT.
NEW-LINE.
WRITE :
10 ls_ekko-ebeln COLOR 4,
22 ls_ekko-bstyp ,
30 ls_ekko-bsart ,
40 ls_ekko-lifnr ,
50 ls_ekko-bedat ,
62 ls_ekko-waers ,
70 ls_ekko-wkurs .
HIDE : ls_ekko-ebeln.
ENDLOOP.
ENDFORM.
" SUB_DISPLAY_RECORD

By Debesh

Page 5

You might also like