Application Development 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: 

having a problem adding a number

Former Member
0 Kudos

Hi

I am having a problem adding a number of days to System dates in the SAP Scripts.

I have tried the following code but still can not get results.

(modifying F150_DUNN_01)

/:DEFINE &NEW_DATE& = ' '

/:PERFORM ADD_DATE IN PROGRAM ZREP01

/:PERFORM ADD_DATE IN PROGRAM ZREP01

/:USING &SY-DATUM&

/:CHANGING &NEW_DATE&

/:ENDPERFORM

AS Dear Sir/Madam

/

/ Special/Accountable Imprest

AS

AS According to records held in the Recoverable advances unit, it has been

observed that you have not retired your outstanding special/accountable

imprest issued as indicated below:

AS

AS You are advised to clear the outstanding imprest before &NEW_DATE&.

/ Please ignore this statement if you have already retired the imprest by

/ the date of the minute.

&----


*& Report ZREP01

*&

&----


*&

*&

&----


REPORT zrep01.

&----


*& Form ADD_DATE

&----


  • text

----


FORM ADD_DATE TABLEs INTAB STRUCTURE ITCSY

OUTTAB STRUCTURE ITCSY .

READ TABLE INTAB INDEX 1.

OUTTAB-VALUE = INTAB-VAlUE.

ADD 1 TO OUTTAB-VALUE.

CONDENSE OUTTAB-VALUE.

MODIFY OUTTAB INDEX 1.

ENDFORM.

I am getting the following error.

Short text

Unable to interpret "XX.XX.XXXX " as a number.

On using the debugger i discovered the value "XX.XX.XXXX " is places in Intab-value instead of the system date.

How do I solve this problem.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

in your print program change your code like this...


FORM add_date TABLES intab STRUCTURE itcsy
outtab STRUCTURE itcsy .
  DATA : date LIKE sy-datum.
  DATA : date2 TYPE CHAR10.

  date = sy-datum.
  ADD 1 TO date.
  READ TABLE outtab WITH KEY 'NEW_DATE'.
  IF sy-subrc = 0.
    CONCATENATE date+6(2) date+4(2) date+0(4)
    INTO date2 SEPARATED BY '.'.
    outtab-value = date2.
    MODIFY outtab INDEX sy-tabix.
  ENDIF.

*READ TABLE INTAB INDEX 1.
*  outtab-value = intab-value.
*  ADD 1 TO outtab-value.
*
*  CONDENSE outtab-value.
*  MODIFY outtab INDEX 1.
"when you reading SY-DATUM from FORM in intab it will be in 
"Character format like '26.11.2007' so you can't add any values 
ENDFORM.                    "ADD_DATE

Message was edited by:

Perez C

Message was edited by:

Perez C

3 REPLIES 3

Former Member
0 Kudos

Hi

Check for sy-subrc after the read statement and keep the stats in if block.

Reward pts if useful.

Regards,

Sreenivas

Former Member
0 Kudos

Hi,

in your print program change your code like this...


FORM add_date TABLES intab STRUCTURE itcsy
outtab STRUCTURE itcsy .
  DATA : date LIKE sy-datum.
  DATA : date2 TYPE CHAR10.

  date = sy-datum.
  ADD 1 TO date.
  READ TABLE outtab WITH KEY 'NEW_DATE'.
  IF sy-subrc = 0.
    CONCATENATE date+6(2) date+4(2) date+0(4)
    INTO date2 SEPARATED BY '.'.
    outtab-value = date2.
    MODIFY outtab INDEX sy-tabix.
  ENDIF.

*READ TABLE INTAB INDEX 1.
*  outtab-value = intab-value.
*  ADD 1 TO outtab-value.
*
*  CONDENSE outtab-value.
*  MODIFY outtab INDEX 1.
"when you reading SY-DATUM from FORM in intab it will be in 
"Character format like '26.11.2007' so you can't add any values 
ENDFORM.                    "ADD_DATE

Message was edited by:

Perez C

Message was edited by:

Perez C

Former Member
0 Kudos

..

Message was edited by:

Perez C