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

not able to find the Error in code !

Former Member
0 Likes
382

please help me to find the error in my code. When I Added x1~kondm its not giving anything i.e

*join t178t as x1

*on p1kondm = x1kondm

in the SQL part !

REPORT YINTERACTIVEPROGRAM01.

TABLES:VBAP,

VBPA,

VBRP,

VBRK,

KNA1,

ADRC,

TPAR,

TVKGG,

TVM1T,

TVM2T,

TVM3T,

TVM4T,

VBKD,

SZA1_D0100,

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,

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

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

where k1vbeln = salesno and s1vbeln = salesno and p1~vbeln = 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,

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

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

/(10)'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)'Compiler desc:', itab-vtext.

uline.

ENDLOOP.

if sy-subrc <> 0.

write : / 'No data found'.

endif.

please help me to find the error in my code. When I Added x1~kondm its not giving anything i.e

*join t178t as x1

*on p1kondm = x1kondm

in the SQL part !

REPORT YINTERACTIVEPROGRAM01.

TABLES:VBAP,

VBPA,

VBRP,

VBRK,

KNA1,

ADRC,

TPAR,

TVKGG,

TVM1T,

TVM2T,

TVM3T,

TVM4T,

VBKD,

SZA1_D0100,

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,

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

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

where k1vbeln = salesno and s1vbeln = salesno and p1~vbeln = 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,

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

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

/(10)'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)'Compiler desc:', itab-vtext.

uline.

ENDLOOP.

if sy-subrc <> 0.

write : / 'No data found'.

endif.

1 REPLY 1
Read only

Former Member
0 Likes
347

hi,

u failed to check relationship between tables and as well as mandatory fields need to be checked, i noticed following

from vbak as s1

join VBKD as k1

on s1vbeln = k1VBELN

join vbap as p1

on k1vbeln = p1vbeln and k1posnr = p1posnr

*join t178t as x1

*on p1kondm = x1kondm

join vbpa as r1

on p1vbeln = r1vbeln <b>and p1posnt = r1posnr </b> join tpar as t1

on r1parvw = t1parvw

join ADRC as n1

on r1adrnr = n1addrnumber <b> * No relation between these two tables/b]

join kna1 as c1

on r1land1 = c1land1 <b>and r1kunnr = c1kunnr</b> <i>'here u need to check mandatory fields also</i>

where k1vbeln = salesno and s1vbeln = salesno and p1~vbeln = salesno

and r1~vbeln = salesno.

anyway, in performance point of view, writeing code with this much joins is not acceptable.

comeback if you need any further help

regards,

pavan

Message was edited by:

pavan kumar pisipati