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

ABAP Code in Routines

Former Member
0 Likes
924

Hi,

Can anyone please tell me how the values have been calculated using following ABAP code:-

TABLES: ...

DATA: l_number_of_days TYPE i.

  • DATA: ...

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

FORM compute_data_field

TABLES MONITOR STRUCTURE RSMONITOR "user defined monitoring

USING COMM_STRUCTURE LIKE /BIC/CS8ZSD_D003

RECORD_NO LIKE SY-TABIX

RECORD_ALL LIKE SY-TABIX

SOURCE_SYSTEM LIKE RSUPDSIMULH-LOGSYS

CHANGING RESULT LIKE /BIC/VZSD_C004T-DLVVEYSC

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

  • result value of the routine

if COMM_STRUCTURE-recordmode eq ' '

or COMM_STRUCTURE-recordmode eq 'N'.

IF COMM_STRUCTURE-dlvqeysc GT 0 and COMM_STRUCTURE-dlvqlesc eq 0.

RESULT = COMM_STRUCTURE-dlvqeysc * COMM_STRUCTURE-netpr_vkm.

endif.

elseif COMM_STRUCTURE-recordmode eq 'X'.

if COMM_STRUCTURE-dlvqeysc lt 0 and COMM_STRUCTURE-dlvqlesc eq 0.

RESULT = -1 * COMM_STRUCTURE-dlvqeysc * COMM_STRUCTURE-netpr_vkm.

endif.

ENDIF.

  • if the returncode is not equal zero, the result will not be updated

RETURNCODE = 0.

  • if abort is not equal zero, the update process will be canceled

ABORT = 0.

4 REPLIES 4
Read only

Former Member
0 Likes
731

Hi,

This code is written in the routine and this routine will be called during a transaction call. (if this routine is assigned)

Following is the statement which will calculate the result values.

This result will be passed to the further step of your transaction.

RESULT = COMM_STRUCTURE-dlvqeysc * COMM_STRUCTURE-netpr_vkm.

OR

RESULT = -1 * COMM_STRUCTURE-dlvqeysc * COMM_STRUCTURE-netpr_vkm.

Read only

0 Likes
731

This code is written inside a subroutine and this is for calculating of the variable RESULT.

Looking at the code I can see that there are three possibilities of RESULT being populated.

(i) RESULT = COMM_STRUCTURE-dlvqeysc * COMM_STRUCTURE-netpr_vkm.

(ii) RESULT = -1 * COMM_STRUCTURE-dlvqeysc * COMM_STRUCTURE-netpr_vkm.

(iii) Blank.

See the reason being for the (iii) option is when if query fails that time there will be no result populated and no update happening.

Please let me know is this answer helping you?

Thanks,

P.Anurag

Edited by: P_Anurag on Apr 22, 2009 9:11 AM

Read only

0 Likes
731

Yes upto some extent....actually I want to know which fields (from ECC) are being used to calculate these values..in this case....BI field is dlvqeysc...just want to confirm if NETPR should be the source field.

Appreciate your response.

Read only

Former Member
0 Likes
731

Resolved