ABAP Long Text

Configurational Step

Storing The Text

DATA header_param       TYPE thead.
TYPES longtext_type TYPE TABLE OF tline WITH EMPTY KEY.

CONSTANTS key TYPE tdobname VALUE `abc123`.
CONSTANTS text_object TYPE tdobject VALUE `ZOBJECT`. "Text Object as configured in step 2 above
CONSTANTS text_id TYPE tdid VALUE `ZID`. "Text ID as configured in step 4 above


header_param = VALUE #( tdname = key
tdobject = text_object
tdid = text_id
tdspras = sy-langu ).

DATA(longtexts) = VALUE longtext_type( ( tdformat = '/' tdline = 'This is the first line' )
( tdformat = '/' tdline = 'This is still the first line' )
( tdformat = '*' tdline = 'This will be on the next line' ) ).


CALL FUNCTION 'SAVE_TEXT'
EXPORTING
header = header_param
savemode_direct = 'X'
TABLES
lines = longtexts "The Text
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.
WRITE:/ 'Successfully stored'.
ENDIF.

Retrieving The Text

DATA header_param       TYPE thead.
DATA longtexts TYPE STANDARD TABLE OF tline.

CONSTANTS key TYPE tdobname VALUE `abc123`. "This just an example of key
CONSTANTS text_object TYPE tdobject VALUE `ZOBJECT`. "Text Object as configured in step 2 above
CONSTANTS text_id TYPE tdid VALUE `ZID`. "Text ID as configured in step 4 above



CALL FUNCTION 'READ_TEXT'
EXPORTING
id = text_id
language = sy-langu
name = key
object = text_object
TABLES
lines = longtexts "The Text Retrieved
EXCEPTIONS
id = 1
language = 2
name = 3
not_found = 4
object = 5
reference_check = 6
wrong_access_to_archive = 7
OTHERS = 8.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ELSE.
"Proceed with text data from internal table longtext
ENDIF.

--

--

--

Indonesian origin. A Dad. SAP ABAP Developer. Geek. Meme Ehthusiast. Creator of https://www.instagram.com/sapabap101/

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

🔥🔥 For all user Get ( ~$50 ) Airdrop Joining

Gatsby.js — Display a Single Image

Solving Common Vue Problems — Classes, Binding and More

A Vue To A View —A Punchbag Game

React js + Dockerfile + Nginx production

My (bad) experience with service worker

Configuring Express Multer Middleware and Checking File Information

Writing to files in Deno

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Aditya Aufar

Aditya Aufar

Indonesian origin. A Dad. SAP ABAP Developer. Geek. Meme Ehthusiast. Creator of https://www.instagram.com/sapabap101/

More from Medium

3 Ways of Retrieving Infotype Data with ABAP

DC Motor Speed Control Using PID

INTEGRATION OF LVM PARTITION WITH HADOOP CLUSTER

Enabling sudo in Slackware