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

urgent

Former Member
0 Likes
676

HI

I have the following requirement:

1) Inbound control will pick up the file from inbound directory sapin/ready.

2) The file there will be in tab delimited form.

3) The name for the this file should follow the naming convention like AFT.generic.XXXXXX.XXXX.

4) This file will be picked by an enhancement program and formatted into MARA format.

5) Along with this enhancement program should be able to segregate the items .

I dint get hte point. Kindly help me out which is of great need to me now.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
634

Hi

U should use statament OPEN DATASET/ READ DATASET/ CLOSE DATASET in order to open, read and close the file.

So your program should be:

DATA: BEGIN OF RECORD,
             ............................
           END    OF RECORD.

DATA ITAB LIKE STANDARD TABLE OF MARA WITH HEADER LINE.

DATA FILENAME(100) VALUE 'sapin/ready/AFT.generic.XXXXXX.XXXX'.

OPEN DATASET FILENAME FOR INPUT IN TEXT MODE.
IF SY-SUBRC = 0.
  DO.
      READ DATASET FILENAME INTO RECORD.
      IF SY-SUBRC <> 0. EXIT. ENDIF.
      
 * Transfer the data from RECORD to ITAB
     ITAB-MATNR = RECORD-.......   
      APPEND ITAB.
   ENDDO.
ENDIF.
CLOSE DATASET FILENAME.

The variable RECORD should be structured like your file

How to create the file name depends on your name convention.

Max

HI

I have the following requirement:

1) Inbound control will pick up the file from inbound directory sapin/ready.

2) The file there will be in tab delimited form.

3) The name for the this file should follow the naming convention like AFT.generic.XXXXXX.XXXX.

4) This file will be picked by an enhancement program and formatted into MARA format.

5) Along with this enhancement program should be able to segregate the items .

I dint get hte point. Kindly help me out which is of great need to me now.

3 REPLIES 3
Read only

Former Member
0 Likes
635

Hi

U should use statament OPEN DATASET/ READ DATASET/ CLOSE DATASET in order to open, read and close the file.

So your program should be:

DATA: BEGIN OF RECORD,
             ............................
           END    OF RECORD.

DATA ITAB LIKE STANDARD TABLE OF MARA WITH HEADER LINE.

DATA FILENAME(100) VALUE 'sapin/ready/AFT.generic.XXXXXX.XXXX'.

OPEN DATASET FILENAME FOR INPUT IN TEXT MODE.
IF SY-SUBRC = 0.
  DO.
      READ DATASET FILENAME INTO RECORD.
      IF SY-SUBRC <> 0. EXIT. ENDIF.
      
 * Transfer the data from RECORD to ITAB
     ITAB-MATNR = RECORD-.......   
      APPEND ITAB.
   ENDDO.
ENDIF.
CLOSE DATASET FILENAME.

The variable RECORD should be structured like your file

How to create the file name depends on your name convention.

Max

Read only

0 Likes
634

hi max,

wht i have mention earlier is not a table(mara) it is a strcture.here i am giving the whole requirement:

1) Inbound control will pick up the file from inbound directory sapin/ready.

2) The file there will be in tab delimited form.

3) The name for the this file should follow the naming convention like AFT.generic.XXXXXX.XXXX.

4) This file will be picked by this enhancement program and formatted into T9AFF (It is a structure related to financial batch interface) format.

5) Along with this enhancement program should be able to segregate the items on the basis of posting like GL-GL,GL-AP.etc..

6) The enhancement program will then create a temp file in T9AFF format.

7) The enhancement program will then call pre editor ZFACTVR0 which in turn will call standard program for FI posting (RFBIBL00).

Plz help me ..i dont no how to format the file like AFT.generic.XXXXXX.XXXX.

and i dont no how to segregate the items on the basis of posting like GL-GL,GL-AP.etc..

thanks

Read only

anversha_s
Active Contributor
0 Likes
634

Hi kiran,

chek this sample code.

parameters: p_file like rlgrap-filename obligatory
default '/usr/sap/upload.xls'.
 
types: begin of t_data,
vbeln like vbap-vbeln,
posnr like vbap-posnr,
matnr like vbap-matnr,
werks like vbap-werks,
megne like vbap-zmeng,
end of t_data.
data: it_data type standard table of t_data,
wa_data type t_data.
 
open dataset p_file for output in text mode encoding default.
if sy-subrc ne 0.
write:/ 'Unable to open file:', p_file.
else.
do.
read dataset p_file into wa_data.
if sy-subrc ne 0.
exit.
else.
append wa_data to it_data.
endif.
enddo.
close dataset p_file.
endif.

You can use the above format.

Regards

Anver

<b><i>if helped pls mark points</i></b>