2007 Apr 18 11:44 AM
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.
2007 Apr 18 11:48 AM
hi,
check whether the interanl tables itab1 and itab2 contains content.
regards,
Navneeth.K
2007 Apr 18 11:51 AM
hi,
aslo there are chances that vbeln of itab1 doesnot match with vbeln of itab2.
regards,
Navneeth.k
2007 Apr 18 11:51 AM
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
2007 Apr 18 11:52 AM
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
2007 Apr 18 11:53 AM
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.
2007 Apr 18 11:54 AM
Check for itab1 & itab2 contents.
Put the break point at read statement & check for sy-subrc
Thanks
Sandeep
Reward if helpful
2007 Apr 18 1:19 PM
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.
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |