17.08.2013 Views

Data Interfaces

Data Interfaces

Data Interfaces

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Example: Variable Format (Generate)<br />

© SAP AG<br />

REPORT RSFFF01G.<br />

TABLES: SFLIGHT, SBOOK.<br />

INCLUDE RSFFF01I.<br />

PARAMETERS:<br />

FILE(20) DEFAULT '/tmp/RSFFF01G'<br />

LOWER CASE.<br />

START-OF-SELECTION.<br />

OPEN DATASET FILE FOR OUTPUT<br />

IN BINARY MODE.<br />

GET SFLIGHT.<br />

MOVE-CORRESPONDING SFLIGHT TO REC1.<br />

MOVE 'A' TO REC1-FLAG.<br />

TRANSFER REC1 TO FILE.<br />

WRITE REC1-CARRID, REC1-CONNID,.......<br />

GET SBOOK.<br />

MOVE-CORRESPONDING SBOOK TO REC2.<br />

MOVE 'B' TO REC2-FLAG.<br />

TRANSFER REC2 TO FILE.<br />

WRITE REC2-BOOKID, REC2-CUSTID,.......<br />

END-OF-SELECTION.<br />

CLOSE DATASET FILE.<br />

The above example generates a sequential file with data records of different structures.<br />

The include program is defined as follows:<br />

DATA: BEGIN OF REC1, FLAG.<br />

INCLUDE STRUCTURE SBC420A.<br />

DATA: END OF REC1.<br />

DATA: BEGIN OF REC2, FLAG.<br />

INCLUDE STRUCTURE SBC420B.<br />

DATA: END OF REC2.<br />

The structure SBC420A is used for flight data, while the structure SBC420B holds reservation data.<br />

A flag should indicate whether the next data record contains flight data or reservation data.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!