Search
 
 

Display results as :
 


Rechercher Advanced Search

Log in

I forgot my password

Latest topics
» Data Dictionary
Wed Sep 25, 2013 1:43 pm by harikrishna

» ABAP BASICS
Wed Sep 25, 2013 1:42 pm by harikrishna

» ALE/IDOC(interface)
Wed Sep 25, 2013 1:42 pm by harikrishna

» BDC(batch data communication)
Wed Sep 25, 2013 1:40 pm by harikrishna

» SapScripts
Wed Sep 25, 2013 1:39 pm by harikrishna

» Smartforms
Wed Sep 25, 2013 1:38 pm by harikrishna

» Performance Optimization
Wed Sep 25, 2013 1:37 pm by harikrishna

» Enhancements
Wed Sep 25, 2013 1:36 pm by harikrishna

» Module Programming
Wed Sep 25, 2013 1:35 pm by harikrishna


Interactive Report using Get Cursor Technique

View previous topic View next topic Go down

Interactive Report using Get Cursor Technique

Post  Admin on Sun Dec 23, 2012 8:07 pm

*&---------------------------------------------------------------------*
*& Report ZGOUTHAM_INTERACTIVE_REPORT
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*

REPORT ZGOUTHAM_INT_GET_CURSOR_REPORT.
INITIALIZATION.
DATA : V_field TYPE ebeln.

TYPES:BEGIN OF ty_ekko,
ebeln TYPE ebeln,
bukrs TYPE bukrs,
ekorg TYPE ekorg,
ekgrp TYPE ekgrp,
LIFNR TYPE ELIFN,
END OF ty_ekko.
TYPES:BEGIN OF ty_ekpo,
ebeln TYPE ebeln,
ebelp TYPE ebelp,
matnr TYPE matnr,
MENGE TYPE BSTMG,
NETPR TYPE BPREI,
END OF ty_ekpo.
TYPES:BEGIN OF TY_MARA,
MATNR TYPE MATNR,
ERNAM TYPE ERNAM,
MTART TYPE MTART,
MBRSH TYPE MBRSH,
MATKL TYPE MATKL,
END OF TY_MARA.

data:it_ekko TYPE STANDARD TABLE OF ty_ekko,
wa_ekko TYPE ty_ekko.
data:it_ekpo TYPE STANDARD TABLE OF ty_ekpo,
wa_ekpo TYPE ty_ekpo.
DATA: IT_MARA TYPE STANDARD TABLE OF TY_MARA,
WA_MARA TYPE TY_MARA.

SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE browsing.
SELECT-OPTIONS s_ebeln for wa_ekko-ebeln.
SELECT-OPTIONS s_bukrs for wa_ekko-bukrs.
SELECTION-SCREEN END OF BLOCK b1.

START-OF-SELECTION.
PERFORM get_all_data.

end-OF-SELECTION.
PERFORM DISPLAY_EKKO.



AT LINE-SELECTION.
GET CURSOR FIELD WA_EKKO-EBELN VALUE V_field.

IF SY-LSIND = 1.
PERFORM DISPLAY_INTERACTIVE_EKPO.
ELSEIF SY-LSIND = 2.

PERFORM DISPLAY_INTERACTIVE_MARA.
ENDIF.
************ TOP OF PAGES OF THE SECONDARY LIST SCREENS******
TOP-OF-PAGE DURING LINE-SELECTION.
if sy-lsind = 1.
WRITE 'SELECTED EKPO DATA'.
else.
WRITE ' SELECTED MARA DATA'.
ENDIF.

*&---------------------------------------------------------------------*
*& Form GET_ALL_DATA
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM GET_ALL_DATA .
******GETTING EKKO DATA*********
SELECT
ebeln
bukrs
ekorg
ekgrp
LIFNR
FROM ekko INto TABLE it_ekko WHERE ebeln in s_ebeln.
************** CHECKING WEATHER THE GIVEN DATA IS FETCHED ***********
IF SY-SUBRC = 0.
************** FETCHING THE DATA FROM EKPO *********
SELECT
ebeln
ebelp
matnr
menge
netpr
FROM ekpo into TABLE it_ekpo FOR ALL ENTRIES IN IT_EKKO WHERE ebeln = IT_EKKO-EBELN.
********* CHECKING WEATHER THE DATA IS FETCHES SUCCESFULLY FROM EKPO****
IF SY-SUBRC = 0.
**************FETCHING DATA FROM MARA***********
SELECT
MATNR
ERNAM
MTART
MBRSH
MATKL
FROM MARA INTO TABLE IT_MARA FOR ALL ENTRIES IN IT_EKPO WHERE MATNR = IT_EKPO-MATNR.
ENDIF.
ELSE.
MESSAGE 'DATA NOT FOUND' TYPE 'E'.
ENDIF.


ENDFORM. " GET_ALL_DATA
*&---------------------------------------------------------------------*
*& Form DISPLAY_EKKO
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM DISPLAY_EKKO .
WRITE: 4 sy-uline(81).
NEW-LINE.
WRITE: 4 sy-vline, 'EBELN',20 SY-VLINE,'BUKRS',36 SY-VLINE,'EKORG',52 SY-VLINE,'EKGRP',68 SY-VLINE,'LIFNR',84 SY-VLINE.
NEW-LINE.
WRITE: 4 sy-uline(81).
NEW-LINE.
LOOP AT IT_EKKO INTO WA_EKKO.
WRITE: 4 sy-vline ,WA_EKKO-EBELN HOTSPOT ON,20 SY-VLINE,WA_EKKO-BUKRS,36 SY-VLINE,WA_EKKO-EKORG,52 SY-VLINE,WA_EKKO-EKGRP,68 SY-VLINE,WA_EKKO-LIFNR,84 SY-VLINE.
CLEAR WA_EKKO.
NEW-LINE.
WRITE: 4 sy-uline(81).
NEW-LINE.
ENDLOOP.
ENDFORM. " DISPLAY_EKKO
*&---------------------------------------------------------------------*
*& Form DISPLAY_INTERACTIVE_EKPO
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM DISPLAY_INTERACTIVE_EKPO .
WRITE: 4 sy-uline(81).
NEW-LINE.
WRITE: 4 sy-vline, 'EBELN',20 SY-VLINE,'EBELP',36 SY-VLINE ,'MATNR',52 SY-VLINE,'MENGE',68 SY-VLINE,'NETPR',84 SY-VLINE.
NEW-LINE.
WRITE: 4 sy-uline(81).
NEW-LINE.
LOOP AT IT_EKPO INTO WA_EKPO WHERE EBELN = V_field.
WRITE: 4 sy-vline, WA_EKPO-EBELN,20 SY-VLINE,WA_EKPO-EBELP,36 SY-VLINE,WA_EKPO-MATNR HOTSPOT ON,52 SY-VLINE,53 WA_EKPO-MENGE,68 SY-VLINE,69 WA_EKPO-NETPR,84 SY-VLINE NO-GAP.
CLEAR WA_EKPO.
NEW-LINE.
WRITE: 4 sy-uline(81).
NEW-LINE.
ENDLOOP.
ENDFORM. " DISPLAY_INTERACTIVE_EKPO
*&---------------------------------------------------------------------*
*& Form DISPLAY_INTERACTIVE_MARA
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM DISPLAY_INTERACTIVE_MARA .
WRITE: 4 sy-uline(81).
NEW-LINE.
WRITE: 4 sy-vline, 'MATNR',20 SY-VLINE,'ERNAM',36 SY-VLINE,'MTART',52 SY-VLINE,'MBRSH',68 SY-VLINE,'MATKL',84 SY-VLINE.
NEW-LINE.
WRITE: 4 sy-uline(81).
NEW-LINE.
LOOP AT IT_MARA INTO WA_MARA WHERE MATNR = V_field.
WRITE: 4 sy-vline, WA_MARA-MATNR,20 SY-VLINE,WA_MARA-ERNAM,36 SY-VLINE,WA_MARA-MTART,52 SY-VLINE,53 WA_MARA-MBRSH,68 SY-VLINE,WA_MARA-MATKL,84 SY-VLINE NO-GAP.
CLEAR WA_MARA.
NEW-LINE.
WRITE: 4 sy-uline(81).
NEW-LINE.
ENDLOOP.
ENDFORM. " DISPLAY_INTERACTIVE_MARA
*&---------------------------------------------------------------------*
*& Form DISPLAY_TOP_OF_PAGES
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*

Admin
Admin

Posts: 75
Join date: 2012-12-23

http://forum.learnsap24x7.com

Back to top Go down

View previous topic View next topic Back to top

- Similar topics

Permissions in this forum:
You cannot reply to topics in this forum