Syntax for Insert Continued

| | 0 comments »

Previously we have discussed regarding syntax for Insert data into table part one and part two.We have also learned regarding inserting data into a internal table. Here is the continuation for that.

Insert a program

Basic form

INSERT REPORT prog FROM itab.

Effect

Inserts the program prog from the internal table itab into the library. The internal table itab contains the source code; the lines of the table cannot be more than 72 characters long. The program attributes (type, date, ...) are set by the system, but you can change them manually or in the program (table TRDIR ).

Runtime errors

1 · INSERT_PROGRAM_INTERNAL_NAME : he program name prog is reserve internally; it begins with '%_T' .

2· INSERT_PROGRAM_NAME_BLANK : The program name prog must not contain any blanks
characters.

3· INSERT_PROGRAM_NAME_TOO_LONG : The program name prog is too long; it cannot be more than 8 characters long.

4· INSERT_REPORT_LINE_TOO_LONG : One of the source code lines is longer than 72 characters.

INSERT - Insert text elements

Basic form

INSERT TEXTPOOL prog ...FROM itab ...LANGUAGE lg.

Effect

Assigns the text elements in the internal table itab to the program prog and the language lg and inserts them in the library. The line structure of the table itab is described in the section Text elements .

Example

The following program uses the internal table TAB to set the text elements of the program PROGNAME .

DATA: PROGRAM(8) VALUE 'PROGNAME',
TAB LIKE TEXTPOOL OCCURS 50 WITH HEADER
LINE.
TAB-ID = 'T'. TAB-KEY = SPACE. TAB-ENTRY =
'Sales'.
APPEND TAB.
TAB-ID = 'I'. TAB-KEY = '200'. TAB-ENTRY = 'Tax'.
APPEND TAB.
TAB-ID = 'H'. TAB-KEY = '001'. TAB-ENTRY = 'Name
Age'.
APPEND TAB.
TAB-ID = 'S'. TAB-KEY = 'CUST'. TAB-ENTRY =
'Customer'.
APPEND TAB.
TAB-ID = 'R'. TAB-KEY = SPACE. TAB-ENTRY = 'Test
program'.
APPEND TAB.
SORT TAB BY ID KEY.
INSERT TEXTPOOL PROGRAM FROM TAB LANGUAGE
SY-LANGU.

The internal table should be sorted by the components ID and KEY to enable faster access to the text elements at runtime. However, this is not obligatory. The component LENGTH (see text elements ) for the length of a text element does not have to be set explicitly. In this case - as in the example - the actual length of the text element is used.

The value of LENGTH cannot be smaller than the text to which it applies. If your length specification is too short, it is ignored by INSERT and the actual length is used instead. On the other hand, larger values are allowed and can be used to reserve space for texts that may be longer when translated into other languages.

Related Post

Syntax for Insert data into Table
You can go through entire syntax check here.
Check SAP SCRIPTS AND SMART FORMS BDC HERE COMPLETELY.
Learn object oriented approach of SAP ABAP HERE COMPLETELY.
ABAP ALE CONFIGURATION
BADI Complete Series and BAPI complete course

Other Programming Courses :

ASP.NET part one and two
Programming with C and C Sharp
Dot Net Complete Course Part one and two
Interview Questions in dot net and asp.net part one part two
Software Testing Complete course part one and two
Interview Questions in software Testing
V model Software Testing and Eleven steps in V model Testing

COMMENT HERE and thank you for sparing your valuable time.

Thank you for visiting SAP ABAP.If you liked the post, please subscribe to RSS FEED or get the updates directly into your mail box through EMAIL SUBSCRIPTION.If you want to contact me click here.

Request you to share this page on your favorite book mark site.
Share/Save/Bookmark

0 comments

Post a Comment

Yours search about a SAP ABAP topic shall end here.Just try once.