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: 

Error parameter type sy--datum

sergio_cifuentes
Participant
0 Kudos

i got a block with 2 parameters like this:

<i>SELECTION-SCREEN BEGIN OF block 1 WITH FRAME TITLE text-001.

PARAMETERS: p_chkb AS CHECKBOX.

SELECT-OPTIONS: p_date FOR sy-datum.

SELECTION-SCREEN END OF block 1.</i>

in my main programa i want to make a perform like this

<i>IF p_chkb NE SPACE.

PERFORM form_xxx USING p_date.

ENDIF.

</i>

but when i define the <i>form_xxx</i> i got this error:

<i>FORM form_xxx USING s_date TYPE sy-datum.

READ TABLE s_date INDEX 1.

IF sy-subrc NE 0.

message 'Please insert the date field' TYPE 'I'.

ELSE.

...

...

...

ENDIF.

ENDFORM.

</i>

<b>"S_DATE" is neither specified under "TABLES" nor is it defined as an internal table</b>

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

Check this example..

SELECT-OPTIONS: so_date FOR sy-datum.

AT SELECTION-SCREEN.

IF so_date[] IS INITIAL.

MESSAGE e208(00) WITH 'Date is required'.

ENDIF.

START-OF-SELECTION.

PERFORM select_data USING so_date[].

----


  • FORM select_data *

----


  • ........ *

----


  • --> LT_DATE *

----


FORM select_data USING lt_date LIKE so_date[].

DATA lt_vbak TYPE TABLE OF vbak.

SELECT * FROM vbak INTO TABLE lt_vbak

WHERE erdat IN lt_date[].

WRITE: / sy-subrc.

ENDFORM.

Thanks,

Naren

13 REPLIES 13

Former Member
0 Kudos

Hi,

You have declared the select-options as p_date. Pls check.

Regards

Subramanian

0 Kudos

yes i know and that's the one that i'm using when i call the form_xxx but inside the form_xxx i have to use the s_date

Former Member
0 Kudos

Double clike the perform and it will create the routine with the name p_s_date.

Thanks,

Santosh

Message was edited by:

SKJ

0 Kudos

1. It create's the routine but without type of the paramenter.

2. I try to use de 'IS INITIAL' but it gave me the error in here:

SELECT docsap ref sum( subtotal ) sum( iva )

FROM zcmtt_envase

INTO TABLE ti_zcmtt_envase

WHERE docsap = s_tipo

AND fecha IN s_date <------ERROR

AND estado NE ''

GROUP BY docsap ref.

Mensaje editado por:

Sergio Cifuentes

Former Member
0 Kudos

Hi,

Delete your FORM ...ENDFORM declaration. Double click on form_XXX in the PERFORM stmt. SAP will generate the appropriate FORM...ENDFORM strcuture for you. Then write the lines in between.

If you are using ECC 6.0 and the code checker asks for type of the parameter, give TYPE ANY.

Regards

Subramanian

Former Member
0 Kudos

Hello,

SELECTION-SCREEN BEGIN OF block 1 WITH FRAME TITLE text-001.

PARAMETERS: p_chkb AS CHECKBOX.

<b>SELECT-OPTIONS: p_date FOR sy-datum.</b>

SELECTION-SCREEN END OF block 1.

Change this to

PARAMETERS P_DATE LIKE SY-DATUM.

If u want to use it as Select-options then.

RANHES RA_DATUM TYPE SY-DATUM

<b>FORM XXX TABLES S_DATE STRUCTURE RA_DATUM</b>

Vasanth

Message was edited by:

Vasanth M

amit_khare
Active Contributor
0 Kudos

Hi,

You cannot do read table in the FORM since your parameter there is not of table type but of type SY-DATUM which is single element and not table.

instead if you pass in PERFORM

PERFORM form_xxx USING p_date-low.

and remove READ TABLE, code will run fine or declare s_date as type equivalent to p_date or remove USING if you are wriing the code in the same report without using Includes.

Regards,

Amit

Reward all helpful replies.

Former Member
0 Kudos

Hi,

Looks like you are checking for date to be filled.

Change the stmt like:

FORM form_xxx USING s_date .

          • READ TABLE s_date INDEX 1.

<b>IF s_date is initial.</b>

message 'Please insert the date field' TYPE 'I'.

ELSE.

...

...

...

ENDIF.

ENDFORM.

Regards

Subramanian

Former Member
0 Kudos

Hi,

Use the body operator if you didn't give the structure in the subroutine parameters..

Changes marked in bold..

SELECT docsap ref sum( subtotal ) sum( iva )

FROM zcmtt_envase

INTO TABLE ti_zcmtt_envase

WHERE docsap = s_tipo

AND fecha IN s_date<b>[ ]</b>

AND estado NE ''

GROUP BY docsap ref.

Thanks,

Naren

0 Kudos

it doesn't work with the '[]', maybe if i tell you what i want, i need a screen with 2 parameter 1 checkbox and the other it has to be a range of date, i mean from date to date, then if the checkbox it's checked i need to send the date variable in a parameter and in the form i have to use this parameter (date) to make a select.

Thanks,

Sergio

Mensaje editado por:

Sergio Cifuentes

Former Member
0 Kudos

Hi,

Check this example..

SELECT-OPTIONS: so_date FOR sy-datum.

AT SELECTION-SCREEN.

IF so_date[] IS INITIAL.

MESSAGE e208(00) WITH 'Date is required'.

ENDIF.

START-OF-SELECTION.

PERFORM select_data USING so_date[].

----


  • FORM select_data *

----


  • ........ *

----


  • --> LT_DATE *

----


FORM select_data USING lt_date LIKE so_date[].

DATA lt_vbak TYPE TABLE OF vbak.

SELECT * FROM vbak INTO TABLE lt_vbak

WHERE erdat IN lt_date[].

WRITE: / sy-subrc.

ENDFORM.

Thanks,

Naren

Former Member
0 Kudos

Hi,

U can write as belwo:

SELECTION-SCREEN BEGIN OF block 1 WITH FRAME TITLE text-001.
PARAMETERS: p_chkb AS CHECKBOX.
SELECT-OPTIONS: p_date FOR sy-datum OBLIGATORY.
SELECTION-SCREEN END OF block 1.

* AT SELECTION SCREEN ON p_date.


START-OF-SELECTION.

IF NOT p_chkb IS INITIAL.
   PERFORM form_xxx.
ENDIF.

FORM form_xxx.
IF NOT p_date IS INITIAL.
SELECT docsap ref sum( subtotal ) sum( iva )
       FROM zcmtt_envase
       INTO TABLE ti_zcmtt_envase
       WHERE docsap = s_tipo
       AND fecha IN p_date 
       AND estado NE ''
       GROUP BY docsap ref.

ENDIF. 
ENDFORM.

Hope this will solve ur problem.

Reward if this helps.

Former Member
0 Kudos

instead of USING, use TABLES .

it will solve ur problem.

Sujatha.