Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

How to upload long text using BAPI_SERVICE_CREATE

Hi,

I'm uploading service master records (transaction AC03) through my program using function BAPI_SERVICE_CREATE. As per the requirements, for each service number, I've to pass long text also (refer to the last text area on the transaction screen).

In the tables section of the bapi BAPI_SERVICE_CREATE, there is a provision for an internal table on the form SERVICE_LONG_TEXTS. But it is of no use as even if I pass data to it, it is not written to the database.

Can anyone tell me solution for my problem?

Thanks.

Anuj.

Tags:
Former Member
Former Member replied

Anuj,

Create a new program using the following code and run it using an existing service number to see if the longtext gets updated. I ran it in my system and it is working fine. If it works for you, then you can modify your code accordingly.

report zlongtext.

data: header like thead,

ilines like tline occurs 0 with header line.

parameters: asnum like asmd-asnum.

start-of-selection.

header-tdobject = 'ASMD'.

header-tdname = asnum. " Make sure it has leading zeroes.

header-tdid = 'LTXT'.

header-tdspras = sy-langu.

ilines-tdformat = '*'.

ilines-tdline = 'Just a test to see how it works'.

append ilines.

clear ilines.

call function 'SAVE_TEXT'

exporting

header = header

  • INSERT = ' '

savemode_direct = 'X'

tables

lines = ilines

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.

else.

call function 'COMMIT_TEXT'.

if sy-subrc = 0.

write: / 'updated successfully'.

endif.

endif.

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question