‎2009 Aug 19 2:01 PM
Hello,
i was trying out some ABAP code and with the following select statement i am not fecthing any rows from the database table BSEG.
could anyone point out what is wrong with this code?
the document number which is being filled in ld_docnum exists in BSEG table.
what i think the problem is with statement ld_docnum = ld_intercomp+1(9).
is this converting the data into any other format that the bseg-belnr is not able to match?
data ls_bseg type table of bseg.
Data ld_docnum type bseg-belnr.
data ld_intercomp type bkpf-bvorg.
.....
.....
ld_docnum = ld_intercomp+1(9).
select * from BSEG into corresponding fields of table ls_bseg where belnr = ld_docnum.
Thanks,
Shilpa
‎2009 Aug 19 2:03 PM
That just means that there are no table entries corresponding to your where condition.
‎2009 Aug 19 2:05 PM
Hi Rainer,
Thanks for your reply but as i initially said there are document with my where condition.. i have check it in se16n.
Thanks
‎2009 Aug 19 2:15 PM
No it isnt. In that case i trust SAP. So there must be a difference between you values in SE16 and in your where condition. Maybe leading zeroes.
If sy-dbcnt is zero and sy-subrc is 4 there are definitly no rows corresponding to your where condtion.
‎2009 Aug 19 2:08 PM
Hi Shilpa
Just Remove this and try
ld_docnum = ld_intercomp.
If then also ita not working means check weather the data is there in database
Sravya
‎2009 Aug 19 2:19 PM
Hi,
While I don't know the specifics of your data it seems strange to take ld_intercomp+1(9) (i.e. 9 digits) and use this to read a field defined as 10 digits.
If the document number is held in the second to tenth digits of ld_intercomp then you may need to apply the conversion exit function module before using it in the SELECT.
Regards,
Nick
‎2009 Aug 19 2:19 PM
Why do you do this MOVE, from one BKPF-BVORG you select the records from BVOR with same Number of Cross-Company Code Posting Transaction and then select from BSEG with full document key with data from BVOR (GJAHR, BUKRS, BELNR)
BKPF (1 record) -> BVOR (n records) -> BKPF (n records) -> BSEG (> n records)
NB: In your code you move internally (no conversion exit) nine characters to BELNR, which is ten character long and has the conversion exit ALPHA, so as those are usually number, the conversion exit (in SE16 and other transactions) align characters to the right and add leading zeroes. Also even if you manage to solve this remember that (taking whole ten characters or adding a leading zero), BELNR is not sufficient to get the right document, you need BUKRS and GJHAR too.
Regards,
Raymond
‎2009 Aug 19 2:24 PM
Hi,
If you are trying to get the first 10 characters of Id_intercomp, then you will have to use
ld_docnum = ld_intercomp+0(10).
Also, check in debug mode before select query what data is populated in ld_docnum. That should help.
Thanks,
Shiva
‎2009 Aug 19 2:28 PM
Thank you my problem is solved.
as i said the problem was with the statement ld_docnum = ld_intercomp+1(9)
replaced it with ld_docnum = ld_intercomp(10) and it works fine
‎2009 Aug 19 2:46 PM
So youre where condition was different to you select in SE16. Sometimes the computer is right.
‎2009 Aug 19 3:02 PM
‎2009 Aug 19 3:12 PM
Begging for points is against forum rules. What can you do with points? Get a cup or a t-shirt... yeah thats really important
‎2009 Aug 19 6:22 PM
Dear Rainer,
Its not just for a cup or a t-shirt... Its one of my goal set in objectives for appraisal to gather particular number of points on SDN. So just trying to gather the same with my knowledge.
Regards,
Shiva