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

Internal table result is not displaying

Former Member
0 Likes
802

Hi,

This is my code im not getting the result displayed in the itab3

im not getting any result what is the prob in the code

can anyone tell me

TABLES : vbap,

vbrp.

DATA : BEGIN OF itab1 OCCURS 0,

vbeln LIKE vbap-vbeln,

vrkme LIKE vbap-vrkme,

END OF itab1.

DATA : BEGIN OF itab2 OCCURS 0,

vbeln LIKE vbrp-vbeln,

lgort LIKE vbrp-lgort,

posnr LIKE vbrp-posnr,

END OF itab2.

DATA : BEGIN OF itab3 OCCURS 0,

vbeln LIKE vbrp-vbeln,

lgort LIKE vbrp-lgort,

posnr LIKE vbrp-posnr,

vrkme like vbap-vrkme,

END OF itab3.

SELECTION-SCREEN : BEGIN OF BLOCK bl1 WITH FRAME TITLE text-001.

SELECT-OPTIONS : vbeln FOR vbap-vbeln.

SELECTION-SCREEN : END OF BLOCK bl1.

SELECT vbeln vrkme

FROM vbap INTO CORRESPONDING FIELDS OF TABLE itab1

WHERE vbeln IN vbeln.

SELECT vbeln lgort posnr

FROM vbrp INTO CORRESPONDING FIELDS OF TABLE itab2.

loop at itab1.

read table itab2 with key vbeln = itab1-vbeln.

if sy-subrc eq 0.

move-corresponding itab1 to itab3.

move-corresponding itab2 to itab3.

append itab3.

endif.

endloop.

loop at itab3.

write : / itab3-vbeln, itab3-lgort, itab3-posnr, itab3-vrkme.

endloop.

Hi,

This is my code im not getting the result displayed in the itab3

im not getting any result what is the prob in the code

can anyone tell me

TABLES : vbap,

vbrp.

DATA : BEGIN OF itab1 OCCURS 0,

vbeln LIKE vbap-vbeln,

vrkme LIKE vbap-vrkme,

END OF itab1.

DATA : BEGIN OF itab2 OCCURS 0,

vbeln LIKE vbrp-vbeln,

lgort LIKE vbrp-lgort,

posnr LIKE vbrp-posnr,

END OF itab2.

DATA : BEGIN OF itab3 OCCURS 0,

vbeln LIKE vbrp-vbeln,

lgort LIKE vbrp-lgort,

posnr LIKE vbrp-posnr,

vrkme like vbap-vrkme,

END OF itab3.

SELECTION-SCREEN : BEGIN OF BLOCK bl1 WITH FRAME TITLE text-001.

SELECT-OPTIONS : vbeln FOR vbap-vbeln.

SELECTION-SCREEN : END OF BLOCK bl1.

SELECT vbeln vrkme

FROM vbap INTO CORRESPONDING FIELDS OF TABLE itab1

WHERE vbeln IN vbeln.

SELECT vbeln lgort posnr

FROM vbrp INTO CORRESPONDING FIELDS OF TABLE itab2.

loop at itab1.

read table itab2 with key vbeln = itab1-vbeln.

if sy-subrc eq 0.

move-corresponding itab1 to itab3.

move-corresponding itab2 to itab3.

append itab3.

endif.

endloop.

loop at itab3.

write : / itab3-vbeln, itab3-lgort, itab3-posnr, itab3-vrkme.

endloop.

7 REPLIES 7
Read only

Former Member
0 Likes
778

hi,

check whether the interanl tables itab1 and itab2 contains content.

regards,

Navneeth.K

Read only

0 Likes
778

hi,

aslo there are chances that vbeln of itab1 doesnot match with vbeln of itab2.

regards,

Navneeth.k

Read only

kostas_tsioubris
Contributor
0 Likes
778

Hi vbap-vbeln does not match vbrp-vbeln you should try vbrp-aubel instead.

TABLES : vbap,

vbrp.

DATA : BEGIN OF itab1 OCCURS 0,

vbeln LIKE vbap-vbeln,

vrkme LIKE vbap-vrkme,

END OF itab1.

DATA : BEGIN OF itab2 OCCURS 0,

<b>aubel LIKE vbrp-aubel,</b>

vbeln like vbrp-vbeln,

lgort LIKE vbrp-lgort,

posnr LIKE vbrp-posnr,

END OF itab2.

DATA : BEGIN OF itab3 OCCURS 0,

vbeln LIKE vbrp-vbeln,

lgort LIKE vbrp-lgort,

posnr LIKE vbrp-posnr,

vrkme like vbap-vrkme,

END OF itab3.

SELECTION-SCREEN : BEGIN OF BLOCK bl1 WITH FRAME TITLE text-001.

SELECT-OPTIONS : vbeln FOR vbap-vbeln.

SELECTION-SCREEN : END OF BLOCK bl1.

SELECT vbeln vrkme

FROM vbap INTO CORRESPONDING FIELDS OF TABLE itab1

WHERE vbeln IN vbeln.

*no where statement??

SELECT <b>aubel</b> vbeln lgort posnr

FROM vbrp INTO CORRESPONDING FIELDS OF TABLE itab2.

loop at itab1.

read table itab2 with key <b>aubel</b> = itab1-vbeln.

if sy-subrc eq 0.

move-corresponding itab1 to itab3.

move-corresponding itab2 to itab3.

append itab3.

endif.

endloop.

loop at itab3.

write : / itab3-vbeln, itab3-lgort, itab3-posnr, itab3-vrkme.

endloop.

Message was edited by:

Kostas Tsioubris

Read only

Former Member
0 Likes
778

Your code looks fine , I guess that there is no common VBELN in itab1 and itab2 , that why its not populating any data in itab3.

also REMOVE <b>CORRESPONDING FIELDS OF</b> in both the selects

Read only

Former Member
0 Likes
778

Hi Azhar,

You r doing two mistakes here.

1) keep "move-corresponding itab1 to itab3." before the read

2) while selecting the data 1st select is regarding the sales document item level,

and the 2nd select is regarding the billing documents. So while getting the

data from vbrp get the sales order no also and pass that sales order no in the

read.

Regards,

Krishna K.

Read only

Former Member
0 Likes
778

Check for itab1 & itab2 contents.

Put the break point at read statement & check for sy-subrc

Thanks

Sandeep

Reward if helpful

Read only

Former Member
0 Likes
778

SELECT vbeln vrkme

FROM vbap INTO CORRESPONDING FIELDS OF TABLE itab1

WHERE vbeln IN vbeln.

SELECT avbeln algort aposnr bvgbel b~vgpos

FROM vbrp as a

lips as b

INTO CORRESPONDING FIELDS OF TABLE itab2.(add vgbel and vgpos to itab2)

where b~vgbel in vbeln.

loop at itab1.

read table itab2 with key vgbel = itab1-vbeln

vgpos = itab1-posne.

if sy-subrc eq 0.

move-corresponding itab1 to itab3.

move-corresponding itab2 to itab3.

append itab3.

endif.

endloop.

loop at itab3.

write : / itab3-vbeln, itab3-lgort, itab3-posnr, itab3-vrkme.

endloop.