Application Development and Automation 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: 
Read only

wrong date display

Former Member
0 Likes
1,871

Hi all Experts,

I am reading the infotype by using fm hr_read_infotype from infotype 0170. When I am trying to display i0170-endda, it is displaying wrong format.

i0170- enda for a pernr is 99991231

when trying to display from the structure which is retrived from the function module hr_read_infotype. is 91/23/ 999.

Please help me how to solve this issue.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,683

declare ur internal table as :

data: itab type table of p0170 initial size 0 with header line.

Regards

Prax

14 REPLIES 14
Read only

Former Member
0 Likes
1,683

check the date format settings in su01, defaults tab.

or may be..

The parameter name INFTY_TAB is not structure type but a string. So while displaying the date, make sure you are extracting complete date

Goto su01, enter your userid, click on defaults tabe and you will seee the date format

Thanks,

SKJ

Message was edited by:

SKJ

null

Read only

0 Likes
1,683

hi,

HOw to do date settings in the su01. I went there it is asking my userid. Can you please let me know how to do this?

Read only

0 Likes
1,683

Hi SJk

I tried in changing the date format but still it didnt work.

Read only

0 Likes
1,683

Hi all,

I wrote the code as below.

TABLES: pa0000.

DATA: i0170 TYPE TABLE OF pa0170 WITH HEADER LINE.

CALL FUNCTION 'HR_READ_INFOTYPE'

EXPORTING

  • TCLAS = 'A'

pernr = ls_pernr-pernr

infty = '0170'

BEGDA = '20070101'

endda = '99991231'

  • BYPASS_BUFFER = ' '

IMPORTING

subrc = l_subrc

TABLES

infty_tab = i0170

EXCEPTIONS

INFTY_NOT_FOUND = 1

OTHERS = 2

.

      • IF sy-subrc <> 0.

      • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

      • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

***

      • ENDIF.

IF l_subrc = 0.

write / i0170.

write / i0170-endda.

endif.

Please help me why the date format is wrong.

Read only

0 Likes
1,683

Try declaring :

Data: i0170 like pa0170 occurs 0 with header line.

Thanks,

SKJ

Read only

0 Likes
1,683

NO its not working SKJ

Ravi

Read only

0 Likes
1,683

ok try making these changes to your code:

declare your infotype as:

<b>INFOTYPES: 0170</b>

TABLES: pa0000.

<b>*DATA: i0170 TYPE TABLE OF pa0170 WITH HEADER LINE.</b>

CALL FUNCTION 'HR_READ_INFOTYPE'

EXPORTING

  • TCLAS = 'A'

pernr = ls_pernr-pernr

infty = '0170'

BEGDA = '20070101'

endda = '99991231'

  • BYPASS_BUFFER = ' '

IMPORTING

subrc = l_subrc

TABLES

infty_tab =<b>P0170</b>

EXCEPTIONS

INFTY_NOT_FOUND = 1

OTHERS = 2

.

      • IF sy-subrc <> 0.

      • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

      • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

***

      • ENDIF.

IF l_subrc = 0.

write /P0170

write / P0170-endda.

endif.

Thanks,

SKJ

Read only

0 Likes
1,683

Thanks SKJ

Its working fine. Thanks a lot for your help.

Ravi

Read only

Former Member
0 Likes
1,683

Try:

REPORT ztest LINE-SIZE 80 MESSAGE-ID 00.

DATA: dt TYPE sy-datum VALUE '99991231'.

WRITE: /001 dt MM/DD/YYYY.

Rob

Read only

0 Likes
1,683

Rob,

its working fine as you coded. But my scienerio is I read the complete record from infotype 0170 into i0170. Then how can i retrive i0170-endda.

Ravi

Read only

0 Likes
1,683

Can you:

REPORT ztest LINE-SIZE 80 MESSAGE-ID 00.

TABLES: pa0107.
DATA: dt TYPE sy-datum.

SELECT endda FROM pa0107 INTO dt UP TO 1 ROWS.
  WRITE: /001 dt MM/DD/YYYY.
ENDSELECT.

Rob

Read only

Former Member
0 Likes
1,684

declare ur internal table as :

data: itab type table of p0170 initial size 0 with header line.

Regards

Prax

Read only

0 Likes
1,683

Thanks Pradeep a lot. it is working fine with your suggested code.

Thanks

Ravi

Read only

Former Member
0 Likes
1,683

Thanks a lot this forum is helping a lot. Thanks for the forum administrator