Skip to Content
author's profile photo Former Member
Former Member

Perform - syntax

Hi ,

Iam trying to write an extractor for open and closed items ie form BSAD and BSID .

So i have written the logic .when i tryed to modularise the code .the function module is not acteping the perform statment

Ie when i tryed to put the logic in to a perfoem its giving a syntax error like

"Field "E_T_DATA" is unknown. It is neither in one of the specified

tables nor defined by a "DATA" statement . . . . . . . . . . "

can you please provide me a solution for this .

Thanks ,

Sriram.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • Posted on Nov 22, 2007 at 09:55 AM

    can you copy your code here?

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi ,

      As you have asked for below i have attached the code .

      PERFORM FETCH_BSID .

      *PERFORM FETCH_BSAD TABLES E_T_DATA.

      this are the two perform iam trying to create just to moduralize the code .it it showing an error like .E_T_DATA is not defined which is the final extract structure .

      *"----


      ""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

      *" VALUE(I_REMOTE_CALL) TYPE SBIWA_FLAG DEFAULT SBIWA_C_FLAG_OFF

      *" 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 TYPE ZBIAR_EXTRACTOR_AR1 OPTIONAL

      *" EXCEPTIONS

      *" NO_MORE_DATA

      *" ERROR_PASSED_TO_MESS_HANDLER

      *"----


      &----


      *& Function Module : Z01_FBIWI_AR_EXTRACTOR *

      *& Title : Extractor Industrial - AR *

      *& Programmer : TSHANKAR *

      *& Date : 16/11/2007 *

      *& Transaction : *

      *& Description : This extractor fetches data fetches data from *

      • tables BSID ,BSAD, KNVP,Z02TOTC_AR_DOC_H for closed *

      • and open item and populate into final extract *

      • structure FOR CLOSED *

      ----


      • Modification Log: *

      • Date Author Corr. # Description *

      • -------- ----------- ----------- -------------------------------------*

      • mm/dd/yy SAPLOGONNAM xxxxxxxxxx Initial program development *

      • TSHANKAR Changes made to the application *

      • path *

      ****************************************************************************

      **DATA DECLERATION

      • 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,

      S_CURSOR1 TYPE CURSOR.

      DATA : FLAG_BSID TYPE I VALUE 0.

      • Initialization mode (first call by SAPI) or data transfer mode

      • (following calls) ?

      IF I_INITFLAG = SBIWA_C_FLAG_ON.

      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 ?

      ************************************************************************

      • Data transfer: First Call OPEN CURSOR + FETCH

      • Following Calls FETCH only

      ************************************************************************

      • First data package -> OPEN CURSOR

      IF S_COUNTER_DATAPAKID = 0.

      • Fill range tables BW will only pass down simple selection criteria

      • of the type SIGN = 'I' and OPTION = 'EQ' or OPTION = 'BT'.

      LOOP AT S_S_IF-T_SELECT INTO L_S_SELECT WHERE FIELDNM = 'BUKRS'.

      MOVE-CORRESPONDING L_S_SELECT TO R_BUKRS.

      APPEND R_BUKRS.

      ENDLOOP.

      LOOP AT S_S_IF-T_SELECT INTO L_S_SELECT WHERE FIELDNM = 'KUNNR'.

      MOVE-CORRESPONDING L_S_SELECT TO R_KUNNR.

      APPEND R_KUNNR.

      ENDLOOP.

      LOOP AT S_S_IF-T_SELECT INTO L_S_SELECT WHERE FIELDNM = 'GJAHR'.

      MOVE-CORRESPONDING L_S_SELECT TO R_GJAHR.

      APPEND R_GJAHR.

      ENDLOOP.

      LOOP AT S_S_IF-T_SELECT INTO L_S_SELECT WHERE FIELDNM = 'CPUDT'.

      MOVE-CORRESPONDING L_S_SELECT TO R_CPUDT.

      APPEND R_CPUDT.

      ENDLOOP.

      • Determine number of database records to be read per FETCH statement

      • from input parameter I_MAXSIZE. If there is a one to one relation

      • between DataSource table lines and database entries, this is trivial.

      • In other cases, it may be impossible and some estimated value has to

      • be determined.

      OPEN CURSOR WITH HOLD S_CURSOR FOR

      SELECT MANDT KUNNR WRBTR XREF3 BUKRS BELNR GJAHR BUZEI WAERS BLDAT

      BUDAT BLART XBLNR SHKZG DMBTR GSBER ZFBDT ZLSCH ZUONR ZTERM

      KIDNO XREF1 XREF2 SGTXT MABER HKONT PRCTR KOSTL AUFNR PROJK

      VBUND

      FROM BSID WHERE BUKRS IN R_BUKRS AND KUNNR IN R_KUNNR AND

      GJAHR IN R_GJAHR AND

      CPUDT IN R_CPUDT .

      OPEN CURSOR WITH HOLD S_CURSOR1 FOR

      SELECT MANDT KUNNR WRBTR XREF3 BUKRS BELNR GJAHR BUZEI WAERS BLDAT

      BUDAT BLART XBLNR SHKZG DMBTR GSBER ZFBDT ZLSCH ZUONR ZTERM

      KIDNO XREF1 XREF2 SGTXT MABER HKONT PRCTR KOSTL AUFNR PROJK

      VBUND

      FROM BSAD WHERE BUKRS IN R_BUKRS AND KUNNR IN R_KUNNR AND

      GJAHR IN R_GJAHR AND

      CPUDT IN R_CPUDT .

      ENDIF. "First data package ?

      • Fetch records into interface table.

      FETCH NEXT CURSOR S_CURSOR

      APPENDING CORRESPONDING FIELDS

      OF TABLE IT_BSID

      PACKAGE SIZE S_S_IF-MAXSIZE.

      • FETCH NEXT CURSOR S_CURSOR1

      • APPENDING CORRESPONDING FIELDS

      • OF TABLE IT_BSAD

      • PACKAGE SIZE S_S_IF-MAXSIZE.

      IF SY-SUBRC <> 0.

      CLOSE CURSOR S_CURSOR.

      RAISE NO_MORE_DATA.

      ENDIF.

      S_COUNTER_DATAPAKID = S_COUNTER_DATAPAKID + 1.

      ENDIF. "Initialization mode or data extraction ?

      PERFORM FETCH_BSID .

      *PERFORM FETCH_BSAD TABLES E_T_DATA.

      *FORM FETCH_BSID TABLES P_E_T_DATA type ZBIAR_EXTRACTOR_AR2.

      • SORT IT_BSID BY KUNNR BUKRS GJAHR .

      *

      • CHECK NOT IT_BSID[] IS INITIAL .

      *

      • PERFORM FILL_Z02TOTC_AR_DOC_H.

      • PERFORM FILL_KNVP.

      *

      • LOOP AT IT_BSID .

      *

      • READ TABLE IT_Z02TOTC_AR_DOC_H WITH KEY BELNR = IT_BSID-BELNR

      • BUKRS = IT_BSID-BUKRS

      • GJAHR = IT_BSID-GJAHR

      • BUZEI = IT_BSID-BUZEI.

      *

      • LOOP AT IT_Z02TOTC_AR_DOC_H FROM SY-TABIX.

      • IF SY-SUBRC IS INITIAL .

      *

      • IF IT_Z02TOTC_AR_DOC_H-BELNR <> IT_BSID-BELNR

      • OR IT_Z02TOTC_AR_DOC_H-BUKRS <> IT_BSID-BUKRS

      • OR IT_Z02TOTC_AR_DOC_H-GJAHR <> IT_BSID-GJAHR.

      • OR IT_Z02TOTC_AR_DOC_H-BUZEI <> IT_BSID-BUZEI.

    • EXIT .

    • *

      • ENDIF .

      *

      • READ TABLE IT_KNVP WITH KEY KUNNR = IT_BSID-KUNNR

      • VKORG = IT_BSID-BUKRS.

      *

      • IF SY-SUBRC IS INITIAL.

      • MOVE-CORRESPONDING IT_KNVP TO E_T_DATA.

      • MOVE-CORRESPONDING IT_Z02TOTC_AR_DOC_H TO E_T_DATA.

      • MOVE-CORRESPONDING IT_BSID TO E_T_DATA.

      *

      • APPEND E_T_DATA.

      *

      *

      • ENDIF .

      • ENDIF.

      • ENDLOOP .

      *

      • ENDLOOP .

      *

      *

      *FREE : IT_BSID ,IT_Z02TOTC_AR_DOC_H ,IT_KNVP.

      *ENDFORM.

      ENDFUNCTION. " End of Function Z01_FBIWI_AR_EXTRACTOR

      **form for fetching cleared entries

      *FORM FETCH_BSAD using P_E_T_DATA LIKE ZBIAR_EXTRACTOR_AR2

      • changing e_t_data type p_e_t_data.

      *

      *

      *

      • SORT IT_BSAD BY KUNNR BUKRS GJAHR .

      *

      • CHECK NOT IT_BSAD[] IS INITIAL .

      *

      • PERFORM FILL_Z02TOTC_AR_DOC_H_BSAD.

      • PERFORM FILL_KNVP_BSAD.

      *

      • LOOP AT IT_BSAD .

      *

      • READ TABLE IT_Z02TOTC_AR_DOC_H_BSAD WITH KEY BELNR = IT_BSAD-BELNR

      • BUKRS = IT_BSAD-BUKRS

      • GJAHR = IT_BSAD-GJAHR

      • BUZEI = IT_BSAD-BUZEI.

      *

      • LOOP AT IT_Z02TOTC_AR_DOC_H_BSAD FROM SY-TABIX.

      • IF SY-SUBRC IS INITIAL .

      *

      • IF IT_Z02TOTC_AR_DOC_H_BSAD-BELNR <> IT_BSAD-BELNR

      • OR IT_Z02TOTC_AR_DOC_H_BSAD-BUKRS <> IT_BSAD-BUKRS

      • OR IT_Z02TOTC_AR_DOC_H_BSAD-GJAHR <> IT_BSAD-GJAHR.

      • OR IT_Z02TOTC_AR_DOC_H-BUZEI <> IT_BSID-BUZEI.

    • EXIT .

    • *

      • ENDIF .

      *

      • READ TABLE IT_KNVP_BSAD WITH KEY KUNNR = IT_BSAD-KUNNR

      • VKORG = IT_BSAD-BUKRS.

      *

      • IF SY-SUBRC IS INITIAL.

      • MOVE-CORRESPONDING IT_KNVP_BSAD TO P_E_T_DATA.

      • MOVE-CORRESPONDING IT_Z02TOTC_AR_DOC_H_BSAD TO P_E_T_DATA.

      • MOVE-CORRESPONDING IT_BSAD TO P_E_T_DATA.

      *

      • APPEND P_E_T_DATA.

      *

      *

      • ENDIF .

      • ENDIF.

      • ENDLOOP .

      *

      • ENDLOOP .

      *

      *

      *FREE : IT_BSAD ,IT_Z02TOTC_AR_DOC_H ,IT_KNVP.

      *

      *

  • author's profile photo Former Member
    Former Member
    Posted on Nov 22, 2007 at 10:29 AM

    Hi Gurus ,

    Iam trying to create the extractor as a function module .please provide me a solution.

    Thanks ,

    Sriram

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Eric Cartman

      But simlarly for select querys and all i can able to have aseperate perform .

      Can you explain me what would be the actual problem with this part of the code .

      FORM FETCH_BSID TABLES E_T_DATA structure ZBIAR_EXTRACTOR_AR2 .

      SORT IT_BSID BY KUNNR BUKRS GJAHR .

      CHECK NOT IT_BSID[] IS INITIAL .

      PERFORM FILL_Z02TOTC_AR_DOC_H.

      PERFORM FILL_KNVP.

      LOOP AT IT_BSID .

      READ TABLE IT_Z02TOTC_AR_DOC_H WITH KEY BELNR = IT_BSID-BELNR

      BUKRS = IT_BSID-BUKRS

      GJAHR = IT_BSID-GJAHR

      BUZEI = IT_BSID-BUZEI.

      LOOP AT IT_Z02TOTC_AR_DOC_H FROM SY-TABIX.

      IF SY-SUBRC IS INITIAL .

      IF IT_Z02TOTC_AR_DOC_H-BELNR <> IT_BSID-BELNR

      OR IT_Z02TOTC_AR_DOC_H-BUKRS <> IT_BSID-BUKRS

      OR IT_Z02TOTC_AR_DOC_H-GJAHR <> IT_BSID-GJAHR.

      • OR IT_Z02TOTC_AR_DOC_H-BUZEI <> IT_BSID-BUZEI.

      EXIT .

      ENDIF .

      READ TABLE IT_KNVP WITH KEY KUNNR = IT_BSID-KUNNR

      VKORG = IT_BSID-BUKRS.

      IF SY-SUBRC IS INITIAL.

      MOVE-CORRESPONDING IT_KNVP TO E_T_DATA.

      MOVE-CORRESPONDING IT_Z02TOTC_AR_DOC_H TO E_T_DATA.

      MOVE-CORRESPONDING IT_BSID TO E_T_DATA.

      APPEND E_T_DATA.

      ENDIF .

      ENDIF.

      ENDLOOP .

      ENDLOOP .

  • Before answering

    You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
    You must be Logged in to submit an answer.

    Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.