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 To Check and Make changes

Former Member
0 Likes
2,495

hi

i have created a FM which have following code , i have created that one for updating header data of Notification

the Fm module are as following code

Import

Notif Type qmnum (check box pass value)

Export

TT_data type zNotif_data (where ZNotif_data is a table type which having fields qmnum qmart priok etc....)

source code:---

select qmnum

qmart

priok

ernam

qmdat

from qmel

into table tt_data

up to 1000 rows.

data : it_tlines like tline occurs 0 with header line.

data : it_text1 like thead occurs 0 with header line.

data : x_header type thead.

x_header-tdobject = 'feature'.

x_header-tdname = '99999996020000'.

x_header-tdid = 'head'.

x_header-tdspras = 'D'.

loop at it_tlines.

it_tlines-tdformat = '*'.

it_tlines-tdline = it_text1-tdtxtlines.

append it_tlines.

endloop.

CALL FUNCTION 'SAVE_TEXT'

EXPORTING

  • CLIENT = SY-MANDT

HEADER = x_header

INSERT = ' '

SAVEMODE_DIRECT = 'X'

  • OWNER_SPECIFIED = ' '

  • LOCAL_CAT = ' '

  • IMPORTING

  • FUNCTION =

  • NEWHEADER =

TABLES

LINES = it_tlines

EXCEPTIONS

ID = 1

LANGUAGE = 2

NAME = 3

OBJECT = 4

OTHERS = 5

.

IF SY-SUBRC <> 0.

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

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

commit work and wait.

update stxh set tdobject = 'D'

where tdobject = notif.

ENDIF.

ENDFUNCTION.

I M rtying it but it is not working.

if any one have idea please help me.

Edited by: Thomas Zloch on Apr 25, 2011 10:50 PM - please cut it down with the exclamation marks

12 REPLIES 12
Read only

Former Member
0 Likes
1,941

Hi,

Check whether the data in x_header-tdobject , x_header-tdname, x_header-tdid and x_header-tdspras are given correctly. If these values are correct and if there is no error returned by the function module "SAVE_TEXT ", then try with the below mentioned update statement also.

UPDATE qmel SET indtx = 'X' WHERE qmnum = QMNUM.

Thanks & Regards,

Harish

Read only

0 Likes
1,941

yes the annswer was helpful but my problem has not been resolved yet

i want to update the header data of a notification

if You have the system please chk this code in your system and help me please

Read only

Former Member
0 Likes
1,941

Hi,

I am unable to analyze the code provided by you. So kindly use the following code for your reference and try by doing the necessary changes.

  • Edit Text

HEADER-TDOBJECT = 'QMEL'.

HEADER-TDNAME = gfl_notif-QMNUM.

HEADER-TDSPRAS = 'E'.

HEADER-TDID = 'LTXT'.

header-tdlinesize = '072'.

*----


>Text1

lines-TDFORMAT = '*'.

lines-TDLINE = 'Text1'.

APPEND lines to git_lines.

CLEAR lines.

*----


>Text2

lines-TDFORMAT = '*'.

lines-tdline = 'Text2'.

APPEND LINES to git_lines.

CLEAR lines.

*----


>Text3

lines-TDFORMAT = '*'.

lines-tdline = 'Text3'.

APPEND LINES to git_lines.

CLEAR lines.

CALL FUNCTION 'CREATE_TEXT'

EXPORTING

FID = HEADER-TDID

FLANGUAGE = HEADER-TDSPRAS

FNAME = HEADER-TDNAME

FOBJECT = HEADER-TDOBJECT

SAVE_DIRECT = 'X'

FFORMAT = '*'

TABLES

FLINES = GIT_LINES

EXCEPTIONS

NO_INIT = 1

NO_SAVE = 2

OTHERS = 3

.

IF SY-SUBRC <> 0.

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

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

ENDIF.

CALL FUNCTION 'COMMIT_TEXT'

EXPORTING

OBJECT = header-tdobject

NAME = header-tdname.

  • set long text flag because create text does not do it

SELECT SINGLE indtx INTO long_text_ind FROM qmel WHERE qmnum = gfl_notif-QMNUM.

IF long_text_ind IS INITIAL.

UPDATE qmel SET indtx = 'X' WHERE qmnum = gfl_notif-QMNUM.

ENDIF.

Read only

0 Likes
1,941

I used that code but still my problem not resolved

please help me on my issue or create a Function Module and send me full code which have import export and source code also

please reply

Read only

0 Likes
1,941

Hi,

Could you please explain your exact requirement.

Thanks & Regards,

Harish

Read only

0 Likes
1,941

Actually I want to Update the Header data (long Text) of a notification for this i m creating that Function module this moduel is giving me the value from QMEL table as you can see this but i want to know how can i update the Header data (long Text) of a notification.

i have sent you all code and detail please help me in this

I hope now you have got my requirment also

Read only

0 Likes
1,941

Hi,

Please find a piece of working code for your requirement as mentioned below. This code is working fine in my system.

  • Edit Text

HEADER-TDOBJECT = 'QMEL'. "Should be given as QMEL in capital letters

HEADER-TDNAME = gfl_notif-QMNUM. "Should pass the Notification number with leading zeros.

HEADER-TDSPRAS = 'E'. "Should be given as E in capital letters

HEADER-TDID = 'LTXT'. "Should be given as LTXT in capital letters

header-tdlinesize = '072'.

*----


>Text1

lines-TDFORMAT = '*'.

lines-TDLINE = 'Text1'. "Pass the Header text values one by one.

APPEND lines to git_lines.

CLEAR lines.

*----


>Text2

lines-TDFORMAT = '*'.

lines-tdline = 'Text2'. "Pass the Header text values one by one.

APPEND LINES to git_lines.

CLEAR lines.

*----


>Text3

lines-TDFORMAT = '*'.

lines-tdline = 'Text3'. "Pass the Header text values one by one.

APPEND LINES to git_lines.

CLEAR lines.

Here call function CREATE_TEXT ior SAVE_TEXT

********************************************

CALL FUNCTION 'CREATE_TEXT'

EXPORTING

FID = HEADER-TDID

FLANGUAGE = HEADER-TDSPRAS

FNAME = HEADER-TDNAME

FOBJECT = HEADER-TDOBJECT

SAVE_DIRECT = 'X'

FFORMAT = '*'

TABLES

FLINES = GIT_LINES

EXCEPTIONS

NO_INIT = 1

NO_SAVE = 2

OTHERS = 3

.

OR

CALL FUNCTION 'SAVE_TEXT'

EXPORTING

  • CLIENT = SY-MANDT

HEADER = HEADER

INSERT = ' '

SAVEMODE_DIRECT = 'X'

TABLES

LINES = GIT_LINES

EXCEPTIONS

ID = 1

LANGUAGE = 2

NAME = 3

OBJECT = 4

OTHERS = 5

.

********************************************

-


HERE PUT A BREAK POINT AND SEE WHETHER SY-SUBRC IS EQUAL TO ZERO OR NOT. IF NOT EQUAL TO ZERO, THEN CHECK WHAT IS THE ERROR MESSAGE AND CORRECT THE SAME.

-


IF SY-SUBRC 0.

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

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

ENDIF.

CALL FUNCTION 'COMMIT_TEXT'

EXPORTING

OBJECT = header-tdobject

NAME = header-tdname.

  • set long text flag because create text does not do it

SELECT SINGLE indtx INTO long_text_ind FROM qmel WHERE qmnum = gfl_notif-QMNUM. "PROVIDE THE NOTIFICATION NUMBER WITH LEADING ZEROS.

IF long_text_ind IS INITIAL.

UPDATE qmel SET indtx = 'X' WHERE qmnum = gfl_notif-QMNUM. "PROVIDE THE NOTIFICATION NUMBER WITH LEADING ZEROS.

ENDIF.

Thanks & Regards,

Harish

Read only

0 Likes
1,941

<< Moderator message - Please do not ask for personal information>>

Edited by: Rob Burbank on Apr 25, 2011 12:43 PM

Read only

0 Likes
1,941

hello GURU

I read you text but it is not working in my Function Module Please set some another code to make changes in AEDAT field.

I want to update that field now......

Read only

Former Member
0 Likes
1,941

That doesn't look like "real" text. These types of texts have to be configured in SAP. Use correct TDID, TDOBJECT, TDNAME and TDSPRAS. To easily see these values, edit a text that is of the correct type via transaction, then read table STXH for your changes made today. The values you see in STXH are precisely how you need to populate values for your text save. BTW, does the text already exist? If so, you'll need delete before save, if I remember correctly.

Read only

0 Likes
1,941

i tried but not get any useful solution

Read only

Former Member
0 Likes
1,941

Thnx Help Full Answer