This website is not affiliated with, sponsored by, or approved by SAP AG.

Code not returning Sales Doc Date

Development (ABAP Development WorkBench, ABAP/4 programming)

Moderators: Snowy, thx4allthefish, YuriT, Gothmog

Code not returning Sales Doc Date

Postby rpinxt » Fri May 30, 2014 7:42 am

So I need to have the Sales Document and as a reference I had the billing document.
I got the Sales Document with this code:
Code: Select all
CLEAR RP_SALDOC.
SELECT SINGLE AUBEL FROM VBRP
  INTO RP_SALDOC
  WHERE VBELN = BSID-XBLNR.
SHIFT RP_SALDOC BY 2 PLACES.


This worked perfectly.

Now I wanted to add the Sales Document date either from VBAK or VBAP.
I wanted to pull it of with this code:
Code: Select all
CLEAR RP_SALDAT.
SELECT SINGLE ERDAT FROM VBAP
  INTO RP_SALDAT
  WHERE VBELN = RP_SALDOC.


But unfortunately I get an empty date (00.00.0000) which is not correct.
The code seemed to valid.
Does anybody know why the code was accepted but is not giving output?
Thanks.
rpinxt
 
Posts: 146
Joined: Mon Jul 23, 2012 8:02 am

Re: Code not returning Sales Doc Date

Postby Grogan » Fri May 30, 2014 3:06 pm

As a wild guess I would suggest it is because of this:
Code: Select all
SHIFT RP_SALDOC BY 2 PLACES.

Why are you deleting the first 2 characters of the Sales Order id ? If it is to display without leading zeroes then there are better ways of doing this that don't presume you always have a fixed number of leading zeroes.

In any case try reading the Sales Order creation date VBAK-ERDAT or item creation date VBAP-ERDAT using the original unchanged AUBEL value.
Grogan

Award cash if useful.
Grogan
 
Posts: 365
Joined: Thu Aug 04, 2005 7:16 pm
Location: Australia

Re: Code not returning Sales Doc Date

Postby rpinxt » Thu Jun 05, 2014 5:27 am

Sorry for the late response.
But thanks Grogan!
You were absolutely wright.

Now I do get the date.
But could you also tell me the better way then to lose the leading zero's in the column of the sales document?
Thanks.
rpinxt
 
Posts: 146
Joined: Mon Jul 23, 2012 8:02 am

Re: Code not returning Sales Doc Date

Postby Gothmog » Thu Jun 05, 2014 6:43 am

Use the conversion exit function module - CONVERSION_EXIT_ALPHA_OUTPUT, in this case.
You can see the conversion routine to use in the domain of the field (Definition tab).
The help on this field will tell you all you need to know about these conversion exits.
68 74 74 70 3a 2f 2f 74 69 6e 79 75 72 6c 2e 63 6f 6d 2f 62 64 6f 37 6d 77 67
Gothmog
 
Posts: 1942
Joined: Wed Sep 12, 2007 4:46 am
Location: Probably not home


Return to ABAP

Who is online

Users browsing this forum: Google Adsense [Bot] and 10 guests





This website is not affiliated with, sponsored by, or approved by SAP AG.