cancel
Showing results for 
Search instead for 
Did you mean: 

Please help - Transformation Question - End Routine

Former Member
0 Kudos

Hi Experts,

I have the following code below and I get the following error when I try to save the routine

Error Message:

E:At "LOOP AT itab" one of the additions "INTO", "ASSIGNING" or "TRANSPORTING NO FIELDS" is required in the OO context. in the OO context.

I am trying to read Master data attribute CSM_RCOD from 0DPM_DCAS. Also, I was wondering if I had declared the variables at the right place.

Thanks in advance.

Regards,

bw_newbie

End Routine Code:

PROGRAM trans_routine.

----


  • CLASS routine DEFINITION

----


*

----


CLASS lcl_transform DEFINITION.

PUBLIC SECTION.

  • Attributs

DATA:

p_check_master_data_exist

TYPE RSODSOCHECKONLY READ-ONLY,

*- Instance for getting request runtime attributs;

  • Available information: Refer to methods of

  • interface 'if_rsbk_request_admintab_view'

p_r_request

TYPE REF TO if_rsbk_request_admintab_view READ-ONLY.

PRIVATE SECTION.

TYPE-POOLS: rsd, rstr.

  • Rule specific types

TYPES:

BEGIN OF tys_TG_1,

  • InfoObject: 0DPM_DCAS Dispute Case Key.

DPM_DCAS TYPE /BI0/OIDPM_DCAS,

  • InfoObject: 0CSM_CHTI Changed At (Time Stamp).

CSM_CHTI TYPE /BI0/OICSM_CHTI,

  • InfoObject: 0DPM_STAT Item Status.

DPM_STAT TYPE /BI0/OIDPM_STAT,

  • InfoObject: 0COMP_CODE Company code.

COMP_CODE TYPE /BI0/OICOMP_CODE,

  • InfoObject: 0AC_DOC_NO Accounting document number.

AC_DOC_NO TYPE /BI0/OIAC_DOC_NO,

  • InfoObject: 0ITEM_NUM Number of line item within accounting docum

*ent.

ITEM_NUM TYPE /BI0/OIITEM_NUM,

  • InfoObject: 0FISCVARNT Fiscal year variant.

FISCVARNT TYPE /BI0/OIFISCVARNT,

  • InfoObject: 0DEBITOR Customer number.

DEBITOR TYPE /BI0/OIDEBITOR,

  • InfoObject: 0CURRENCY Currency Key.

CURRENCY TYPE /BI0/OICURRENCY,

  • InfoObject: 0CREDITOR Account number of supplier/vendor.

CREDITOR TYPE /BI0/OICREDITOR,

  • InfoObject: 0CUSTOMER Customer number.

CUSTOMER TYPE /BI0/OICUSTOMER,

  • InfoObject: 0DPM_CRAA Amount Credited.

DPM_CRAA TYPE /BI0/OIDPM_CRAA,

  • InfoObject: 0DPM_CURA Disputed Amount.

DPM_CURA TYPE /BI0/OIDPM_CURA,

  • InfoObject: 0DPM_PAIA Amount Paid.

DPM_PAIA TYPE /BI0/OIDPM_PAIA,

  • InfoObject: 0DPM_ORIA Original Disputed Amount.

DPM_ORIA TYPE /BI0/OIDPM_ORIA,

  • InfoObject: 0DPM_AUTA Amount Written Off Automatically.

DPM_AUTA TYPE /BI0/OIDPM_AUTA,

  • InfoObject: 0DPM_MANA Amount Cleared Manually.

DPM_MANA TYPE /BI0/OIDPM_MANA,

  • InfoObject: 0FISCPER Fiscal year / period.

FISCPER TYPE /BI0/OIFISCPER,

  • InfoObject: 0DPM_KOAR Partner Type.

DPM_KOAR TYPE /BI0/OIDPM_KOAR,

  • InfoObject: 0CSM_RCOD Reason.

CSM_RCOD TYPE /BI0/OICSM_RCOD,

  • InfoObject: 0CSM_TYPE Case Type.

CSM_TYPE TYPE /BI0/OICSM_TYPE,

  • InfoObject: 0CSM_ESCA Escalation Reason.

CSM_ESCA TYPE /BI0/OICSM_ESCA,

  • InfoObject: 0CSM_RESP Person Responsible.

CSM_RESP TYPE /BI0/OICSM_RESP,

  • Field: RECORD.

RECORD TYPE RSARECORD,

END OF tys_TG_1.

TYPES:

tyt_TG_1 TYPE STANDARD TABLE OF tys_TG_1

WITH NON-UNIQUE DEFAULT KEY.

$$ begin of global - insert your declaration only below this line -

... "insert your code here

$$ end of global - insert your declaration only before this line -

METHODS

end_routine

IMPORTING

request type rsrequest

datapackid type rsdatapid

EXPORTING

monitor type rstr_ty_t_monitors

CHANGING

RESULT_PACKAGE type tyt_TG_1

RAISING

cx_rsrout_abort.

METHODS

inverse_end_routine

IMPORTING

i_th_fields_outbound TYPE rstran_t_field_inv

i_r_selset_outbound TYPE REF TO cl_rsmds_set

i_is_main_selection TYPE rs_bool

i_r_selset_outbound_complete TYPE REF TO cl_rsmds_set

i_r_universe_inbound TYPE REF TO cl_rsmds_universe

CHANGING

c_th_fields_inbound TYPE rstran_t_field_inv

c_r_selset_inbound TYPE REF TO cl_rsmds_set

c_exact TYPE rs_bool.

ENDCLASS. "routine DEFINITION

$$ begin of 2nd part global - insert your code only below this line *

... "insert your code here

TYPES: BEGIN OF struct1.

INCLUDE STRUCTURE /BI0/PDPM_DCAS.

TYPES END OF struct1.

DATA: ITAB1 TYPE STANDARD TABLE OF STRUCT1

WITH HEADER LINE

WITH NON-UNIQUE DEFAULT KEY INITIAL SIZE 0.

$$ end of 2nd part global - insert your code only before this line *

----


  • CLASS routine IMPLEMENTATION

----


*

----


CLASS lcl_transform IMPLEMENTATION.

----


  • Method end_routine

----


  • Calculation of result package via end routine

  • Note: All not overwritten field values within the routine

  • are transferred from the corresponding source fields. This

  • means, all fields not supplied by the transformation source

  • are send with initial values to the transformation target.

----


  • <-> result package

----


METHOD end_routine.

*=== Segments ===

FIELD-SYMBOLS:

<RESULT_FIELDS> TYPE tys_TG_1.

DATA:

MONITOR_REC TYPE rstmonitor.

*$*$ begin of routine - insert your code only below this line *-*

... "insert your code here

*-- fill table "MONITOR" with values of structure "MONITOR_REC"

*- to make monitor entries

... "to cancel the update process

  • raise exception type CX_RSROUT_ABORT.

  • TYPES: BEGIN OF struct1.

  • INCLUDE STRUCTURE /BI0/PDPM_DCAS.

  • TYPES END OF struct1.

  • DATA: ITAB11 TYPE STANDARD TABLE OF STRUCT1

  • WITH HEADER LINE

  • WITH NON-UNIQUE DEFAULT KEY INITIAL SIZE 0.

SELECT * FROM /BI0/PDPM_DCAS INTO CORRESPONDING FIELDS OF TABLE

ITAB1 WHERE OBJVERS = 'A' .

LOOP AT RESULT_PACKAGE.

READ TABLE ITAB1 WITH KEY /BI0/OIDPM_DCAS =

RESULT_PACKAGE-/BI0/OIDPM_DCAS.

IF SY-SUBRC EQ 0.

RESULT_PACKAGE-/BI0/OICSM_RCOD = ITAB1-/BI0/OICSM_RCOD.

ENDIF.

MODIFY RESULT_PACKAGE.

ENDLOOP.

$$ end of routine - insert your code only before this line -

ENDMETHOD. "end_routine

----


  • Method inverse_end_routine

----


*

  • This subroutine needs to be implemented only for direct access

  • (for better performance) and for the Report/Report Interface

  • (drill through).

  • The inverse routine should transform a projection and

  • a selection for the target to a projection and a selection

  • for the source, respectively.

  • If the implementation remains empty all fields are filled and

  • all values are selected.

*

----


*

----


METHOD inverse_end_routine.

$$ begin of inverse routine - insert your code only below this line-

... "insert your code here

$$ end of inverse routine - insert your code only before this line -

ENDMETHOD. "inverse_end_routine

ENDCLASS. "routine IMPLEMENTATION

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Balaji,

Thanks for the code. Please can you also send me the definition of the internal tables

DT_RSEGPO and DS_RSEGPO that you have in your code. Or you can email it to bw_newbie@yahoo.com My code is not working yet.

Thanks.

Regards,

bw_newbie

Former Member
0 Kudos

Hi,

It is the internal table that is define in the start routine. It is a reference to DSO which we had used.

TYPES: BEGIN OF TP_RSEGDOC,

/BIC/ZINV_REC TYPE /BIC/AZFIP_D0100-/BIC/ZINV_REC,

END OF TP_RSEGDOC.

DATA: DS_RSEGDOC TYPE TP_RSEGDOC.

DATA: DT_RSEGDOC LIKE STANDARD TABLE OF DS_RSEGDOC

WITH KEY /BIC/ZINV_REC.

TYPES: BEGIN OF TP_RSEGPO,

/BIC/ZINV_REC TYPE /BIC/AZFIP_D0100-/BIC/ZINV_REC,

ITEM_NUM TYPE /BIC/AZFIP_D0100-ITEM_NUM,

FISCVARNT TYPE /BIC/AZFIP_D0100-FISCVARNT,

FISCYEAR TYPE /BIC/AZFIP_D0100-FISCYEAR,

AC_DOC_NO TYPE /BIC/AZFIP_D0100-AC_DOC_NO,

CURRENCY TYPE /BIC/AZFIP_D0100-CURRENCY,

REF_DOC_NO TYPE /BIC/AZFIP_D0100-REF_DOC_NO,

OI_EBELN TYPE /BIC/AZFIP_D0100-OI_EBELN,

OI_EBELP TYPE /BIC/AZFIP_D0100-OI_EBELP,

OI_WRBTR TYPE /BIC/AZFIP_D0100-OI_WRBTR,

/BIC/ZAMT_USD TYPE /BIC/AZFIP_D0100-/BIC/ZAMT_USD,

END OF TP_RSEGPO.

DATA: DS_RSEGPO TYPE TP_RSEGPO.

DATA: DT_RSEGPO LIKE STANDARD TABLE OF DS_RSEGPO

WITH KEY /BIC/ZINV_REC ITEM_NUM.

It is sample code you need to create your own internal tables and logic .

Hope it helps,

Cheers,

Balaji

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi Balaji,

Thanks a lot for your help. It solved my problem. I have assigned points.

Thanks.

Regards,

bw_newbie

Former Member
0 Kudos

Hi Balaji,

Thanks for the quick response. I am not sure how to create field symbol. Can you Please give code. I did type LOOP AT RESULT_PACKAGE Assigning <result_fields>. and I still have the same error.

E:In the OO context either an INTO or an ASSIGNING specification or the addition "TRANSPORTING NO FIELDS" must be used. addition "TRANSPORTING NO FIELDS" must be used.

Former Member
0 Kudos

Refer this same code.

[code]

METHOD end_routine.

*=== Segments ===

FIELD-SYMBOLS:

<RESULT_FIELDS> TYPE tys_TG_1.

DATA:

MONITOR_REC TYPE rstmonitor.

$$ begin of routine - insert your code only below this line -

... "insert your code here

*-- fill table "MONITOR" with values of structure "MONITOR_REC"

*- to make monitor entries

... "to cancel the update process

  • raise exception type CX_RSROUT_ABORT.

DATA: DS_TMP_RP TYPE TYS_TG_1.

DATA: DT_TMP_RP LIKE STANDARD TABLE OF DS_TMP_RP

WITH DEFAULT KEY.

DATA: DL_RECORD TYPE RSARECORD,

DL_IDX TYPE SY-TABIX.

  • For debugging only (from here)

*DATA: DL_DEBUG(1) TYPE C.

  • BREAK S855362.

  • CLEAR DL_DEBUG.

  • DO.

  • IF DL_DEBUG EQ 'X'.

  • EXIT.

  • ENDIF.

  • ENDDO.

  • (to here) Go to trx sm50 to stop the loop and step thru the code!

DESCRIBE TABLE RESULT_PACKAGE LINES DL_IDX.

READ TABLE RESULT_PACKAGE ASSIGNING <RESULT_FIELDS> INDEX DL_IDX.

IF SY-SUBRC EQ 0.

DL_RECORD = <RESULT_FIELDS>-RECORD.

ENDIF.

  • In DTP filter, keep only doc types RA,RC and RE.

  • Also, in start routine, keep only ac doc item 1's.

LOOP AT RESULT_PACKAGE ASSIGNING <RESULT_FIELDS>.

LOOP AT DT_RSEGPO INTO DS_RSEGPO

WHERE /BIC/ZINV_REC = <RESULT_FIELDS>-/BIC/ZINV_REC.

IF SY-SUBRC EQ 0.

IF DS_RSEGPO-ITEM_NUM = <RESULT_FIELDS>-/BIC/ZINV_ITM. "item 1

<RESULT_FIELDS>-OI_EBELN = DS_RSEGPO-OI_EBELN.

<RESULT_FIELDS>-OI_EBELP = DS_RSEGPO-OI_EBELP.

<RESULT_FIELDS>-FISCYEAR = DS_RSEGPO-FISCYEAR.

<RESULT_FIELDS>-CURRENCY = DS_RSEGPO-CURRENCY.

<RESULT_FIELDS>-OI_WRBTR = DS_RSEGPO-OI_WRBTR.

<RESULT_FIELDS>-/BIC/ZAMT_USD = DS_RSEGPO-/BIC/ZAMT_USD.

MODIFY RESULT_PACKAGE FROM <RESULT_FIELDS>.

ELSE.

CLEAR DS_TMP_RP.

ADD 1 TO DL_RECORD.

MOVE-CORRESPONDING <RESULT_FIELDS> TO DS_TMP_RP.

DS_TMP_RP-RECORD = DL_RECORD.

DS_TMP_RP-/BIC/ZINV_ITM = DS_RSEGPO-ITEM_NUM.

DS_TMP_RP-OI_EBELN = DS_RSEGPO-OI_EBELN.

DS_TMP_RP-OI_EBELP = DS_RSEGPO-OI_EBELP.

DS_TMP_RP-FISCYEAR = DS_RSEGPO-FISCYEAR.

DS_TMP_RP-CURRENCY = DS_RSEGPO-CURRENCY.

DS_TMP_RP-OI_WRBTR = DS_RSEGPO-OI_WRBTR.

DS_TMP_RP-/BIC/ZAMT_USD = DS_RSEGPO-/BIC/ZAMT_USD.

APPEND DS_TMP_RP TO DT_TMP_RP.

ENDIF.

ENDIF.

ENDLOOP.

ENDLOOP.

ADD 1 TO DL_IDX.

INSERT LINES OF DT_TMP_RP INTO RESULT_PACKAGE INDEX DL_IDX.

  • SORT RESULT_PACKAGE BY AC_DOC_NO

  • COMP_CODE

  • /BIC/ZINV_REC

  • /BIC/ZINV_ITM

  • CREDITOR

  • FISCVARNT.

  • NEED TO DELETE ANY ITEM 1's THAT DIDN'T ACTUALLY HAVE AN RSEG RCD?

$$ end of routine - insert your code only before this line -

ENDMETHOD. "end_routine

[/code]

don't forget to assign points.

Hope it helps,

Cheers,

Balaji

Former Member
0 Kudos

Create a field symbol like your RESULT_PACKAGE .

Loop at RESULT_PACKAGE Assigning < result_fields>

hope it helps,

Cheers,

Balaji