SAP R/3 форум ABAP консультантов
Russian ABAP Developer's Club

Home - FAQ - Search - Memberlist - Usergroups - Profile - Log in to check your private messages - Register - Log in - English
Blogs - Weblogs News

BAPI_BUS_EVENTTYPE_LIST



 
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> Interfaces | Интерфейсы -> BAPI
View previous topic :: View next topic  
Author Message
admin
Администратор
Администратор



Joined: 01 Sep 2007
Posts: 1640

PostPosted: Sat Apr 26, 2008 4:47 pm    Post subject: BAPI_BUS_EVENTTYPE_LIST Reply with quote

BAPI_BUS_EVENTTYPE_LIST - Business event types in business event group

Code:
FUNCTION Z_HR_BIW_BUSINESS_EVENT_ATTR .
*"----------------------------------------------------------------------
""Local interface:
*" IMPORTING
*" VALUE(I_REQUNR) TYPE SRSC_S_IF_SIMPLE-REQUNR
*" VALUE(I_DSOURCE) TYPE SRSC_S_IF_SIMPLE-DSOURCE OPTIONAL
*" VALUE(I_MAXSIZE) TYPE SRSC_S_IF_SIMPLE-MAXSIZE OPTIONAL
*" VALUE(I_INITFLAG) TYPE SRSC_S_IF_SIMPLE-INITFLAG OPTIONAL
*" VALUE(I_READ_ONLY) TYPE SRSC_S_IF_SIMPLE-READONLY OPTIONAL
*" TABLES
*" I_T_SELECT TYPE SRSC_S_IF_SIMPLE-T_SELECT OPTIONAL
*" I_T_FIELDS TYPE SRSC_S_IF_SIMPLE-T_FIELDS OPTIONAL
*" E_T_DATA STRUCTURE ZBW_BUSEVENT_ATTR OPTIONAL
*" EXCEPTIONS
*" NO_MORE_DATA
*" ERROR_PASSED_TO_MESS_HANDLER
*"----------------------------------------------------------------------

*Auxiliary Selection criteria structure
DATA: L_S_SELECT TYPE SRSC_S_SELECT,
LT_ITAB LIKE BAPIETDAT OCCURS 0 WITH HEADER LINE.
DATA : LT_DESC LIKE BAPIDESC OCCURS 0 WITH HEADER LINE.

*Ranges
RANGES : L_R_PLVAR FOR BAPIETDAT-PLVAR,
L_R_BEGDA FOR BAPIDATE-BEGDA,
L_R_ENDDA FOR BAPIDATE-ENDDA.

*Maximum number of lines for DB table
STATICS: S_S_IF TYPE SRSC_S_IF_SIMPLE,

*counter
S_COUNTER_DATAPAKID LIKE SY-TABIX,

*cursor
S_CURSOR TYPE CURSOR.

*Initialization mode (first call by SAPI) or data transfer mode (following calls) ?
IF I_INITFLAG = SBIWA_C_FLAG_ON.

************************************************************************
*Initialization: check input parameters
*buffer input parameters
*prepare data selection
************************************************************************

*Check DataSource validity
CASE I_DSOURCE.
WHEN 'ZBUS_EVENTTYPE_ATTR'.

WHEN OTHERS.
IF 1 = 2. MESSAGE E009(R3). ENDIF.
*this is a typical log call. Please write every error message like this
LOG_WRITE 'E' "message type
'R3' "message class
'009' "message number
I_DSOURCE "message variable 1
' '. "message variable 2
RAISE ERROR_PASSED_TO_MESS_HANDLER.
ENDCASE.

APPEND LINES OF I_T_SELECT TO S_S_IF-T_SELECT.

*Fill parameter buffer for data extraction calls
S_S_IF-REQUNR = I_REQUNR.
S_S_IF-DSOURCE = I_DSOURCE.
S_S_IF-MAXSIZE = I_MAXSIZE.

*Fill field list table for an optimized select statement
*(in case that there is no 1:1 relation between InfoSource fields
*and database table fields this may be far from beeing trivial)
APPEND LINES OF I_T_FIELDS TO S_S_IF-T_FIELDS.

ELSE. "Initialization mode or data extraction ?

CALL FUNCTION 'BAPI_BUS_EVENTTYPE_LIST'
EXPORTING
PLVAR = '01'
OBJID = '00000000'
LANGUAGE = SY-LANGU
TABLES
EVENTTYPE_LIST = LT_ITAB
EXCEPTIONS
NO_EVENTTYPES = 1
NO_ACTIVE_PLVAR = 2
ROOT_NOT_FOUND = 3
WEGID_NOT_FOUND = 4
UNKNOWN_EXCEPTION = 5
OTHERS = 6.

*Extract long description
LOOP AT LT_ITAB.

REFRESH LT_DESC.
CLEAR LT_DESC.

MOVE-CORRESPONDING LT_ITAB TO E_T_DATA.
CALL FUNCTION 'BAPI_BUS_EVENTTYPE_INFO'
EXPORTING
PLVAR = LT_ITAB-PLVAR
OBJID = LT_ITAB-ETYID
BEGIN_DATE = LT_ITAB-ETBEG
END_DATE = LT_ITAB-ETEND
LANGUAGE = SY-LANGU
TABLES
EVENTTYPE_DESC = LT_DESC[]
EXCEPTIONS
ROOT_NOT_FOUND = 1
NO_ACTIVE_PLVAR = 2
UNKNOWN_EXCEPTION = 3
OTHERS = 4
.
IF SY-SUBRC 0.
ELSE.
READ TABLE LT_DESC INDEX 1.
E_T_DATA-TEXT1 = LT_DESC-LINE.
READ TABLE LT_DESC INDEX 2.
E_T_DATA-TEXT2 = LT_DESC-LINE.
READ TABLE LT_DESC INDEX 3.
E_T_DATA-TEXT3 = LT_DESC-LINE.
ENDIF.
TRANSLATE E_T_DATA TO UPPER CASE.
APPEND E_T_DATA.
CLEAR E_T_DATA.
ENDLOOP.

S_COUNTER_DATAPAKID = S_COUNTER_DATAPAKID + 1.

ENDIF. "First data package ?

IF S_COUNTER_DATAPAKID > 1.
RAISE NO_MORE_DATA.
ENDIF.

ENDFUNCTION.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> Interfaces | Интерфейсы -> BAPI All times are GMT + 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


All product names are trademarks of their respective companies. SAPNET.RU websites are in no way affiliated with SAP AG.
SAP, SAP R/3, R/3 software, mySAP, ABAP, BAPI, xApps, SAP NetWeaver and any other are registered trademarks of SAP AG.
Every effort is made to ensure content integrity. Use information on this site at your own risk.