Hi, I am new to ABAP .
My Use case is,
I want to get all "not processed " ,"Partially processed" and "Completed" orders for a given Customer Number.
For that, I am selecting some fields of "VBAK" table on basis of "KUNNR" and JOINING "VBUK" table on "VBLEN".
In "VBUK" i am using "GBSTK" to check the order status.
I want to return this list from this Function Module.
Im using "into it_vbak" clause, the field order in select statement and the order in structure is same.
I have written folloing code.
FUNCTION ZCUSTOMER_ORDER.
*"----------------------------------------------------------------------
*"*"Local Interface:
*" EXPORTING
*" REFERENCE(ORDERS) TYPE ZTABLECUSTALLORDER
*"----------------------------------------------------------------------
TABLES:VBAK,VBUK.
DATA: it_vbak TYPE TABLE OF ZALLORDERS INITIAL SIZE 100,
wa_vbak TYPE ZALLORDERS.
*DATA: it_vbak like standard table of ZALLORDERS,
* wa_vbak TYPE it_vbak.
*DATA: ty_VBAK1 like standard table of ty_VBAK with header line with key VBLEN.
*DATA: wa_VBAK like Line of ty_VBAK1.
select VBAK~VBELN
VBAK~ERNAM
VBAK~ANGDT
VBAK~BNDDT
VBAK~BSTNK
VBAK~BSTDK
VBAK~TELF1
VBAK~NETWR
VBAK~WAERK
VBUK~GBSTK
into it_vbak
from VBAK
join VBUK on ( VBAK~VBELN = VBUK~VBELN ) where
VBUK~GBSTK in ('A','B','C') and VBAK~KUNNR = '0000000001'.
loop at it_vbak into wa_vbak.
WRITE:/ wa_vbak-vblen,
wa_vbak-angdt,
wa_vbak-bnddt.
endloop.
*READ TABLE it_vbak INTO ORDERS.
ENDFUNCTION.
The "ZTABLECUSTALLORDER" is my export type from Function module, This is a table of structure (Line Type) .
The structure is ZALLORDERS, The components are displayed in following Image.
When i am trying to compile this code, it is giving "
You cannot use an internal table as a work area
" error.
Could some one please help me, what i am doing which is incorrect here.
Thanks in advance