Using Internal tables in ABAP Objects

Go down

Using Internal tables in ABAP Objects

Post  Admin on Sun Apr 08, 2012 9:43 pm

*&---------------------------------------------------------------------*
*& Report Z_10
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*

REPORT Z_OOPS_10.

TYPES:BEGIN OF TY_EKPO,
EBELN TYPE EBELN,EBELP TYPE EBELP,MENGE TYPE EKPO-MENGE,NETPR TYPE EKPO-NETPR,
END OF TY_EKPO.
DATA: IT_EKPO TYPE STANDARD TABLE OF TY_EKPO.
DATA: WA_EKPO TYPE TY_EKPO.
*----------------------------------------------------------------------*
* CLASS c1 DEFINITION
*----------------------------------------------------------------------*
CLASS C1 DEFINITION.
PUBLIC SECTION.
METHODS: GET_EKPO IMPORTING EBELN TYPE EBELN
EXPORTING ITAB_EKPO TYPE ANY TABLE.
ENDCLASS. "c1 DEFINITION
.
*----------------------------------------------------------------------*
* CLASS c1 IMPLEMENTATION
*----------------------------------------------------------------------*
CLASS C1 IMPLEMENTATION.
METHOD: GET_EKPO.
SELECT EBELN EBELP MENGE NETPR FROM EKPO INTO TABLE ITAB_EKPO
WHERE EBELN = EBELN.
ENDMETHOD. "get_ekpo
ENDCLASS. "c1 IMPLEMENTATION

START-OF-SELECTION.
PARAMETERS: P_EBELN TYPE EBELN.

DATA: O1 TYPE REF TO C1.
CREATE OBJECT O1.

CALL METHOD O1->GET_EKPO
EXPORTING
EBELN = P_EBELN
IMPORTING
ITAB_EKPO = IT_EKPO.
LOOP AT IT_EKPO INTO WA_EKPO.
WRITE: / WA_EKPO-EBELN,WA_EKPO-EBELP,WA_EKPO-MENGE,WA_EKPO-NETPR.
ENDLOOP.

Admin
Admin

Posts : 92
Join date : 2012-01-26

http://mysaplab.forumotion.com

Back to top Go down

Back to top

- Similar topics

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