2021 Jan 18 6:14 AM
Select - options:
s_zyear for s031-spmon.(MM.YYYY)
I need to convert the year and month to the fiscal year. And the coding is like this:
With debug, the exception 1 was issued, and I don't know why, Can anyone here help me??
please,thank you.
Data:
LDF_DATUM TYPE SY_DATLO.
LDF_DATUM+0(4) = S_ZYEAR-LOW+0(4).
LDF_DATUM+4(2) = S_ZYEAR-LOW+4(2).
LDF_DATUM+6(2) = '01'.
Call function 'G_Period_get'.
Exporting
company = p_bukrs
date = LDF_DATUM
ledger = 'LEDGER'
Importing
Period = GDF_Period
Year = Gdf_year
Exception
Lendger_not_assigned_to_company
= 1
2021 Jan 18 6:28 AM
You should provide the error returned by SAP.
at first, ledger could not be 'LEDGER' it is a CHAR2
2021 Jan 18 6:17 AM
I've tried to set a range table of s_zyear, but I don't know how to use the range table in a Call function. Date could be a scope???
2021 Jan 18 6:28 AM
You should provide the error returned by SAP.
at first, ledger could not be 'LEDGER' it is a CHAR2
2021 Jan 18 6:47 AM
Hi,Girod!
The error returned by SAP may be 'Get finance period error'.
SY-SUBRC = 1…
About ledger, it's my miss.It is 'Ol'
2021 Jan 18 6:48 AM
2021 Jan 18 6:51 AM
Yes, test by ledger = 'ol' , there's also the exception error issued..
2021 Jan 18 6:52 AM
(the lowercase value is strange)
Use transaction ST05 to check witch tables are read by the FM, and whitch one is returning 0 record. You will see the WHERE condition criteria and maybe understand what is missing
2021 Jan 18 6:54 AM
I wonder how to set value of the date with select-options? Should I call function twice with date of S_ZYEAR-LOW and S_ZYEAR-HIGH?
2021 Jan 18 6:56 AM
FUNCTION g_period_get.
*"----------------------------------------------------------------------
*"*"Lokale Schnittstelle:
*" IMPORTING
*" VALUE(COMPANY) LIKE T001-BUKRS DEFAULT SPACE
*" VALUE(DATE) LIKE SY-DATUM DEFAULT SY-DATLO
*" VALUE(GLOBAL_COMPANY) LIKE T880-RCOMP DEFAULT SPACE
*" VALUE(LEDGER) LIKE T881-RLDNR DEFAULT SPACE
*" VALUE(VARIANT) LIKE T882-PERIV DEFAULT SPACE
Company is type BUKRS, simple field
Date is type SYDATUM, simple field
Global Company is type RCOMP, simple field
Ledger is type RLDNR, simple field
....
where do you want to put a SELECT OPTION or a RANGE ?
2021 Jan 18 7:04 AM
DO you actually mean that there's nothing with a Select option or a Range?
And it's alright to type SY-DATUM?
Don't I need to concatenate the year and month into DATE?
2021 Jan 18 7:07 AM
Because I need to convert the select option into fiscal year... (maybe wrong)
2021 Jan 18 7:08 AM
There is nothing to do with Select Option nor Range
I don't know if your concatenation is right, because I don't know the internal format of the field S_YEAR
You could describe a date field as TYPE SY-DATUM or TYPE SYDATUM
and if you want to test simply the FM before playing with your code, you could use in transaction SE37 the test mode (F8), it will generate a Selection screen where you will be able to test the value without doing a program
2021 Jan 18 7:11 AM
2021 Jan 18 7:14 AM
You have a problem with SELECT OPTION ? 🙂
For the value 01 01 2021
Parameters : 20210101
Select-Options: I EQ 20210101
Do you think you could enter the I EQ 20210101 into a simple field DATE ?
A Select-option is a table with a structure : Sign, Option, Low, Value it is very specific
2021 Jan 18 7:23 AM
OK,I see.
Oh,I just now used SE37 to test with value that is used in SE38, there's also the same exception issued
2021 Jan 18 7:25 AM
why the exception'ledger_not_assigned_to_company' issued? Omg
2021 Jan 18 7:31 AM
No, it actually couldn't be entered into the date value..
So how I define the value of date??
I definitely think that the concatenation is wrong
2021 Jan 18 7:34 AM
TRY
SE37 ... G_PERIOD_GET (in uper case in your code please)
F8
and try like this
2021 Jan 18 7:45 AM
2021 Jan 18 7:49 AM
Hi!
For getting fiscal period data.
another function module is like what?
2021 Jan 18 8:13 AM
Thank you so much,Girod!
Finally got it with SE37, the correct value of ledger should be '0L',but not 'OL'.
2021 Jan 18 8:49 AM
2021 Jan 18 9:54 AM
2021 Jan 18 8:11 AM
You could use some other FM such as DATE_TO_PERIOD_CONVERT after call of CCODE_GET_FISCAL_YEAR_VARIANT to get calendar variant - or - get an actual value of ledger (Domain RLDNR doesn't allow lowercase character) ex: FAGL_GET_LEADING_LEDGER or FAGL_GET_ALL_LEDGERS_IN_BUKRS
You can create a TYPE RANGE table from your SELECT-OPTION by converting LOW and HIGH values (if not initial) Keep SIGN and OPTION values.
2021 Jan 18 8:34 AM