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

Need File Upload Logic

sreeramkumar_madisetty
Active Contributor
0 Likes
609

Hi Friends

I have to upload one file contains:

PERNR STATUS

Staus may be : In Planning,In Process,Submitted,Approved.

I should have to upload same Pernr with Statuses In Planning,In Procee,Submitted.

But once it has processed with Approved it has to throw error if i have tried again the same pernr to upload.

For ex:

1000 inplanning

1000 in process

1000 submitted

1000 approved.

1000 in planning

Here first 4 records have to be upload successfully and for 5th record it has to throw the error as it already processed with Approved status.

Please help me in logic.

Thanks & Regards,

Sree

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
578

Hi,

See the ex: for upload a file .

DATA FNAME(60) VALUE 'myfile'.

TYPES: BEGIN OF LINE,

COL1 TYPE I,

COL2 TYPE I,

END OF LINE.

TYPES ITAB TYPE LINE OCCURS 10.

DATA: LIN TYPE LINE,

TAB TYPE ITAB.

DO 5 TIMES.

LIN-COL1 = SY-INDEX.

LIN-COL2 = SY-INDEX ** 2.

APPEND LIN TO TAB.

ENDDO.

OPEN DATASET FNAME FOR OUTPUT.

LOOP AT TAB INTO LIN.

IF LIN-COL1 EQ 'Approved'

MESSAGE e000(xxxx) WITH 'This pernr already approved'.

ELSE.

TRANSFER LIN TO FNAME.

ENDIF.

ENDLOOP.

CLOSE DATASET FNAME.

Pls. reward if useful....

Hi Friends

I have to upload one file contains:

PERNR STATUS

Staus may be : In Planning,In Process,Submitted,Approved.

I should have to upload same Pernr with Statuses In Planning,In Procee,Submitted.

But once it has processed with Approved it has to throw error if i have tried again the same pernr to upload.

For ex:

1000 inplanning

1000 in process

1000 submitted

1000 approved.

1000 in planning

Here first 4 records have to be upload successfully and for 5th record it has to throw the error as it already processed with Approved status.

Please help me in logic.

Thanks & Regards,

Sree

3 REPLIES 3
Read only

Former Member
0 Likes
578

before upload check in dbase table whether same PERNR status is approved is there or not?

if approved status is there then raise an error msg other wise u can continue uploading

Read only

Former Member
0 Likes
579

Hi,

See the ex: for upload a file .

DATA FNAME(60) VALUE 'myfile'.

TYPES: BEGIN OF LINE,

COL1 TYPE I,

COL2 TYPE I,

END OF LINE.

TYPES ITAB TYPE LINE OCCURS 10.

DATA: LIN TYPE LINE,

TAB TYPE ITAB.

DO 5 TIMES.

LIN-COL1 = SY-INDEX.

LIN-COL2 = SY-INDEX ** 2.

APPEND LIN TO TAB.

ENDDO.

OPEN DATASET FNAME FOR OUTPUT.

LOOP AT TAB INTO LIN.

IF LIN-COL1 EQ 'Approved'

MESSAGE e000(xxxx) WITH 'This pernr already approved'.

ELSE.

TRANSFER LIN TO FNAME.

ENDIF.

ENDLOOP.

CLOSE DATASET FNAME.

Pls. reward if useful....

Read only

sreeramkumar_madisetty
Active Contributor
0 Likes
578

Closed.