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

Problem in fetching data from different tables !

Former Member
0 Likes
722

Hi friends plz check this program. I am not getting data for tvm1t-bezei,tvm2t-bezei,tvm3t-bezei.....etc etc. i know i should use for all entries but i have no time.

Please check it and correct it.

REPORT YINTERACTIVEPROGRAM01.

TABLES:VBAP,

VBPA,

VBRP,

VBRK,

KNA1,

ADRC,

TPAR,

TVKGG,

TVM1T,

TVM2T,

TVM3T,

TVM4T,

VBKD,

SZA1_D0100,

TVLVT,

T002,

T178T.

TYPES:BEGIN OF TY_TAB,

VBELN LIKE VBAK-VBELN,

VKORG LIKE VBAK-VKORG,

ERDAT LIKE VBAK-ERDAT,

AUGRU LIKE VBAK-AUGRU,

BSTDK LIKE VBKD-BSTDK,

BSTDK_E LIKE VBKD-BSTDK_E,

spart like vbap-spart,

kondm like vbap-kondm,

waerk like vbap-waerk,

netwr like vbap-netwr,

kwmeng like vbap-kwmeng,

vkaus like vbap-vkaus,

land1 like vbpa-land1,

nrart like tpar-nrart,

  • vtext like tpar-vtext,

parvw like tpar-parvw,

name1 like adrc-name1,

name2 like adrc-name2,

name3 like adrc-name3,

name4 like adrc-name4,

ort01 like kna1-ort01,

pstlz like kna1-pstlz,

vtext like t178t-vtext,

bezei1 like tvm1t-bezei,

bezei2 like tvm2t-bezei,

bezei3 like tvm3t-bezei,

bezei4 like tvm4t-bezei,

BEZEI like tvlvt-bezei,

spras like t002-spras,

laspez like t002-laspez,

END OF TY_TAB.

DATA: ITAB TYPE STANDARD TABLE OF TY_TAB WITH HEADER LINE.

*parameters:salesno like itab-vbeln.

select s1~vbeln

s1~vkorg

s1~erdat

s1~augru

k1~BSTDK

k1~BSTDK_E

p1~spart

p1~kondm

p1~waerk

p1~netwr

p1~kwmeng

p1~vkaus

r1~land1

t1~nrart

  • t1~vtext

t1~parvw

n1~name1

n1~name2

n1~name3

n1~name4

c1~ort01

c1~pstlz

x1~vtext

t2~BEZEI

b1~bezei

b2~bezei

b3~bezei

b4~bezei

t3~spras

t3~laspez

into corresponding fields of table itab

from vbak as s1

join VBKD as k1

on s1vbeln = k1VBELN

join vbap as p1

on k1vbeln = p1vbeln

join t178t as x1

on p1kondm = x1kondm

join vbpa as r1

on p1vbeln = r1vbeln

join tpar as t1

on r1parvw = t1parvw

join ADRC as n1

on r1adrnr = n1addrnumber

join kna1 as c1

on r1land1 = c1land1

join tvlvT as t2

on p1vkaus = t2abrvw

join t002 as t3

on c1spras = t3spras

join tvm1t as b1

on c1spras = b1spras

join tvm2t as b2

on c1spras = b2spras

join tvm3t as b3

on c1spras = b3spras

join tvm4t as b4

on c1spras = b4spras

UP TO 10 ROWS.

*where k1~vbeln = salesno.

*and s1vbeln = salesno and p1vbeln = salesno

*and r1~vbeln = salesno.

*

loop AT ITAB.

WRITE : /(30)'VBELN: ', ITAB-VBELN,

/(30)'VKORG: ', ITAB-VKORG,

/(30)'ERDAT: ', ITAB-ERDAT,

/(30)'AUGRU: ', ITAB-AUGRU,

/(30)'BSTDK: ', ITAB-BSTDK,

/(30)'BSTDK_E:', ITAB-BSTDK_E,

/(30)'SPART: ', itab-spart,

/(30)'KONDM: ', itab-kondm,

/(30)'WAERK: ', itab-waerk,

/(19)'NETWR: ' , itab-netwr,

/(17)'KWMENG: ', itab-kwmeng,

/(30)'VKAUS:', itab-vkaus,

/(30)'LAND1:', itab-land1,

/(30)'NRART:', itab-nrart,

/(30)'PARVW:', itab-parvw,

/(30)'ADDR1:', itab-name1,

/(30)'ADDR2:', itab-name2,

/(30)'ADDR3:', itab-name3,

/(30)'ADDR4:', itab-name4,

/(30)'PSTLZ:', itab-pstlz,

/(30)'ORT01:', itab-ort01,

/(30)'RUN TIME BAND DESC:', itab-BEZEI,

/(30)'Compiler desc:',itab-vtext,

/(30)'BEZEI1:', itab-BEZEI1,

/(30)'BEZEI2:', itab-BEZEI2,

/(30)'BEZEI3:', itab-BEZEI3,

/(30)'BEZEI4:', itab-BEZEI4,

/(30)'LASPEZ :', itab-LASPEZ,

/(30)'spras :', itab-spras.

uline.

ENDLOOP.

if sy-subrc <> 0.

write : / 'No data found'.

endif.

1 ACCEPTED SOLUTION
Read only

ThomasZloch
Active Contributor
0 Likes
693

change code like this:

join tvm1t as b1
on c1~spras = b1~spras
and p1~mvgr1 = b1~mvgr1     <--- add

same for the other three text tables.

In general make sure you join all primary key fields of the check tables.

Cheers

Thomas

5 REPLIES 5
Read only

Former Member
0 Likes
693

ALSO tell me how to get the value of

SZA1_D0100-SMTP_ADDR ie the value of partner email.

I want my data against vbeln.

ie i have to use parameters: salesno like vbap-vbeln.

Read only

ThomasZloch
Active Contributor
0 Likes
694

change code like this:

join tvm1t as b1
on c1~spras = b1~spras
and p1~mvgr1 = b1~mvgr1     <--- add

same for the other three text tables.

In general make sure you join all primary key fields of the check tables.

Cheers

Thomas

Read only

0 Likes
693

thanks Thomas for for this information,

Another thing I want to get the data against VBELN as input !

thanks

Read only

0 Likes
693

it's in your code already, but commented out...

add a select-option S_VBELN, then add WHERE S1~VBELN IN S_VBELN to your select statement.

Read only

0 Likes
693

thanks really helpfull !