2013 May 01 7:52 PM
Hello experts,
I am using BAPI_ALM_NOTIF_LIST_EQUI to return a table of Notifications for a piece of equipment using a Tables parameter.
I want to process just one notification from the internal table 'T_BAPI2080_1', but I cannot use SQL commands because the internal table is formed based on a BAPI table, which has a structure type, not a transparent table type.
How can I get the data that is in my internal table 'T_BAPI2080_1' from the BAPI structure format to a transparent table format so that I can use SQL to SELECT SINGLE and process one notification from the list?
I am familiar with using SELECT FROM INTO WHERE, but one cannot exercise these commands on an internal table that is of a structure type.
Here is my code:
FUNCTION Z_CODES.
*"----------------------------------------------------------------------
*"*"Local Interface:
*" IMPORTING
*" VALUE(IV_EQUIP) TYPE EQUI-EQUNR OPTIONAL
*" VALUE(IV_NOTIF_DATE) TYPE BAPI2080_1-NOTIFDATE OPTIONAL
*" EXPORTING
*" VALUE(EV_NOTIF) TYPE VIQMEL-QMNUM
*" TABLES
*" T_BAPI2080_1 STRUCTURE BAPI2080_1 OPTIONAL
*"----------------------------------------------------------------------
CALL FUNCTION 'BAPI_ALM_NOTIF_LIST_EQUI'
EXPORTING
EQUIPMENT = IV_EQUIP
NOTIFICATION_DATE = IV_NOTIF_DATE
COMPLETE = ' '
* PARTNERFUNCTION =
* PARTNER =
* PARTNER_USER =
* IMPORTING
* RETURN =
TABLES
NOTIFICATION = T_BAPI2080_1
...
This code returns a table that contains the list of all notifications for the equipment. I want to just select one notification from the return table 'T_BAPI2080_1' to use for further processing.
Thank you.
2013 May 01 11:25 PM
Hi Eric,
I think you missunderstand ABAP table logic.
Internal table is not database table, It's local array for program, so you can not use SELECT for this situation. If you want to access to data in your table you can use READ or LOOP:
data : ls_T_BAPI2080_1 like line of T_BAPI2080_1
" declare work area for your table, if your table has header line you dont need this and in code you dont have to write into statement, but you can not use table with header line in Object oriented ABAP.
READ T_BAPI2080_1
INTO ls_T_BAPI2080_1
WITH KEY <field> = <value>
Or :
LOOP AT T_BAPI2080_1
INTO ls_T_BAPI2080_1.
"in here you can use where condition like SELECT statement
ENDLOOP.
I hope this will help.
Tolga
2013 May 01 9:31 PM
2013 May 01 11:25 PM
Hi Eric,
I think you missunderstand ABAP table logic.
Internal table is not database table, It's local array for program, so you can not use SELECT for this situation. If you want to access to data in your table you can use READ or LOOP:
data : ls_T_BAPI2080_1 like line of T_BAPI2080_1
" declare work area for your table, if your table has header line you dont need this and in code you dont have to write into statement, but you can not use table with header line in Object oriented ABAP.
READ T_BAPI2080_1
INTO ls_T_BAPI2080_1
WITH KEY <field> = <value>
Or :
LOOP AT T_BAPI2080_1
INTO ls_T_BAPI2080_1.
"in here you can use where condition like SELECT statement
ENDLOOP.
I hope this will help.
Tolga
2013 May 02 12:09 AM
2013 May 02 3:41 AM
Hi Eric,
the bapi is returning you a internal table, so you can process it with READ or LOOP AT statement and select statements are used when you are interacting with your database table....
thanks and regards,
narayan