Application Development and Automation 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: 
Read only

header table not get loaded into the internal table

Former Member
0 Likes
409

hi all

In my coding i have select some flds form the header table its not even getting loadded into the internal table whats the problem

this was my code

SELECT vbeln erdat kunnr waerk  from vbak into TABLE it_vbak where vbeln = P_sales.

   select * from vbap into table it_vbap FOR ALL ENTRIES IN it_vbak where vbeln = it_vbak-vbeln and

                                                                           erdat it_vbak-erdat and

                                                                           waerk = it_vbak-waerk.

*******  SELECT erdat waerk from vbap into table it_inf for ALL ENTRIES IN it_vbak where vbeln = it_vbak-vbeln.

   select kunnr name1 from kna1 into TABLE IT_KNA1  for ALL ENTRIES IN IT_vbak  WHERE SPRAS = 'en' AND KUNNR = it_vbak-kunnr.

  select ebeln aedat  EQ_EINDT  zterm from ekko into table it_ekko where ebeln = P_Purch.

  select * from ekpo into TABLE it_ekpo FOR ALL ENTRIES IN it_ekko where ebeln = it_ekko-ebeln and aedat = it_ekko-aedat .

loop at it_vbap into wa_vbap.

   read TABLE it_vbak into wa_vbak with key vbeln = wa_vbap-vbeln.

   if sy-subrc = 0.

   wa_final-vbeln = wa_vbap-vbeln.

   wa_final-erdat = wa_vbap-erdat.

   wa_final-waerk = wa_vbap-waerk.

   read TABLE it_kna1 into wa_kna1 with key kunnr = wa_vbak-kunnr.

   if sy-subrc = 0.

     wa_final-kunnr = wa_kna1-kunnr.

     wa_final-name1 = wa_kna1-name1.

   ENDIF.

   ENDIF.

   READ TABLE it_ekpo into wa_ekpo with key ebeln = wa_ekko-ebeln.

   if sy-subrc = 0.

     wa_final-ebeln wa_ekpo-ebeln.

     wa_final-AEDAT wa_ekpo-aedat.

     wa_final-EQ_EINDT = wa_ekko-EQ_EINDT.

   select single vtext into wa_final-vtext from  tvzbt where zterm = wa_ekko-zterm and spras = 'EN'.

   endif.

  append wa_final to it_final.

  endloop.

with thanks

Maha.

hi all

In my coding i have select some flds form the header table its not even getting loadded into the internal table whats the problem

this was my code

SELECT vbeln erdat kunnr waerk  from vbak into TABLE it_vbak where vbeln = P_sales.

   select * from vbap into table it_vbap FOR ALL ENTRIES IN it_vbak where vbeln = it_vbak-vbeln and

                                                                           erdat it_vbak-erdat and

                                                                           waerk = it_vbak-waerk.

*******  SELECT erdat waerk from vbap into table it_inf for ALL ENTRIES IN it_vbak where vbeln = it_vbak-vbeln.

   select kunnr name1 from kna1 into TABLE IT_KNA1  for ALL ENTRIES IN IT_vbak  WHERE SPRAS = 'en' AND KUNNR = it_vbak-kunnr.

  select ebeln aedat  EQ_EINDT  zterm from ekko into table it_ekko where ebeln = P_Purch.

  select * from ekpo into TABLE it_ekpo FOR ALL ENTRIES IN it_ekko where ebeln = it_ekko-ebeln and aedat = it_ekko-aedat .

loop at it_vbap into wa_vbap.

   read TABLE it_vbak into wa_vbak with key vbeln = wa_vbap-vbeln.

   if sy-subrc = 0.

   wa_final-vbeln = wa_vbap-vbeln.

   wa_final-erdat = wa_vbap-erdat.

   wa_final-waerk = wa_vbap-waerk.

   read TABLE it_kna1 into wa_kna1 with key kunnr = wa_vbak-kunnr.

   if sy-subrc = 0.

     wa_final-kunnr = wa_kna1-kunnr.

     wa_final-name1 = wa_kna1-name1.

   ENDIF.

   ENDIF.

   READ TABLE it_ekpo into wa_ekpo with key ebeln = wa_ekko-ebeln.

   if sy-subrc = 0.

     wa_final-ebeln wa_ekpo-ebeln.

     wa_final-AEDAT wa_ekpo-aedat.

     wa_final-EQ_EINDT = wa_ekko-EQ_EINDT.

   select single vtext into wa_final-vtext from  tvzbt where zterm = wa_ekko-zterm and spras = 'EN'.

   endif.

  append wa_final to it_final.

  endloop.

with thanks

Maha.

1 REPLY 1
Read only

Former Member
0 Likes
364

Hi, Mahalakshmi!

"It's not getting loaded" means that itab is empty after SELECT statement? Or you get a short dump?

If it is empty, you can go to SE16 and copypaste VBELN to check whether you have corresponding entries in your mandant. If entries are found, please check the type of P_sales (maybe wrong length and leading zeros).

If you get a short dump, please check the definition of it_vbak (number, type and order of fields) because you are using INTO TABLE addition.

Besides that I hope that there are checks that it_vbak (it_ekko) is not initial before selecting for all entries from VBAP and KNA1 (EKPO) and you just omitted them.

So, please add some info for the community to be able to help you.