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

How to save Custom control records module pool program ?

Former Member
0 Likes
467

Hi guru ,

1. How to save Custom control records module pool program ?

I wrote multiple lines of record in custom control

Who to save that records ?

thanking you.

Regards,

Subash.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
413

Hi Subasha,

Please check the format below since it is based on a working code

**************data declarations

TYPES: BEGIN OF TY_EDITOR,

EDIT(254) TYPE C,

END OF TY_EDITOR.

data: int_line type table of tline with header line.

data: gw_thead like thead.

data: int_table type standard table of ty_editor.

You should create a text for uniquely identifying the text you are saving each time so that it doesn't get overwritten

For this a key combination must be decidedd to uniquely identify the test..here it is loc_nam

****************fill header..from SO10( t-code )

GW_THEAD-TDNAME = loc_nam. " unique key for the text

GW_THEAD-TDID = 'ST'. " Text ID

GW_THEAD-TDSPRAS = SY-LANGU.

GW_THEAD-TDOBJECT = 'ZXXX'. "name of the text object created

*Read Container and get data to int_table

CALL METHOD EDITOR ->GET_TEXT_AS_R3TABLE

IMPORTING

TABLE = int_table

EXCEPTIONS

ERROR_DP = 1

ERROR_CNTL_CALL_METHOD = 2

ERROR_DP_CREATE = 3

POTENTIAL_DATA_LOSS = 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.

ENDIF.

loop data from int_table and save to int_line-tdline appending it.

*save the text

CALL FUNCTION 'SAVE_TEXT'

EXPORTING

HEADER = GW_THEAD

TABLES

LINES = InT_LINE

EXCEPTIONS

ID = 1

LANGUAGE = 2

NAME = 3

OBJECT = 4

OTHERS = 5.

IF SY-SUBRC 0.

ENDIF.

The code shown above is ok and working fine for save also,hope that the above sample with helps you solve the problem

Please check and revert,

Reward if helpful

Regards

Byju

1 REPLY 1
Read only

Former Member
0 Likes
414

Hi Subasha,

Please check the format below since it is based on a working code

**************data declarations

TYPES: BEGIN OF TY_EDITOR,

EDIT(254) TYPE C,

END OF TY_EDITOR.

data: int_line type table of tline with header line.

data: gw_thead like thead.

data: int_table type standard table of ty_editor.

You should create a text for uniquely identifying the text you are saving each time so that it doesn't get overwritten

For this a key combination must be decidedd to uniquely identify the test..here it is loc_nam

****************fill header..from SO10( t-code )

GW_THEAD-TDNAME = loc_nam. " unique key for the text

GW_THEAD-TDID = 'ST'. " Text ID

GW_THEAD-TDSPRAS = SY-LANGU.

GW_THEAD-TDOBJECT = 'ZXXX'. "name of the text object created

*Read Container and get data to int_table

CALL METHOD EDITOR ->GET_TEXT_AS_R3TABLE

IMPORTING

TABLE = int_table

EXCEPTIONS

ERROR_DP = 1

ERROR_CNTL_CALL_METHOD = 2

ERROR_DP_CREATE = 3

POTENTIAL_DATA_LOSS = 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.

ENDIF.

loop data from int_table and save to int_line-tdline appending it.

*save the text

CALL FUNCTION 'SAVE_TEXT'

EXPORTING

HEADER = GW_THEAD

TABLES

LINES = InT_LINE

EXCEPTIONS

ID = 1

LANGUAGE = 2

NAME = 3

OBJECT = 4

OTHERS = 5.

IF SY-SUBRC 0.

ENDIF.

The code shown above is ok and working fine for save also,hope that the above sample with helps you solve the problem

Please check and revert,

Reward if helpful

Regards

Byju