cancel
Showing results for 
Search instead for 
Did you mean: 

Problems with Conversion Routine

fthomazetti_costa
Participant
0 Kudos

Hello Experts,

I've an issue in my ABAP Conversion Routine.

This routine is located in an specific InfoObject in my Communication Structure / Transfer Rule, from PSA to ODS.

Here's the complete dataflow: InfoPackage > DataSource > Transfer Rule > InfoSource > Transformation Rule > ODS. It is an standard solution.

Routine:

PROGRAM CONVERSION_ROUTINE.

* Type pools used by conversion program
TYPE-POOLS: RS, RSARC, RSARR, SBIWA, RSSM.

* Declaration of transfer structure (selected fields only)
TYPES: BEGIN OF TRANSFER_STRUCTURE ,

* InfoObject 0ID_ITMTYP: CHAR - 000002
ITMTYP(000002) TYPE C,

END OF TRANSFER_STRUCTURE .
*----------------------------------------------------------------------*
* FORM COMPUTE_ID_ITMTYP
*----------------------------------------------------------------------*
* Compute value of InfoObject 0ID_ITMTYP
* in communication structure /BIC/CS0ID_BR_NF_2
*
* Technical properties:
* field name = ID_ITMTYP
* data element = /BI0/OIID_ITMTYP
* data type = CHAR
* length = 000002
* decimals = 000000
* ABAP type = C
* ABAP length = 000004
* reference field =
*----------------------------------------------------------------------*
* Parameters:
* --> RECORD_NO Record number
* --> TRAN_STRUCTURE Transfer structure
* <-- RESULT Return value of InfoObject
* <-> G_T_ERRORLOG Error log
* <-- RETURNCODE Return code (to skip one record)
* <-- ABORT Abort code (to skip whole data package)
*----------------------------------------------------------------------*
FORM COMPUTE_ID_ITMTYP
USING RECORD_NO LIKE SY-TABIX
TRAN_STRUCTURE TYPE TRANSFER_STRUCTURE
G_S_MINFO TYPE RSSM_S_MINFO
CHANGING RESULT TYPE /BI0/OIID_ITMTYP
G_T_ERRORLOG TYPE rssm_t_errorlog_int
RETURNCODE LIKE SY-SUBRC
ABORT LIKE SY-SUBRC. "set ABORT <> 0 to cancel datapackage
*$*$ begin of routine - insert your code only below this line *-*

DATA: Z_ITMTYP(02) TYPE C,
V_CONV(000002) TYPE C.

CLEAR: Z_ITMTYP, V_CONV.

MOVE TRAN_STRUCTURE TO V_CONV.
CONDENSE V_CONV NO-GAPS.
SHIFT V_CONV LEFT DELETING LEADING '0'.

IF V_CONV EQ '1'.
Z_ITMTYP = '01'.
MOVE Z_ITMTYP TO RESULT.
ELSEIF V_CONV EQ '2'.
Z_ITMTYP = '02'.
MOVE Z_ITMTYP TO RESULT.
ELSE.
MOVE V_CONV TO RESULT.
ENDIF.

*$*$ end of routine - insert your code only before this line *-*
ENDFORM.
*----------------------------------------------------------------------*
* FORM INVERT_ID_ITMTYP
*----------------------------------------------------------------------*
* Inversion of selection criteria for InfoObject 0ID_ITMTYP
*
* This subroutine needs to be implemented only for SAP RemoteCubes
* (for better performance) and for the Report/Report Interface
* (drill through).
*
*----------------------------------------------------------------------*
* --> I_RT_CHAVL_CS Ranges table for current InfoObject
* --> I_THX_SELECTION_CS Selection criteria for all other InfoObjects
* <-- C_T_SELECTION Selection criteria for fields of
* transfer structure
* <-- E_EXACT Flag: Inversion was exact
*----------------------------------------------------------------------*
FORM INVERT_ID_ITMTYP
USING I_RT_CHAVL_CS TYPE RSARC_RT_CHAVL
I_THX_SELECTION_CS TYPE RSARC_THX_SELCS
CHANGING C_T_SELECTION TYPE SBIWA_T_SELECT
E_EXACT TYPE RS_BOOL.
*$*$ begin of inverse routine - insert your code only below this line*-*

DATA:
L_S_SELECTION LIKE LINE OF C_T_SELECTION.

* An empty selection means all values
CLEAR C_T_SELECTION.

L_S_SELECTION-FIELDNM = 'ITMTYP'.
* ...

* Selection of all values may be not exact
E_EXACT = RS_C_FALSE.

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

Here's the entries for InfoObject 0ID_ITMTYP: ZL, 01, ZM, 32, 02, ZX, 31, 1, ZW, 33, 2.

Here's the purpose of my routine: 1 became 01 and 2 became 02. Others entries keep the same.

Here's the exit of my routine: All entries became RE. (?????)

Could you please help me to find the issue?

Thanks,

FThomazetti

View Entire Topic
former_member186445
Active Contributor
0 Kudos

MOVE TRAN_STRUCTURE TO V_CONV

you move a structure to a variable. you should move a specific field of the structure to the variable. can you adapt this first?

M.

fthomazetti_costa
Participant
0 Kudos

Hello Mario,

Thanks for you contribution.

At the last, the client resolved to not use this field. I only spent my time with this issue.

I didn't proceed with the code but I think you're right about that point.

Thanks,

Flávio