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: 

After enter date in Selection Screen : Showing Invalid Date

Former Member
0 Kudos

Hi,

g_fieldname = 'VDAT'.

CALL FUNCTION 'VIEW_RANGETAB_TO_SELLIST'

   EXPORTING

     fieldname          = g_fieldname

     append_conjunction = c_and

   TABLES

     sellist            = gt_seltab

     rangetab           = s_date.


selection screen : DATE


After enter the date Through F4 i am getting Follow error with pop up

Invalid date : Please enter date in format.. .

1 ACCEPTED SOLUTION

former_member185116
Active Participant
0 Kudos

hi ramu,

i think your using SELCT-OPTIONS for date field in selection screen that is why your getting error,

if user PARAMETERS in selection screen you will not get any error

can you share your code,

please be clear with your question,

regards ,

vinay..

9 REPLIES 9

former_member185116
Active Participant
0 Kudos

hi ramu,

i think your using SELCT-OPTIONS for date field in selection screen that is why your getting error,

if user PARAMETERS in selection screen you will not get any error

can you share your code,

please be clear with your question,

regards ,

vinay..

0 Kudos

Hi Vinay,

TABLES: zemployee.

CONSTANTS: c_view TYPE char30 VALUE 'ZEMPLOYEE',

  c_u TYPE char1 VALUE 'U',

  c_and TYPE char3 VALUE 'AND'.

DATA: gt_seltab TYPE STANDARD TABLE OF vimsellist,

           g_fieldname TYPE vimsellist-viewfield,

           gt_exclude TYPE TABLE OF vimexclfun,

  gwa_exclude TYPE vimexclfun.

SELECT-OPTIONS: s_id FOR zemployee-id,

                               s_date FOR zemployee-date.

 

*Add ID column to selection criteria of Table maintenanace view

g_fieldname = 'ID'.

CALL FUNCTION 'VIEW_RANGETAB_TO_SELLIST'

  EXPORTING

  fieldname = g_fieldname

  append_conjunction = c_and

  TABLES

  sellist = gt_seltab

  rangetab = s_id.

*Add Name column to selection criteria of Table maintenanace view

g_fieldname = 'DATE'.

CALL FUNCTION 'VIEW_RANGETAB_TO_SELLIST'

  EXPORTING

  fieldname = g_fieldname

  append_conjunction = c_and

  TABLES

  sellist = gt_seltab

  rangetab = s_date.

* Call to the 'VIEW_MAINTENANCE_CALL' function module

CALL FUNCTION 'VIEW_MAINTENANCE_CALL'

  EXPORTING

  action = c_u

  view_name = c_view

  TABLES

  dba_sellist = gt_seltab.

This is the coding.i am writing this is for call the maintainance view(SM30) before maintainance view i need Selection Screen..I am Used this date field for report its working fine..i feel i did mistake in this coding onlly....

0 Kudos

Hello Ramu,

the problem is that VIEW_RANGETAB_TO_SELLIST takes the input and converts it to internal date format. Since you are passing directly the internal format from your select option, it doesn't work. It turns out that you can only use this FM to create the SELLIST if you have simple values in your select-option.

What you could do:

CONSTANTS: c_view TYPE char30 VALUE 'ZDB_CS01_025',
   c_u TYPE char1 VALUE 'U',
   c_and TYPE char3 VALUE 'AND'.

DATA: gt_seltab TYPE STANDARD TABLE OF vimsellist,
            g_fieldname TYPE vimsellist-viewfield,
            gt_exclude TYPE TABLE OF vimexclfun,
   gwa_exclude TYPE vimexclfun.

data gs_char10 type c LENGTH 10.

SELECT-OPTIONS: s_id FOR sflight-connid,
                 s_date FOR sflight-fldate.


ranges r_date for gs_char10.

loop at s_date.
   MOVE-CORRESPONDING s_date to r_date.
   write s_date-low to r_date-low.
   write s_date-high to r_date-high.
   append r_date.

endloop.

Here the date range is converted to a range with external presentation of the date first. Now it works.

0 Kudos

This message was moderated.

0 Kudos

hi ramu,

in your code,


SELECT-OPTIONS: s_id FOR zemployee-id,

                               s_date FOR zemployee-date.

did the system allowed you craete field date in zemployee table..

regards,

vinay..

0 Kudos

Hi Vinay,

In my Zemployee date field is allowed.Even i developed one report for this zemployee in this also DATE field is working..when i am using above code i am getting this error Invalid date: Please enter date in the format DD.MM.YYYY. Pls do needful.

Regards,

Ramu

0 Kudos

Here's the whole coding. I think you forgot to change s_date with r_date in the FM call.  I used table TVFKD for the exampte, because there is no zemployee in our system. To adapt it, you will have to change the table name and the component names:

report zjktmp01.

TABLES: TVFKD.
CONSTANTS: c_view TYPE char30 VALUE 'V_TVFKD',
   c_u TYPE char1 VALUE 'U',
   c_and TYPE char3 VALUE 'AND'.

DATA: gt_seltab TYPE STANDARD TABLE OF vimsellist,
            g_fieldname TYPE vimsellist-viewfield,
            gt_exclude TYPE TABLE OF vimexclfun,
   gwa_exclude TYPE vimexclfun.

data gs_char10 type c LENGTH 10.

SELECT-OPTIONS: s_id FOR tvfkd-numki,
                 s_date FOR tvfkd-fkdat.


ranges r_date for gs_char10.

loop at s_date.
   MOVE-CORRESPONDING s_date to r_date.
   write s_date-low to r_date-low.
   write s_date-high to r_date-high.
   append r_date.

endloop.


*Add ID column to selection criteria of Table maintenanace view
g_fieldname = 'NUMKI'.

CALL FUNCTION 'VIEW_RANGETAB_TO_SELLIST'
   EXPORTING
   fieldname = g_fieldname
   append_conjunction = c_and
   TABLES
   sellist = gt_seltab
   rangetab = s_id.

*Add Name column to selection criteria of Table maintenanace view

g_fieldname = 'FKDAT'.

CALL FUNCTION 'VIEW_RANGETAB_TO_SELLIST'
   EXPORTING
   fieldname = g_fieldname
   append_conjunction = c_and
   TABLES
   sellist = gt_seltab
   rangetab = r_date.

CALL FUNCTION 'VIEW_MAINTENANCE_CALL'
   EXPORTING
   action = c_u
   view_name = c_view
   TABLES
   dba_sellist = gt_seltab.

0 Kudos

hi ramu,

as jorg krause said,

the problem is with internal and external date format conversion in FM,

i have tested the code as said by jorg,

its working fine,

plaese go through my entire code

TABLES : zemployee.

CONSTANTS : c_view TYPE char30 VALUE 'ZEMPLOYEE',
             c_u TYPE char1 VALUE 'U',
             c_and TYPE char3 VALUE 'AND'.



DATA  : gt_seltab TYPE STANDARD TABLE OF vimsellist,
         g_fieldname TYPE vimsellist-viewfield,
         gt_exclude TYPE TABLE OF vimexclfun,
         gwa_exclude TYPE vimexclfun.

data :  gs_char10 type c LENGTH 10.



SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.

   SELECTION-SCREEN skip 1.

SELECT-OPTIONS : s_id FOR zemployee-eid,
                  s_date FOR zemployee-edate.


  SELECTION-SCREEN skip 1.


SELECTION-SCREEN END OF BLOCK b1.


START-OF-SELECTION.


*Add ID column to selection criteria of Table maintenanace view

g_fieldname = 'EID'.



CALL FUNCTION 'VIEW_RANGETAB_TO_SELLIST'

   EXPORTING

   fieldname = g_fieldname

   append_conjunction = c_and

   TABLES

   sellist = gt_seltab

   rangetab = s_id.



*Add Name column to selection criteria of Table maintenanace view



g_fieldname = 'EDATE'.



ranges r_date for gs_char10.

loop at s_date.
    MOVE-CORRESPONDING s_date to r_date.
    write s_date-low to r_date-low.
    write s_date-high to r_date-high.
    append r_date.

endloop.




CALL FUNCTION 'VIEW_RANGETAB_TO_SELLIST'

   EXPORTING

   fieldname = g_fieldname

   append_conjunction = c_and

   TABLES

   sellist = gt_seltab

   rangetab = r_date.




* Call to the 'VIEW_MAINTENANCE_CALL' function module

CALL FUNCTION 'VIEW_MAINTENANCE_CALL'

   EXPORTING

   action = c_u

   view_name = c_view

   TABLES

   dba_sellist = gt_seltab.

the above code is working fine,

any problem get back to me,

regards,

vinay reddy..

0 Kudos

i am also attching the screen shot for your refernce,