cancel
Showing results for 
Search instead for 
Did you mean: 

Meaning of Returncode = 1 ?

sherif_elkoumy
Participant
0 Kudos

Hello guys,

I need to understand the meaning of Return code in a field Routine. Here is a field Routine that should be migrated or new coded on 7.4 bw system.

changing from comm_structure to source_fields is ok but what about replacing the first condition in IF Statement, Returncode = 1

should I replace it with RAISE EXCEPTION TYPE CX_RSROUT_SKIP_VALUE AND RAISE EXCEPTION TYPE CX_RSROUT_SKIP_RECORD

RESULT = COMM_STRUCTURE-COSTELMNT.

* accept all cost element except 699999
if         SOURCE_FIELDS-COSTELMNT = '0000699999' OR
      SOURCE_FIELDS
-COSTELMNT = '0000560000'.$


      RETURNCODE
= 1. (RAISE EXCEPTION TYPE CX_RSROUT_SKIP_VALUE /

                                             RAISE EXCEPTION TYPE CX_RSROUT_SKIP_RECORD)

      else.

      RETURNCODE = 0 (RESULT = SOURCE_FIELDS-COSTELMNT)


or what should I do here?

AS-IS

PROGRAM UPDATE_ROUTINE.
*$*$ begin of global - insert your declaration only below this line  *-*
* TABLES: ...
* DATA:   ...
*$*$ end of global - insert your declaration only before this line   *-*

FORM compute_key_field
TABLES   MONITOR STRUCTURE RSMONITOR "user defined monitoring
USING    COMM_STRUCTURE LIKE /BIC/CS8ZHC_DS37
RECORD_NO
LIKE SY-TABIX
RECORD_ALL
LIKE SY-TABIX
SOURCE_SYSTEM
LIKE RSUPDSIMULH-LOGSYS
CHANGING RESULT LIKE /BIC/VZ11HC_37AT-COSTELMNT
RETURNCODE
LIKE SY-SUBRC
ABORT
LIKE SY-SUBRC. "set ABORT <> 0 to cancel update
*
*$*$ begin of routine - insert your code only below this line

     fill the internal table "MONITOR", to make monitor entries


* put Cost element into Result field
RESULT
= COMM_STRUCTURE-COSTELMNT.

* accept all cost element except 699999
if COMM_STRUCTURE-COSTELMNT = '0000699999' or
COMM_STRUCTURE
-COSTELMNT = '0000560000'.
RETURNCODE
= 1.
else.
RETURNCODE
= 0.
endif.

* if abort is not equal zero, the update process will be canceled
ABORT
= 0.

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

Accepted Solutions (1)

Accepted Solutions (1)

sander_vanwilligen
Active Contributor
0 Kudos

Hi,

As of BW release 7.3 the standard behavior for RETURNCODE <> 0 is "skip record". Please refer to SAP Note 1610259 - Controlling 'Returncode' behavior in update rules. You can influence the behavior using RSADMIN parameters.

SAP advises to initialize the RESULT return parameter as a work-around for the old "skip value".

Please review SAP Note 1052648 - Migrating transfer rules and update rules for BW7.x for the migration logic and its limitations. The migrated coding using the second global part and subroutines FORM ... ENDFORM is in my opinion not transparent and not easy to maintain (although it should be possible to maintain). I suggest to rewrite the coding in an 7.x compliant way, i.e. w/o the overhead of the migration.

SAP Note 1527023 - Technical enhancement Routine source code; direct migration describes that improvements can be expected soon. However, SAP Note 1533114 is only released internally at the moment.

Best regards,

Sander

sherif_elkoumy
Participant
0 Kudos

Hello Sander,

thanks a lot for your replay.

This is exactly what I am gonna do, I will write the concept again according to 7.4 concept. I will not migrate the routine for the same reasons you stated, not easy and hard to maintain. For this reason I asked about replacing the line of returncode = 1 mentioned in the old code, how i could replace it?

I wrote it as follow,



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


* populate Cost element into Result field


     RESULT = COMM_STRUCTURE-COSTELMNT.


* Do not populate cost elements with the following values into target


      IF   SOURCE_FIELDS-COSTELMNT = '0000699999' OR
      SOURCE_FIELDS
-COSTELMNT = '0000560000'.


            RAISE EXCEPTION TYPE CX_RSROUT_SKIP_RECORD.

      else.


      RESULT = SOURCE_FIELDS-COSTELMNT.


ist that correct,


I replaced returncode = 1 with raise exception type cx_rsrout_skip_record

warm regards,

Sherif


sander_vanwilligen
Active Contributor
0 Kudos

Hi Sherif,

I agree 100% with your approach and confirm that using RAISE EXCEPTION TYPE CX_RSROUT_SKIP_RECORD can replace the RETURNCODE = 1 of the "old" migrated routine.


Best regards,

Sander


Answers (0)