Application Development and Automation 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: 
Read only

explanation regarding code snippet

Former Member
0 Likes
391

Hi to all,

I Have a little bit confusion in the following code....

please give me a detailed explanation for the same.

METHOD if_rscnv_exit~exit.

FIELD-SYMBOLS: <l_s_old> TYPE ANY,

<l_fillfield> TYPE ANY,

<l_newfield> TYPE ANY.

DATA: l_chavl TYPE rschavl,

l_0calmonth_chavl TYPE rschavl,

l_attr TYPE string.

*****************************************************

  • Assign the references to field symbols

*****************************************************

ASSIGN c_r_newfield->* TO <l_newfield>.

ASSIGN i_r_old->* TO <l_s_old>.

*****************************************************

  • To use the individual fields of the old table

  • structure (e.g. SID_0CALDAY), assign these fields

  • to field symbols using the field name.

*****************************************************

ASSIGN COMPONENT 'SID_0CALDAY' OF STRUCTURE <l_s_old> TO <l_fillfield>.

*****************************************************

  • Implement the logic you want to use for determing

  • the value to be filled into the new field.

*

  • E.g. Here, I have the SID of 0CALDAY available in

  • <l_fillfield>. I then do the following -

*

  • 1) Get the 0CALDAY value corresponding to that SID.

  • 2) Extract the month from this value

  • 3) Get the SID for this month value

  • 4) Assign this value to the changing parameter

  • through a field symbol

  • (Note: Steps 3 and 4 are done in one step in the

  • code)

*****************************************************

CALL FUNCTION 'RRSI_SID_VAL_SINGLE_CONVERT'

EXPORTING

i_iobjnm = '0CALDAY'

  • I_S_COB_PRO =

i_sid = <l_fillfield>

IMPORTING

e_chavl = l_chavl

  • E_S_NODESID =

EXCEPTIONS

no_value_for_sid = 1

x_message = 2

OTHERS = 3

.

IF sy-subrc <> 0.

l_attr = text-001.

RAISE EXCEPTION TYPE cx_rscnv_exception

EXPORTING

attr1 = 'CL_RSCNV_USER_EXIT_SAMPLE'

attr2 = 'EXIT-1'

attr3 = l_attr

  • ATTR4 = sy-subrc

.

ENDIF.

l_0calmonth_chavl = l_chavl+0(6).

CALL FUNCTION 'RRSI_VAL_SID_SINGLE_CONVERT'

EXPORTING

i_iobjnm = '0CALMONTH'

i_chavl = l_0calmonth_chavl

  • I_S_COB_PRO =

  • I_CHECKFL = RS_C_FALSE

  • I_WRITEFL = RRSI_C_WRITEFL-NO

  • I_MASTERDATA_CREATE = RS_C_TRUE

  • I_RNSID =

  • I_NEW_VALUES = RS_C_FALSE

IMPORTING

e_sid = <l_newfield>

EXCEPTIONS

no_sid = 1

chavl_not_allowed = 2

chavl_not_figure = 3

chavl_not_plausible = 4

x_message = 5

interval_not_found = 6

foreign_lock = 7

inherited_error = 8

OTHERS = 9

.

IF sy-subrc <> 0.

l_attr = text-002.

RAISE EXCEPTION TYPE cx_rscnv_exception

EXPORTING

attr1 = 'CL_RSCNV_USER_EXIT_SAMPLE'

attr2 = 'EXIT-2'

attr3 = l_attr

  • ATTR4 = sy-subrc

.

ENDIF.

ENDMETHOD.

Regards,

swami

1 REPLY 1
Read only

Former Member
0 Likes
364

Hi There,

I want to add 0FISCPER3 into a cube with the remodeler and I want to fill it using 0FISCPER.

I copied the code you gave here and tried to change it accordingly but the remodeler doesn’t seem to use the customer exit.

Can you maybe help me and guide me thru the steps.

When I run the remodeler it will add 0FISCPER3 into the cube but doesn’t fill it with data.

Do you know what is wrong?

Here is my version of your code.

Thanks.

Andre.

method IF_RSCNV_EXIT~EXIT.

FIELD-SYMBOLS:

<l_s_old> TYPE ANY,

<l_fillfield> TYPE ANY,

<l_newfield> TYPE ANY.

DATA:

l_chavl TYPE rschavl,

l_0fiscper3_val TYPE rschavl,

l_attr TYPE string.

break-point.

ASSIGN c_r_newfield->* TO <l_newfield>.

ASSIGN i_r_old->* TO <l_s_old>.

ASSIGN COMPONENT 'SID_0FISCPER' OF STRUCTURE <l_s_old> TO <l_fillfield>.

CALL FUNCTION 'RRSI_SID_VAL_SINGLE_CONVERT'

EXPORTING

i_iobjnm = '0FISCPER'

i_sid = <l_fillfield>

IMPORTING

e_chavl = l_chavl

EXCEPTIONS

no_value_for_sid = 1

x_message = 2

OTHERS = 3.

IF sy-subrc = 0.

l_attr = text-001.

RAISE EXCEPTION TYPE cx_rscnv_exception

EXPORTING

attr1 = 'CL_RSCNV_USER_EXIT_SAMPLE'

attr2 = 'EXIT-1'

attr3 = l_attr.

ENDIF.

l_0fiscper3_val = l_chavl+4(3).

CALL FUNCTION 'RRSI_VAL_SID_SINGLE_CONVERT'

EXPORTING

i_iobjnm = '0FISCPER3'

i_chavl = l_0fiscper3_val

IMPORTING

e_sid = <l_newfield>

EXCEPTIONS

no_sid = 1

chavl_not_allowed = 2

chavl_not_figure = 3

chavl_not_plausible = 4

x_message = 5

interval_not_found = 6

foreign_lock = 7

inherited_error = 8

OTHERS = 9.

IF sy-subrc = 0.

l_attr = text-002.

RAISE EXCEPTION TYPE cx_rscnv_exception

EXPORTING

attr1 = 'CL_RSCNV_USER_EXIT_SAMPLE'

attr2 = 'EXIT-2'

attr3 = l_attr.

ENDIF.

endmethod.