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

APPEND

Former Member
0 Likes
748

Hi SAP Gurus,

in the following code , I want to make such criteria that code is able to defferntiate between two and accept them as different entries on basis of terminal ids e.g 4and 1 .

but it is accepting these entries as same and not able to defferinate b/t these two . what should i use with append comparing ids .

00000166 20071110 115900 00000001 0004

00000168 20071110 115500 00000001 0001

DO.

READ DATASET PA_FILE INTO REC.

  • CLEAR WA_PUNCHES.

IF SY-SUBRC <> 0.

EXIT.

ENDIF.

clear wa_score .

WA_SCORE-PERNR = REC+0(8) .

WA_SCORE-LDATE = REC+9(8) .

WA_SCORE-LTIME = REC+18(6) .

WA_SCORE-CANID = REC+25(8) .

WA_SCORE-TERID = REC+34(4) .

APPEND WA_SCORE TO IT_SCORE.

Thanks .

5 REPLIES 5
Read only

Former Member
0 Likes
727

hi,

why don't create a new variable with the charcter length for all the numbers and concatenate all the numbers and move it to that variable and then compare.

Reward points if useful.

Thanks.

Arunprasad.P

Read only

Former Member
0 Likes
727

WA_SCORE-PERNR = REC+0(8) .

WA_SCORE-LDATE = REC+10(8) .

WA_SCORE-LTIME = REC+20(6) .

WA_SCORE-CANID = REC+28(8) .

WA_SCORE-TERID = REC+38(4) .

try these changes.

awrd points if useful

Bhupal

Read only

Former Member
0 Likes
727

Hi,

You are reading internal table with

"READ DATASET PA_FILE INTO REC"

with no condition. so always it is expected that it will read the first record allways. if you want the second record to be read in the second time, use a variable as a counter and add it each time you go through do ...end do.

and modify your read as below

READ DATASET PA_FILE INTO REC index v_counter

This should help you to solve your issue.

if not please let me know.

Lijo

Read only

Former Member
0 Likes
727

Hi,

APPEND

Appends a line or multiple lines to the end of an index table.

Syntax

APPEND <line>|LINES OF <jtab> TO <itab>

[ASSIGNING <FS> | REFERENCE INTO <dref>].

A line <line> or multiple lines of an internal table <jtab> are appended to index table <itab>. If you use ASSIGNING or INTO REFERENCE, field symbol <FS> refers to the appended line or the relevant data reference is stored in <dref> after the state

Regards,

Priya.

Read only

Former Member
0 Likes
727

Ranjna,

First declare one structure like 'file lengths which you have '.

DO.

READ DATASET PA_FILE INTO your structure.

**Here all the data from file will get divided and will be moved into

concerned field of structur.Now compare with the structure-field to WA_SCORE-field.

Your functionality here.

ENDDO.