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

Function Module

Former Member
0 Likes
857

Hi

Can any body help me for creating function module

where width I have to give it as parameter and I have to display the Title and

sy-datum and sy-uname .

sy-datum at the top left and title at center and sy-uname at top right.

Thanks in advance.

ksr.

10 REPLIES 10
Read only

Former Member
0 Likes
836

hi! KSR

I think the Format you have specified can not be Displayed using Function Module.

as Function Module can Display according to the Parameters it has(i,e IMPORT - Input, EXPORT - Output, TABLES - Item Display, Exceptions - Through Messages)

if you need only in you Particular Format can try Using SmartForms.

if any Queries regarding this get back to me,

Regards,

Naguln

Reward me if its Useful.

Read only

0 Likes
836

Thanks Naguln,

Can you tell me how to create the function module to get title ,sy-datum ,sy-sysid .

tell me the steps and how can i use it in a program.

Thanks

ksr

Read only

0 Likes
836

Hi ksr,

To get these fields you don't need any FM. you can directly use sy-title, sy-datum,sy-sysid in your program.

Regards,

Atish

Read only

0 Likes
836

Ok but i want to create a function module where a user can cal the function module and get the result

Read only

0 Likes
836

hi! K S R

In SmartForms Create or Design a Window Where you want to Print Your Details.

1. Goto --> Flow Logic (Near Form Painter Tab)

2. Select System-Fields Folder in that it has all the needed System Fileds can drag and Drop it in the Text.

3. Else can manualy type as sy-title, sy-datum, sy-ssid sy-repid.

Regards,

Nagulan

Reward me if its Useful.

Read only

0 Likes
836

hi! K S R

that is you want to Display the Title, Date, ID as Output when the Function Module is called is it So if not clear me.

Read only

0 Likes
836

yes nag you got me

Read only

Former Member
0 Likes
836

Hi

Code this in your function module

DATA: RV_PROG_NAME_LENGTH(40).

DATA: RV_LINE(255).

DATA: RV_POS TYPE I.

  • DATA: RV_DATE(10).

DATA: RV_TIME(10).

FIELD-SYMBOLS: <F1> TYPE ANY.

  • Valid Report List output Length is from 60 to 255 Charactetrs

IF IM_LINSZ < 60 or

IM_LINSZ > 255.

RAISE INVALID_LINE_SIZE.

ENDIF.

FORMAT COLOR COL_HEADING.

FORMAT INTENSIFIED ON.

  • format first header line

CLEAR RV_LINE.

ASSIGN RV_LINE(IM_LINSZ) TO <F1>.

  • In case only Report Title required to be shown

  • Format the first header line and exit

IF IM_TEXT_ONLY <> SPACE.

IF IM_TITLE = SPACE.

SKIP.

ELSE.

WRITE IM_TITLE TO <F1> CENTERED.

WRITE: / <F1>.

ENDIF.

EXIT.

ENDIF.

  • Otherwise format the whole header section

WRITE TEXT-007 TO <F1> CENTERED.

RV_PROG_NAME_LENGTH = STRLEN( im_report_name ).

<f1>(13) = TEXT-001.

<f1>+14(RV_PROG_NAME_LENGTH) = im_report_name.

RV_POS = IM_LINSZ - 16.

<F1>+RV_POS = TEXT-002.

ADD 6 TO RV_POS.

WRITE IM_DATE TO <F1>+RV_POS.

WRITE: / <F1>.

  • format second header line

CLEAR <F1>.

IF NOT IM_TITLE IS INITIAL.

WRITE IM_TITLE TO <F1> CENTERED.

ENDIF.

<F1>(13) = TEXT-006.

<F1>+14(12) = SY-UNAME.

SUBTRACT 6 FROM RV_POS.

<F1>+RV_POS = TEXT-004.

ADD 6 TO RV_POS.

WRITE IM_TIME TO RV_TIME USING EDIT MASK '__:__:__'.

<F1>+RV_POS = RV_TIME.

WRITE: / <F1>.

CLEAR <F1>.

  • format third header line

IF NOT IM_TITLE2 IS INITIAL.

WRITE IM_TITLE2 TO <F1> CENTERED.

ENDIF.

<F1>(7) = TEXT-003.

<F1>+14(3) = SY-SYSID.

<F1>+17(3) = '('.

<F1>+18(3) = SY-MANDT.

<F1>+21(3) = ')'.

SUBTRACT 6 FROM RV_POS.

<F1>+RV_POS = TEXT-005.

ADD 6 TO RV_POS.

<F1>+RV_POS = SY-PAGNO.

WRITE: / <F1>.

  • format fourth header line

IF NOT IM_TITLE3 IS INITIAL.

WRITE IM_TITLE3 TO <F1> CENTERED.

WRITE: / <F1>.

ENDIF.

FORMAT INTENSIFIED OFF.

FORMAT COLOR OFF.

Importing Parameters

IM_TITLE TYPE ANY

IM_TITLE2 TYPE ANY

IM_TITLE3 TYPE ANY

IM_REPORT_NAME LIKE SY-REPID

IM_TEXT_ONLY TYPE ANY

IM_LINSZ LIKE SY-LINSZ

IM_DATE TYPE DATUM

IM_TIME TYPE SYTIME

Try this call this function module in your report .

Please reward if useful.

Read only

0 Likes
836

Hi Dinesh,

Thaks but can u tell me the exceptions which i have to pass

Read only

Former Member
0 Likes
836

what parameters i have to take in import and export