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: 

Problem with Date field

Former Member
0 Kudos

in function module i call the program using "submit" command, the syntax is:

submit ZSD_RG1_REG exporting list to memory

with WERKS = WERKS

with BUDAT-LOW = BUDAT_LOW

with BUDAT-HIGH = BUDAT_HIGH

with MATERIAL-LOW = MATERIAL_LOW

with MATERIAL-HIGH = MATERIAL_HIGH

and return.

i enter the values in FM for the fields in following ways werks = 1810 material_low = fet000075 and budat_low = 02.04.2005

now the result i get is selection-screen of the report where all the fields are filled except for the budat-low field which is showing blank.

Whereas i should'nt get the selection-screen of the report itself. What could be the error pls help me.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi Deepak,

Have you tried using budat_low = '20050402' ?

Regards,

Anand Mandalika.

11 REPLIES 11

Former Member
0 Kudos

Hi Deepak,

Have you tried using budat_low = '20050402' ?

Regards,

Anand Mandalika.

0 Kudos

ya i have tried using it

but it is accepting as 20.05.0402 if i enter '20050402'

0 Kudos

Hi,

what is the dictionary element of your budat? Internal date format is <i>always</i> YYYYMMDD, only external display depends on user settings.

-> Inside programs use '20050402' - and why is your conversion into an external format not working?

Regards,

Christian

0 Kudos

Hi Deepak,

1. The field BUDAT_LOW should be of type D. Have yo declared it with a character type ?

2. The date field is always of 8 characters. The separators come into picture only when the data is being displayed / printed.

3. All program variables which store the date should be declared with type D. And the data should always be given as 'YYYYMMDD' in the program. The date separator is a customizable setting and therefore can can be different for different users, based on their choice.

Regards,

Anand Mandalika.

0 Kudos

Thank you guys

all of you have been very helpful.

but in reality my problem is :

submit ZRPT_SD_027 exporting list to memory

with WERKS = WERKS

with BUDAT-LOW = BUDAT_HIGH

WITH BUDAT-HIGH = BUDAT_HIGH

WITH MATNR-LOW = MATERIAL-LOW

WITH MATNR-HIGH = MATERIAL_HIGH

with KUNNR-LOW = KUNNR_LOW

with KUNNR-HIGH = KUNNR_HIGH

WITH P_VARI = P_VARIS

and return.

If you look into above code:

i have declared all the left hand side part i.e. after "WITH" in my selection-screen and all the Right hand side part i.e. after "=" (eg BUDAT_LOW) in "IMPORT" parameter of the function module. You see some of the fields in the select-options may be optional (like KUNNR-HIGH OR MATNR-HIGH) so even in function module i wont enter any values for those fields which are optional. But even then while executin either it takes me to the selection-screen or gives an exception NOT_FOUND which it encounters in list_from_memory (following FM).

can you pls help me with this

andreas_mann3
Active Contributor
0 Kudos

why do you use with BUDAT-LOW = BUDAT_LOW

and not with "BUDAT in S_BUDAT" ?

regards Andreas

Former Member
0 Kudos

Hi Deepak,

Pass the value as extenal date type, and when using the date

convert it into internal date type using CONVERT_DATE_TO_INTERNAL.

For the vice versa try CONVERT_DATE_TO_EXTERNAL.

Cheers

Kathir~

0 Kudos

wouldn't it be much easier to link budat to dictionary and let do the system make the external conversions completly automatically?

Former Member
0 Kudos

there is a function module that can get the user setting for the date format for you and then u can use another function module to convert the date to the desired format....

these FMs are...

SLS_MISC_GET_USER_DATE_FORMAT - to get user's date format

SLS_MISC_CONVERT_TO_DATE - to convert date to desired

format

just see if u can help yourself with these....

regards,

PJ

0 Kudos

Hi Kathir~, PJ,

nice when you know all these functions to hanlde dates - but this can be done by system without any notice of user / programmer!

Just follow the way Anand Mandalika described detailed and you never need all these functions.

Sorry Deepak - here are two different solutions described by four persons - I hope we don't confuse you.

Regards,

Christian

Former Member
0 Kudos

Deepak,

Try this code.

RANGES R_BUDAT FOR SY-DATUM.

DATA: BUDAT_LOW TYPE D,

BUDAT_HIGH TYPE D.

BUDAT_LOW = '20050101'.

BUDAT_HIGH = '20050131'.

R_BUDAT-SIGN = 'I'.

R_BUDAT-OPTION = 'BT'.

R_BUDAT-LOW = BUDAT_LOW.

R_BUDAT-HIGH = BUDAT_HIGH.

APPEND R_BUDAT.

SUBMIT ZSD_RG1_REG

exporting list to memory

WITH BUDAT IN R_BUDAT

AND RETURN.

~Sivaraj.