Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Change the below FM in R/3 to Routine (Start or Field) in BW

Former Member
0 Kudos

Hi,

Can any one please convert this FM in R/3 to a Field Routine in BW

I am extracting Shift Start Time data from R/3.In R/3 it will be as 18 Digit No in R/3 Table. The Function Module below will split the 18 Digit No in to Time and Date

My Requirement for Routine for Update or Transfer Rules

The 18 Digit no will be extracted to BW.Once the 18 Digit no is in BW the Routine has to split that No into Time & Date and have to load Time to the particular Info Object.

<b>Techical Name:</b>

R/3 Field: Shift Start Time: S_START (Which is 18 Digit No)

BW Info Object (Which should be loaded with time extracted from the 18 digit No)

-ZSFT_STR

Please suggest me do i need to write it as Start Routine or Field Routine.My Knowledge in ABAP is Zero

<b>Function Module in R/3</b>

DATA: lv_timestamp LIKE tzonref-tstamps,

lv_date_high LIKE sy-datum VALUE '99991231',

lv_utc_high TYPE ltsk_ddate VALUE 99991231235959,

lv_time_high LIKE sy-uzeit VALUE '235959',

lv_date LIKE sy-datlo,

lv_time LIKE sy-timlo.

CONSTANTS: invalid_date LIKE sy-datum VALUE '99991231'.

lv_timestamp = i_timestamp.

IF lv_timestamp = lv_utc_high.

o_date = lv_date_high.

o_time = lv_time_high.

ELSE. "usual time

CONVERT TIME STAMP lv_timestamp TIME ZONE sy-zonlo

INTO DATE o_date TIME o_time.

IF sy-subrc = 12.

o_date = lv_date_high.

o_time = lv_time_high.

ENDIF.

ENDIF.

IF sy-subrc <> 0 OR o_date = invalid_date .

RAISE conversion_error.

ENDIF.

ENDFUNCTION.

Thanks

2 REPLIES 2

Former Member
0 Kudos

hi ,

Write it in the Start routine.

data: x_souce_package type tys_SC_1.

you have SOURCE_PACKAGE in the start routine.

loop at SOURCE_PACKAGE into x_SOURCE_PACKAGE.

DATA: lv_timestamp LIKE tzonref-tstamps,

lv_date_high LIKE sy-datum VALUE '99991231',

lv_utc_high TYPE ltsk_ddate VALUE 99991231235959,

lv_time_high LIKE sy-uzeit VALUE '235959',

lv_date LIKE sy-datlo,

lv_time LIKE sy-timlo.

CONSTANTS: invalid_date LIKE sy-datum VALUE '99991231'.

lv_timestamp = x_SOURCE_PACKAGE-timestamp."the field wich consists of the 18 char value

IF lv_timestamp = lv_utc_high.

x_SOURCE_PACKAGE-o_date = lv_date_high.

x_SOURCE_PACKAGE-o_time = lv_time_high.

ELSE. "usual time

CONVERT TIME STAMP lv_timestamp TIME ZONE sy-zonlo

INTO DATE x_SOURCE_PACKAGE-o_date TIME x_SOURCE_PACKAGE-o_time.

IF sy-subrc = 12.

x_SOURCE_PACKAGE-o_date = lv_date_high.

x_SOURCE_PACKAGE-o_time = lv_time_high.

ENDIF.

ENDIF.

IF sy-subrc <> 0 OR o_date = invalid_date .

RAISE conversion_error.

ENDIF.

modify SOURCE_PACKAGE from x_SOURCE_PACKAGE index sy-tabix.

endloop.

Thanks,

Mahesh

0 Kudos

Hi,

Thanks for all the efforts..

I tried to paste it in start routine of ODS update rules.

<b>Error</b>

The type "TY_S_SC_1" is unknown. (1 Line)

How can i resolve this

Thanks