Extracting YEAR and MONTH from Bill date in SAP Query SQ02

Question: Hello.

I am trying to extract the YEAR and MONTH from Billing date VBRK-FKDAT in my SAP Query.

I have gotten as far as creating an additional field (defined as like VBRK-FKDAT) in my Infoset, but have gotten stuck with the coding for the additional field.

Can someone help me with the command I can use to extract the YEAR and MONTH? Thank you very much.

Answer:
Okay VBRK-FKDAT is of type DATS (which means it's a native date field and holds the date as YYYYMMDD).

You'll need two different fields, one to receive the Year and one to receive the Month. You could use the data elements GJAHR & MONAT for this.

To move the data you need to use an offset command to 'split' your source field into the two target fields, like this:W_GJAHR = VBRK-FKDAT(4).
W_MONAT = VBRK-FKDAT+2(2).

If any of this doesn't make sense have a look at the SAP Help for ABAP and concentrate on offset and sub-field access information.
_________________
Kind Regards

Rosie Brent

Please remember to search the forum and check the FAQ before posting questions, thank you.

Tuly Idiot most of the time, part-time Guru
Copyright ?2007 - 2008 www.jt77.com