Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

RE :Issue in syntax errors in ABAP

sri_harsha2
Participant
0 Kudos

Hello Gurus,

I am new to ABAP coding I was working on the code for doing a look up from the tables in CO- PA my requirement was to do a look up for

VBRP- VBELN = COPA WEBEL (Bbilling document )

VBRP-AUBEL = COPA RRKAUFNR sales document

VBRP -AUPOS = COPA KDPOS (sales document item )

AND

VBRP - CHARG is NOT EQUAL to speces  ( CHARG = batch number )

to retreive the batch number we are doing the look up between this two tables.

code already existing in the user exit :

  

REPORT  ZBW1_CO_PA_AAFI1                        .
************************************************************************
*      Form called dynamically must start with FORM_ + <DataSource> *
************************************************************************

FORM FORM_1_CO_PA_AAFI1 TABLES I_T_DATA.

  FIELD-SYMBOLS: <FS> LIKE ZOXDEV0201.

  Data:       l_msgv TYPE symsgv,
              l_subrc LIKE sy-subrc.

  LOOP AT I_T_DATA ASSIGNING <FS>.

* Call to line item table to get Point of Valuation for COS Revaluation
* recon. Make call only for actual (not plan) data.

  IF <FS>-wrttp = '10'.
    SELECT SINGLE copa_bwzpt frwae
      INTO (<FS>-zzbwzpt, <FS>-zzfrwae)
      FROM ce1ashi
      WHERE belnr = <FS>-belnr.

    CASE sy-subrc.
      when 0.
      when others.
        clear:<FS>-zzbwzpt,
              <FS>-zzfrwae.
        l_subrc = sy-subrc.
        l_msgv = <FS>-belnr.
        MESSAGE ID 'ZBW' TYPE 'X' NUMBER '000'
          WITH 'BELNR' l_msgv l_subrc.
    ENDCASE.
  ENDIF.

  ENDLOOP. "I_T_DATA.

endform.       

FORM FORM_1_CO_PA_AAFI1 TABLES I_T_DATA.

  

The code I wanted to introudce for look up

DATA : I_T_DATA  TYPE STANDARD TABLE OF Y_VBRP

   IF  <FS> =  I_T_DATA

  SELECT VBELN

               AUBEL

               AUPOS

               FROM VBRP INTO I_T_DATA  FOR ALL ENTRIES

               where

              VBRP- VBELN = <FS>- WWBEL

              VBRP- AUBEL = <FS>-RKAUFNR

              VBRP- AUPOS = <FS>-KDPOS

              VBRP-CHARG IS NOT EQUAL TO 'SPACE'

    SORT  I_T_VBRP BY VBELN

    ENDIF.

  It was throwing syntax errors when  I have introudced this code to the existing exit. I request you to let me know if  there are syntax and logical errors in the above statements and guide me in correcting this.

Thanks    

I

1 ACCEPTED SOLUTION

Former Member
0 Kudos

HI,

The entire select statement is syntactically wrong.

  SELECT VBELN

               AUBEL

               AUPOS

               FROM VBRP INTO TABLE I_T_DATA  FOR ALL ENTRIES in (table)

               where

              VBRP- VBELN = <FS>- WWBEL    and

              VBRP- AUBEL = <FS>-RKAUFNR   and

              VBRP- AUPOS = <FS>-KDPOS     and

              VBRP-CHARG NE 'SPACE'.

thanks  

4 REPLIES 4

Former Member
0 Kudos

HI,

The entire select statement is syntactically wrong.

  SELECT VBELN

               AUBEL

               AUPOS

               FROM VBRP INTO TABLE I_T_DATA  FOR ALL ENTRIES in (table)

               where

              VBRP- VBELN = <FS>- WWBEL    and

              VBRP- AUBEL = <FS>-RKAUFNR   and

              VBRP- AUPOS = <FS>-KDPOS     and

              VBRP-CHARG NE 'SPACE'.

thanks  

Former Member
0 Kudos

Hi harsha,

select query is wrong pls check it once n let me know if u get any errors further.

pls refer the link once.

http://help.sap.com/abapdocu_702/en/abenwhere_logexp_itab.htm

regards,

chandu.

basarozgur_kahraman
Contributor
0 Kudos

Hi Sri,

change you select like below.

   SELECT vbeln aubel aupos

   INTO TABLE i_t_data

   FROM vbrp

   FOR ALL ENTRIES IN <fs>

   WHERE vbeln = <fs>-WWBEL

     AND aubel = <fs>-RKAUFNR

     AND aupos = <fs>-KDPOS

     AND charg <> space.

But there are also logical error. after declaration of I_T_DATA, internal table will be empty and you are running select statement after comparing this empty table. In this case you will query all of the database!!

Please, be sure not to use empty tables in 'for all entries' statement.



sri_harsha2
Participant
0 Kudos

Thank you Aswatha, ravi and Basar.