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: 

how to pass parameters when call a function

Former Member
0 Kudos

Hi all,

I need to create some Text Customer variables which can return the current month/year + 1, + 2, + 3... + 11. The format should looks like: Jul 08, Aug 08... Dec 08

I am writing a program which is calling two functions: 'RSCRMBW_MONTH' and 'MONTH_NAMES_GET'.

'RSCRMBW_MONTH' will return the month/year, for example: 07/2008, 08/2008...

'MONTH_NAMES_GET' should convert the month to Jul, Aug...

One thing I don't get is in the second function 'MONTH_NAMES_GET', there is a tab called Tables. It contain a parameter "MONTH_NAMES". Can anyone tell me how to pass this parameter from my program when I call this function?

Here is my program and I don't know how to write the second Call Function:

REPORT Z_TEST.

data: l_text type rstxtsh.

Data: l_code Type INT4.

clear l_text.

CALL FUNCTION 'RSCRMBW_MONTH'

EXPORTING

I_SHIFT = 1

  • I_DATE = SY-DATUM

  • I_DATFM = l_Format

IMPORTING

E_TEXT = l_text.

Call Function 'MONTH_NAMES_GET'

Exporting

LANGUAGE = 'E'

Importing

RETURN_CODE = l_code.

Write l_text.

Thanks for your advise!

1 ACCEPTED SOLUTION

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

Check this.

REPORT  zrich_0001.

data: l_code type sy-subrc.

DATA: inames TYPE TABLE OF t247.
DATA: xnames LIKE LINE OF inames.


CALL FUNCTION 'MONTH_NAMES_GET'
  EXPORTING
    language    = 'E'
  IMPORTING
    return_code = l_code
  tables
    month_names = inames.

* Read table by the month
READ TABLE inames INTO xnames WITH KEY mnr = sy-datum+4(2).
IF sy-subrc  = 0.
  WRITE:/ xnames-ltx.
ENDIF.

Regards,

Rich Heilman

3 REPLIES 3

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

Check this.

REPORT  zrich_0001.

data: l_code type sy-subrc.

DATA: inames TYPE TABLE OF t247.
DATA: xnames LIKE LINE OF inames.


CALL FUNCTION 'MONTH_NAMES_GET'
  EXPORTING
    language    = 'E'
  IMPORTING
    return_code = l_code
  tables
    month_names = inames.

* Read table by the month
READ TABLE inames INTO xnames WITH KEY mnr = sy-datum+4(2).
IF sy-subrc  = 0.
  WRITE:/ xnames-ltx.
ENDIF.

Regards,

Rich Heilman

0 Kudos

That's what I am looking for, thanks a lot both!

Former Member
0 Kudos

Hi,

As Rich said, that Function module MONTH_NAMES_GET is not getting input as MONTH_NAMES.

This Function module is used to get the month names for the specified Language. So when you give Language to the

Function module it will list the Month names in that TABLE - MONTH_NAMES

Cheers

Kothand