on 10-15-2007 3:19 PM
data is coming from standard program .
rf140-stida key entry date.
bsik-bldat posting date
i want to display difference between rf140-stida and bsik-bldat in scipt form it will give number of days.
how can i declare variables for this.
how to write code in my form.
Hi
U need to create a routine to calculate the difference:
/: DEFINE &DELTA& = SPACE
/: PERFORM <FORM NAME> IN PROGRAM <PROGRAN NAME>
/: USING &RF140-STIDA&
/: USING &BSIK-BLDAT&
/: CHANGING &DELTA&
&DELTA&
The routine has to be defined in your Z-PROGRAM and to have these interface:
FORM <FORM NAME> TABLES IN_TAB_EM STRUCTURE ITCSY
OUT_TAB_EM STRUCTURE ITCSY.
DATA: DELTA TYPE I.
DATA: DATE1 LIKE SY-DATUM,
DATE2 LIKE SY-DATUM.
* ---> Rembember the date has the ouput format, so it has to be converted in the
* input format
READ TABLE IN_TAB_EM WITH KEY NAME = 'RF140-STIDA'.
IF SY-SUBRC = 0.
DATE1(4) = IN_TAB_EM-VALUE+6(4).
DATE1+4(2) = IN_TAB_EM-VALUE+3(2).
DATE1+6(2) = IN_TAB_EM-VALUE(2).
ENDIF.
READ TABLE IN_TAB_EM WITH KEY NAME = 'BSIK-BLDAT'.
IF SY-SUBRC = 0.
DATE2(4) = IN_TAB_EM-VALUE+6(4).
DATE2+4(2) = IN_TAB_EM-VALUE+3(2).
DATE2+6(2) = IN_TAB_EM-VALUE(2).
ENDIF.
DELTA = DATE1 - DATE2.
READ TABLE OUT_TAB_EM WITH KEY NAME = 'DELTA'.
IF SY-SUBRC = 0.
WRITE DELTA TO OUT_TAB_EM-VALUE.
MODIFY OUT_TAB_EM INDEX SY-TABIX.
ENDIF.
ENDFORM.
Max
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Your variable is declared using command DEFINE, your calculation will need to be done in an ABAP subroutine and called using the PERFORM command (different from the regular ABAP command).
Online help has plenty on both of these commands.
<a href="http://help.sap.com/saphelp_47x200/helpdata/en/d2/cb3d07455611d189710000e8322d00/frameset.htm">SAP help</a>
Section 'SAPscript control commands'
Regards,
Nick
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
DEFINE is the keyword to declare the variables in the SAPSCRIPT.
/: DEFINE &symbol_name&
To get the diffrence, then you need to write the PERFORM in the SAPSCRIPT, and in the for do the diefference and pass the value to the script and print it
Regards
Sudheer
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
79 | |
9 | |
9 | |
7 | |
7 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.