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: 

BDC date recording

Former Member
0 Kudos

Hi,

i am getting the date from input file in YYYYMMDD format. But i have to map the date into vk11 Tcode as MM/DD/YYYY. If i am assigning it directly it is taking the YYYYMMDD format and it is telling invalid date. So, how can i convert it and how can i map it in MM/DD/YYYY format. Can anybody tell me. If any body having code can send it to me. Very Urgent......

Thanks.........

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

I did in the same way, i concatenate MM DD YYYY seperated by '/' in the required format. then it is becoming 10 char lengh. As the recording field accepting only 8 characters it is taking only MM/DD/YY only. But i need to record it as MM/DD/YYYY. Can any body give the suggession please.

Thanks.......

11 REPLIES 11

Former Member
0 Kudos

check the Fm conversion_exit_pdate_output

to convert it from yyyymmdd to internal format

regards,

vijay.

0 Kudos

REPORT zforum12 message-id vij.

Check the code

data : date like sy-datum.
data : odate(10) type c.
date = sy-datum.        " in format YYYYMMDD


CALL FUNCTION 'CONVERSION_EXIT_PDATE_OUTPUT'
  EXPORTING
   input         = date
 IMPORTING
   OUTPUT        = odate         .

write:/ odate.

"in ur format 'MM/DD/YYYY

1.

In ur itab make a field for date as 10 characters and use this Fm to store the date .

2. Pass the date as the charcter field to the screen and now check .

This will do .

vijay

Former Member
0 Kudos

Hi,

<b>before passing date into BDC coding</b> write this statement

PERFORM convertdate USING itab1-f2

CHANGING w_date..

FORM convertdate USING p_itab_f2

CHANGING p_w_date.

DATA : w_day(2) ,

w_month(2),

w_year(4).

w_day = p_itab_f2+6(2).

w_month = p_itab_f2+4(2).

w_year = p_itab_f2+0(4).

CONCATENATE w_month '/' w_day '/' w_year INTO p_w_date.

ENDFORM. " convertdate

Former Member
0 Kudos

Hi Anil,

Do like this: Declare three variables & one internal table having same structure you have used for uploadding. assign values of date field like this.

loop at itable.

v1 = date+0(4).

v2 = date+4(2).

v3 = date+6(2).

Concatenate v2 '/' v3 '/' v1 into date.

append itable to new_table.

endloop.

Ashven

Former Member
0 Kudos

Just use the code below to conert the date:


DATA: lv_date(10) TYPE c
      


*------------Date Conversion---------------------------*
CONCATENATE sy-datum+4(2)
            sy-datum+6(2)
            sy-datum(4) INTO lv_date SEPARATED BY '/'.

Regards

Former Member
0 Kudos

Hi,

I did in the same way, i concatenate MM DD YYYY seperated by '/' in the required format. then it is becoming 10 char lengh. As the recording field accepting only 8 characters it is taking only MM/DD/YY only. But i need to record it as MM/DD/YYYY. Can any body give the suggession please.

Thanks.......

0 Kudos

You can process the screen field with 10 char also in VK11 .

may be your date field is 8 chars so it is giving you the problem .

convert it to 10 char field and check the same.

regards,

vijay

0 Kudos

Take a field whose length is 10.

<b>data : w_date(10).

PERFORM convertdate USING itab1-f2

CHANGING w_date.

PERFORM bdc_field USING 'RV45A-ETDAT'

w_date.

</b>

if itab1-f2 is the field which contains u r date dont pass that pass u variable w_date

Former Member
0 Kudos

Hi anil,

1. take one new variable of type c

data : sdate(10) type c.

write itab-datum to sdate.

yyyymmdd -


> mm/ddyyyy (automatic as per current users format)

2. Now pass this SDATE

into bdc table.

regards,

amit m.

Former Member
0 Kudos

hi,

use this function module.

DATA :texts1 TYPE gsudisp OCCURS 0 WITH HEADER LINE,

l_date TYPE anla-aktiv.

CALL FUNCTION 'PDOT_DATE_CONVERT'

EXPORTING

  • OTYPE =

field = yyyymmdd

  • INFOTYPE =

  • BEGDA =

  • ENDDA =

TABLES

texts = texts1.

texts1-gtext field will have date in ddmmyyyy.

Former Member
0 Kudos

I used the built-in SAP Function:

CALL FUNCTION 'CONVERT_DATE_TO_EXTERNAL'

EXPORTING

date_internal = '<u>your internal date'</u>

IMPORTING

date_external = <u>'your external date'</u>

EXCEPTIONS

date_internal_is_invalid = 1

OTHERS = 2.