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: 

creating routine

Former Member
0 Kudos

hi,

i need to have a routine in the external data tab -> infopackage , so that the routine takes changes the file in the external data tab with respect to the month. can any body help me with this as i have no idea about the routines. the file naems are similar to each other in all ways except that the month on the file name is different.

please some body help me by giving the entire program. help needed immidiately.

points will be fully rewarded.

Thanx,

Ravi.

Message was edited by: ravi kalidindi

3 REPLIES 3

Former Member
0 Kudos

Ravi - I'm not sure what you are trying to do.

Do you have files on the application or presentation server with the month in the file name? And are you trying to change the file name?

Rob

0 Kudos

hi,

yes i want to change the month name after every month.

thanx.

Ravi.

0 Kudos

Ravi , check if this code is useful for you.

IF NOT i_itab[] IS INITIAL.

CALL FUNCTION 'MONTH_NAMES_GET'

  • EXPORTING

  • LANGUAGE = SY-LANGU

  • IMPORTING

  • RETURN_CODE =

TABLES

MONTH_NAMES = itab_month

  • EXCEPTIONS

  • MONTH_NAMES_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.

READ TABLE itab_month

WITH KEY MNR = sy-datum+4(2).

CONCATENATE p_file itab_month-ltx '.TXT' INTO p_file.

OPEN DATASET p_file FOR OUTPUT IN TEXT MODE.

IF NOT i_itab[] IS INITIAL.

LOOP AT itab_out.

TRANSFER itab_out TO p_file.

ENDLOOP.

IF sy-subrc = 0.

MESSAGE s398(00) WITH p_file(25) 'created on Unix server'.

ELSE.

MESSAGE e398(00) WITH p_file(25) 'cannot be created'.

ENDIF.

ENDIF.