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: 

Fetching data from vbak, vbap, vbrp giving error

anuja_s
Participant
0 Kudos
453

Hi All,

I am new to ABAP and geeting error for the following code.....please guide....

<Removed code>

Moderator Message: Post the relevant portions of the code only & give more specific details of the error.

Edited by: Suhas Saha on Feb 8, 2012 3:42 PM

1 ACCEPTED SOLUTION

Former Member
0 Kudos
197

this is not the way to code yar, Try to learn Basic thing in browsing the way you code itself wrong

<Removed irrelevant coding>

Edited by: Suhas Saha on Feb 8, 2012 4:15 PM

8 REPLIES 8

Former Member
0 Kudos
197

Hi,

Can you provide detail description of error in which piece of code the error is getting populated.

Regards,

Goutam Kolluru.

anuja_s
Participant
0 Kudos
197
SELECT  vbap~vbeln vbap~POSNR vbap~MATNR vbap~MATWA vbap~PMATN
  FROM VBAP INNER JOIN VBAK
  ON VBAK~VBELN = VBAP~VBELN
  INTO CORRESPONDING FIELDS OF TABLE IT_VBAP
FOR ALL ENTRIES IN IT_VBAK
WHERE VBAP~vbeln = IT_VBAK-vbeln.

SELECT    VBELN ERDAT ERZET
   FROM  VBAK  INTO CORRESPONDING FIELDS OF TABLE IT_VBAK
   WHERE      ERDAT        IN  s_ERDAT.

DATA : BEGIN OF IT_FINAL OCCURS 0,

              MANDT TYPE MANDT,
              VBELN TYPE VBELN_VA,
              ERDAT TYPE ERDAT,
              ERZET TYPE ERZET,
              TMSTMP TYPE TSTAMP,
              POSNR TYPE POSNR_VA,
              MATNR TYPE MATNR,
              MATWA TYPE MATWA,
              PMATN TYPE PMATN,
              STDAT TYPE STDAT,
              GSBER TYPE GSBER,
              VBELV TYPE VBELV,
              AUREF TYPE AUREF,
              PRSDT TYPE PRSDT,

       END OF IT_FINAL.

       data: wa_final like line of it_final.
loop at it_vbak.


it_final-MANDT = IT_VBAK-MANDT.
it_final-VBELN = IT_VBAK-VBELN.
it_final-ERDAT = IT_VBAK-ERDAT.
it_final-ERZET = IT_VBAK-ERZET.
it_final-TMSTMP = TIMESTAMP.

 loop at it_vbap.

 it_final-POSNR = IT_VBAP-POSNR.
it_final-MATNR = IT_VBAP-MATNR.
it_final-MATWA = IT_VBAP-MATWA.
it_final-PMATN = IT_VBAP-PMATN.
it_final-STDAT = IT_VBAP-STDAT.
append it_final.

endloop.
endloop.

MODIFY ZTABLE_16 FROM TABLE IT_VBAK.
MODIFY ZTABLE_16 FROM TABLE IT_VBAP.

<Modified the code format>

Error Message :The work area "IT_VBAK" is not long enough ...

Edited by: Suhas Saha on Feb 8, 2012 3:58 PM

Former Member
0 Kudos
198

this is not the way to code yar, Try to learn Basic thing in browsing the way you code itself wrong

<Removed irrelevant coding>

Edited by: Suhas Saha on Feb 8, 2012 4:15 PM

0 Kudos
197

Hey i changed the code....Now im getting data from vbrp but not getting from vbak.....The code is as below:

SELECT VBELN
       ERDAT
       ERZET
       MAHZA
       STWAE
       FROM VBAK
       INTO TABLE IT_VBAK.

SELECT VBELN
       ERDAT
       ERZET
       POSNR
       STADAT
       ZMENG
       ZIEME
       FROM VBAP
       INTO TABLE IT_VBAP
       FOR ALL ENTRIES IN IT_VBAK
       WHERE VBELN = IT_VBAK-VBELN.

 loop at it_vbap.
       concatenate it_vbap-erdat it_vbap-erzet into TIMEstamp.
       it_final-vbeln = it_vbap-vbeln.
       it_final-ERDAT = it_vbap-ERDAT.
       it_final-ERZET = it_vbap-ERZET.
       it_final-MAHZA = it_vbak-MAHZA.
       it_final-STWAE = it_vbak-STWAE.
       it_final-POSNR = it_vbap-POSNR.
       it_final-STADAT = it_vbap-STADAT.
       it_final-ZMENG = it_vbap-ZMENG.
       it_final-ZIEME = it_vbap-ZIEME.
       it_final-TMSTMP = TIMEstamp.

       append it_final.
        insert into ztable_20 values it_final.
       endloop.

Please advise.......

Regards

Anuja

Edited by: anujas on Feb 9, 2012 6:17 AM

Edited by: anujas on Feb 9, 2012 6:19 AM

0 Kudos
197

Hi,

you have to read the internal table IT_VBAK with key VBELN before moving your fields.

Regards,

Klaus

0 Kudos
197

i donno how to...

can u please show me where and how to write code for that?

0 Kudos
197

hi,

u can do by this following example

use this inside the loop

READ TABLE IT_vbak INTO WA_vbak WITH KEY vbeln = WA_FINAL-vbeln.

& give the final records as follows

WA_FINAL-FKLMG = WA_vbrp-FKLMG.

WA_FINAL-MATNR = WA_vbrp-MATNR.

WA_FINAL-ARKTX = WA_vbrp-ARKTX.

u have to read all the records into final internal table

thanks

chaitanya

Edited by: Chaitanya.M on Feb 9, 2012 7:13 AM

Edited by: Chaitanya.M on Feb 9, 2012 7:13 AM

0 Kudos
197

Hey Thanks Klaus and chaitanya....The error is resolved