2007 Aug 02 2:40 PM
Hi,
I want to write a routine in a transformation rule that combines two fields from one virtual cube into one field in my destination cube. The combination should work according to this pseudo code:
If (current year)
then FieldA should be used
else
then FieldB should be used
Does anybody know how the abap code for this should be?
Thank you in advance,
Best regards,
Mikael Kilåker
2007 Aug 02 4:44 PM
Hi,
I still have not been able to solve the problem, my code looks like:
data: v_year(4) type c.
move sy-datum+4(4) to v_year.
if SOURCE_FIELDS-CALYEAR eq v_year.
RESULT = SOURCE_FIELDS-/BIC/VE_SALHIS.
move SOURCE_FIELDS-/BIC/VE_SALHIS to RESULT.
else.
RESULT = SOURCE_FIELDS-/BIC/VE_SETS.
move SOURCE_FIELDS-/BIC/VE_SETS to RESULT.
endif.
I have also tried using the rows that are commented, but for some reason the if statement is never true, so only data from SOURCE_FIELDS-/BIC/VE_SETS is transformed into my result variable.
Any idea?
Best regards,
Mikael
Hi,
I want to write a routine in a transformation rule that combines two fields from one virtual cube into one field in my destination cube. The combination should work according to this pseudo code:
If (current year)
then FieldA should be used
else
then FieldB should be used
Does anybody know how the abap code for this should be?
Thank you in advance,
Best regards,
Mikael Kilåker
2007 Aug 02 2:47 PM
Hi,
may like this way
data : v_year(4) type c.
move sy-datum+4(4) to v_year. " Here v_year will be 2007
If <your variable having year> eq v_year.
move fieldA to
else.
move fieldB to
endif.
2007 Aug 02 4:44 PM
Hi,
I still have not been able to solve the problem, my code looks like:
data: v_year(4) type c.
move sy-datum+4(4) to v_year.
if SOURCE_FIELDS-CALYEAR eq v_year.
RESULT = SOURCE_FIELDS-/BIC/VE_SALHIS.
move SOURCE_FIELDS-/BIC/VE_SALHIS to RESULT.
else.
RESULT = SOURCE_FIELDS-/BIC/VE_SETS.
move SOURCE_FIELDS-/BIC/VE_SETS to RESULT.
endif.
I have also tried using the rows that are commented, but for some reason the if statement is never true, so only data from SOURCE_FIELDS-/BIC/VE_SETS is transformed into my result variable.
Any idea?
Best regards,
Mikael
2007 Aug 02 4:47 PM
Hi mikael,
1. Dates in backend are usually stored in YYYYMMDD format.
2. Hence, the syntax should be
<b>move sy-datum(4) to v_year.</b>
instead of
move sy-datum+4(4) to v_year.
regards,
amit m.
2007 Aug 02 4:52 PM
Hi,
Please check your sy-datum how it get stored.
The following is way move syntax get worked. Please below mentioned example.
related to how MOVE syntax worked.
MOVE foff1(len1) TO goff2(len2).
Effect
With offset off2 and length len2, field g receives the contents of field f with offset off1 and length len1. The offset and length specifications can also be variable.
Example
DATA: FIELD1(10) VALUE '1234567890',
OFF1 TYPE I VALUE 1,
LEN1 TYPE I VALUE 2,
FIELD2(8) VALUE 'abcdefgh',
OFF2 TYPE I VALUE 3,
LEN2 TYPE I VALUE 4.
MOVE FIELD1OFF1(LEN1) TO FIELD2OFF2(LEN2).
FIELD2 now has the value 'abc23 h'.
aRs
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |