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

text description

Former Member
0 Likes
2,692

hi ,

FORM GET_DATA .

   select vbeln kunnr audat waerk bstnk bstdk from vbak into TABLE it_vbak where vbeln in P_sale.

   select * from vbap into table it_vbap for all ENTRIES IN it_vbak where vbeln = it_vbak-vbeln.

  select vbeln inco1 zterm from vbkd into TABLE it_vbkd for ALL ENTRIES IN it_vbak where vbeln = it_vbak-vbeln.

   select kunnr name1 ort01 from kna1 into TABLE IT_KNA1 for ALL ENTRIES IN it_vbak where kunnr = it_vbak-kunnr.

   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_vbak-vbeln.

        wa_final-audat = wa_vbak-audat.

        wa_final-waerk = wa_vbak-waerk.

        wa_final-bstnk = wa_vbak-bstnk.

        wa_final-bstdk = wa_vbak-bstdk.

       select single edatu into wa_final-edatu from vbep where vbeln = wa_vbap-vbeln."delivery date

      read table it_vbkd into wa_vbkd with key vbeln = wa_vbap-vbeln.

       if sy-subrc = 0.

       select single bezei into wa_final-bezei from tinct where inco1 = wa_vbkd-inco1 and spras = 'EN'."terms of delivery

       select single vtext into wa_final-vtext from tvzbt where zterm = wa_vbkd-zterm and spras = 'EN'."terms of payment

       endif.

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

      if sy-subrc = 0.

       wa_final-kunnr = wa_vbak-kunnr.

       wa_final-name1 = wa_kna1-name1.

       wa_final-ort01 = wa_kna1-ort01.

      endif.

      endif.

    wa_final-posnr = wa_vbap-posnr.

    wa_final-matnr = wa_vbap-matnr.

    wa_final-arktx = wa_vbap-arktx.

    wa_final-netpr = wa_vbap-netpr.

    wa_final-netwr = wa_vbap-netwr.

    wa_final-kpein = wa_vbap-kpein.

    wa_final-kmein = wa_vbap-kmein.

    wa_final-ZMENG = wa_vbap-zmeng.

    APPEND wa_final to it_final.

    endloop.

ENDFORM.                    " GET_DATA




am getting all the values except that terms of payment and terms  of delivery am not getting i dont know what mistake i did (bezei fld and vtext fld )


please help me




17 REPLIES 17
Read only

Former Member
0 Likes
2,651

Hi Mahalakshmi ;

Did you check the 'TINCT' table from se16n or with debugging; may be space the description of the text

field.

Regards.

Özgün.

Read only

0 Likes
2,651

hi,

I have checked  it

Read only

0 Likes
2,651

Check you other thread

http://scn.sap.com/thread/3626811

You are reading your tables with SPRAS = 'EN' instead of SPRAS = 'E'

Read only

Former Member
0 Likes
2,651

Hi,

The Language Key in the tables in 1 digit, though the selection screen allows us to enter EN. Did you try replacing EN with E and check.

Regards,

Shashi Thakur

Read only

0 Likes
2,651

Hi i have replaced the en with 'e' but its not showing its text in debugging part i have checked

Read only

0 Likes
2,651

Please, put a screenshot with the debugging and the content of the table

Read only

0 Likes
2,651

Read only

0 Likes
2,651

and tvzbt contains your value for EN language?

Read only

Former Member
0 Likes
2,651

Hi Mahalakshmi,

Check the conditions , which you are using to extract the desired text.

Thanks & Regards,

Swati

Read only

Former Member
0 Likes
2,651

Hi,

Please check it for internal table is initial or not.

   select vbeln kunnr audat waerk bstnk bstdk from vbak into TABLE it_vbak where vbeln in P_sale.

  if it_vbak is not initial.

   select * from vbap into table it_vbap for all ENTRIES IN it_vbak where vbeln = it_vbak-vbeln.

endif.

if it_vbap is not initial.

   select vbeln inco1 zterm from vbkd into TABLE it_vbkd for ALL ENTRIES IN it_vbak where vbeln = it_vbak-vbeln.

endif.

if it_vbkd is not initial.

   select kunnr name1 ort01 from kna1 into TABLE IT_KNA1 for ALL ENTRIES IN it_vbak where kunnr = it_vbak-kunnr.

endif.

Read only

RaymondGiuseppi
Active Contributor
0 Likes
2,651

There is a conversion-exit on SPRAS/LANGU fields, 'EN' is external format, where 'E' is internal format. So replace 'EN' with 'E' in your SELECT.

Regards,

Raymond

Read only

0 Likes
2,651

I have replaced that but it showing the same

Read only

0 Likes
2,651

Then replace the not optimized

SELECT vbeln kunnr audat waerk bstnk bstdk FROM vbak 
   INTO TABLE it_vbak WHERE vbeln IN p_sale.
SELECT * FROM vbap
   INTO TABLE it_vbap FOR ALL ENTRIES IN it_vbak WHERE vbeln = it_vbak-vbeln.
SELECT vbeln inco1 zterm FROM vbkd
   INTO TABLE it_vbkd FOR ALL ENTRIES IN it_vbak WHERE vbeln = it_vbak-vbeln.

with


SELECT vbeln kunnr audat waerk bstnk bstdk FROM vbak
   INTO TABLE it_vbak WHERE vbeln IN p_sale.
SELECT * FROM vbap
   INTO TABLE it_vbap WHERE vbeln IN p_sale.
SELECT vbeln inco1 zterm FROM vbkd
   INTO TABLE it_vbkd WHERE vbeln IN p_sale.

Here FOR ALL ENTRIES is not required and will hamper performance

Questions

  • Can you post definition of internal table (only type and keys)
  • Are you working with actual Sales Order (so same number for VBELN in VBAK and VBRP) or ?

Regard,

Raymond

Read only

0 Likes
2,651

Hi

The VBKD table has Key fields as VBELN and POSNR. So try changing your query to

select vbeln posnr inco1 zterm from vbkd into TABLE it_vbkd for ALL ENTRIES IN it_vbak wherevbeln = it_vbak-vbeln.

read table it_vbkd into wa_vbkd with key vbeln = wa_vbap-vbeln  posnr = wa_vbap-posnr.


Regards,

Shashi Thakur

Read only

0 Likes
2,651

s

tables:vbak,vbpa,vbap,vbkd,vbep.

types:begin of ty_vbak,

       vbeln type vbeln_va,"sales order

       kunnr type kunag,"customer no

       audat type audat,"doc date

       waerk type waerk,"currency

       bstnk type bstnk,"Po number

       bstdk type bstdk,"po date

       end of ty_vbak.

types:begin of ty_vbkd,

       vbeln type vbeln,

       inco1 type inco1,

       zterm type dzterm,

       end of ty_vbkd.

TYPES:BEGIN OF TY_KNA1,

       KUNNR TYPE KUNAG, " Customer No.

       NAME1 TYPE NAME1_GP," name

       ORT01 type ORT01_GP,

       END OF TY_KNA1.

types:begin of ty_final,

       vbeln type vbeln_va,"

       kunnr type kunag,

       audat type audat,

       waerk type waerk,

       bstnk type bstnk,

       bstdk type bstdk,"Po date

       NAME1 TYPE NAME1_GP," name

       ORT01 type ORT01_GP,

       edatu type edatu,

       inco1 type inco1,

       bezei type bezei30,

       vtext type dzterm_bez,

       posnr type posnr_va,

       matnr type matnr,

       arktx type arktx,

       kpein type kpein,

       netpr type netpr,

       netwr type netwr_ap,

       kmein type kmein,

       zmeng type dzmeng,

       end of ty_final.

  data:it_vbak type STANDARD TABLE OF ty_vbak,

       wa_vbak type ty_vbak,

       it_vbap type STANDARD TABLE OF vbap,

       wa_vbap type vbap,

       it_vbkd type STANDARD TABLE OF ty_vbkd,

       wa_vbkd type vbkd,

       it_final type STANDARD TABLE OF ty_final,

       wa_final type ty_final,

       it_kna1 type STANDARD TABLE OF ty_kna1,

       wa_kna1 type ty_kna1.

Read only

0 Likes
2,651

Ok,

  • Shashi is right, here you will always read VBKD record related to SO header, and never detail items , so if some item have a divergent Incoterm, you may get wrong value.
  • Use same type for internal table and work area, it_vbkd is ty_vbkd where wa_vnkd is vbkd,
  • Also consider redefining most of the internal tables has sorted types, to get better performance.


Regards,
Raymond

Read only

0 Likes
2,651

Hi,

I am working on sales order the number usually same really thanks for all the replies I will resolve that issue even I have not noticed that Wa_vbkd type vbkd in declaration kd

Thanks

Maha