cancel
Showing results for 
Search instead for 
Did you mean: 

Transfer Rountine Syntax Help..

Former Member
0 Kudos

Hi All,

I am using a transfer routine to populate 0CALDAY object. In our source we have just YYYYMM (Year and Month). And I have to populate the DAY and that Number SHOULD be the last day of that month, for example if a record has YYYYMM = 200412, then I have to pass 20041231 to 0CALDAY, as last day in December is 31, and if the YYYYMM = 200402, then 0CALDAY should be 20040228 as last day in February is 28.

I cant use a concatenate or move for this ?

Can someone direct me as how I can write ABAP routine to accomplish this?

Thank You,

Reddy

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Reddy,

use the following:

concatenate YYYYMM '01' into result. "first of the month

result4(2) = result4(2) + '01'. "go to the next month

result = result - 1. "go 1 day back

  • YYYYMM = your variable (may be calmonth)

That should work.

regards

Siggi

Message was edited by: Siegfried Szameitat

Former Member
0 Kudos

Unfortunately this doesn't work for december dates. The coding would look like:

concatenate YYYYMM '01' into result.

if result+4(2) = '12'. "december

result+6(2) = '31'. "has 31 days

else.

result4(2) = result4(2) + 1.

result = result - 1.

endif.

Or you could use the function module LAST_DAY_IN_PERIOD_GET if you have fiscal time info objects.

Best regards

Dirk

Former Member
0 Kudos

Siggi ,Dirk,

Thank you very much for your inputs. However I have found a function module END_OF_MONTH_DETERMINE_2 and I am using that.

However, the FM exports I_DATUM and I am passing my Transfer structure field SALES_YYYYMM(EG. 200412) into I_DATUM parameter and expect the FM to return the day of month.

The problem I get is that it says the field that I pass into I_DATUM is wrong TYPE. But when I looked at the FM, I_DATUM has no type. Can you tell me what type it is? or how I can proceed from here?

Thank you,

Reddy

Former Member
0 Kudos

Hi Reddy,

Parameter I_DATUM of FM END_OF_MONTH_DETERMINE_2 is defined like VTBBEWE-DVALUT which is of type DATS (length 8). The expected format is DDMMYYYY, therefore:

- Before calling the FM you will have to convert your original value YYYYMM to 01MMYYYY (01 as initial day of the month).

- Execute the FM and you will get the last month day in the export parameter E_TT of FM.

- Finally you will have to concatenate and convert to the expected format for 0CALDAY: YYYYMMDD where DD = E_TT (result of FM).

Hope it helps,

Andreu

Former Member
0 Kudos

Hi Andreu,

Yes you are right, but however I did not have to convert/reformat my YYYYMM into the VTBBEWE-DVALUT type.

I just had to pass my YYYYMM into a variable and say that "Variable Like VTBBEWE-DVALUT". And that worked.By this I dont have to reformat or code YYYYMM. I am sure what you say will work too and thanks for replying.

Thanks,

Reddy

Answers (0)