I am trying to extract data from SAP and put in Unix flat file. The amt of data selected will be huge and the unix file will have to be compressed. To do this, I am using Filter 'compress' when I open dataset for output. As part of the I am transferring in the select/end select statement. So each record is read from SAP and transfered to the flat file. After a 1000 records, it exits out of the select /end selcect to commit work. After commiting, goes back to finish selection.
The code is breaking at commit work.
<b>The error says: Pipes can only be open using Open dataset ... filter .. within a 'Unit of Work'.
A 'Rollout' closes the pipe automatically
My question is, do I need to commit work since I am selecting and transferring each record one at a time? If yes, how do I compress and commit after 1000 records with getting this error..</b>
FORM F_WRITE_AUFK. ' <- Form
CLEAR: GV_ERROR, GV_RECCNT, GV_T_AMT, GV_T_QTY,
GV_T_DOCS, GV_PREVIOUS_REC_ID, GV_PASSCNT.
----
Data: GC_COMMIT dafault '1000'.
OPEN DATASET LV_FILE FOR OUTPUT in text mode encoding default filter 'compress'.
IF GV_ERROR = 'X'.
EXIT.
ENDIF.
IF GV_ERROR = 'X'.
EXIT.
ELSE.
DO. " Loop to commit work
*-------
SELECT AUFNR AUART AUTYP ERNAM AENAM AEDAT KTEXT
FROM AUFK INTO gs_AUFK
WHERE AUFNR IN S_AUFNR
AND AUFNR > GV_PREVIOUS_REC_ID
ORDER BY AUFNR. " Select into a work area
GV_PREVIOUS_REC_ID = GS_AUFK-AUFNR.
ADD 1 TO GV_PASSCNT.
PERFORM F_TRANSFER_DATASET USING P_F_AUFK GS_AUFK CHANGING GV_ERROR.
IF GV_PASSCNT = GC_COMMIT. " Exit when ready to commit work.
EXIT.
ENDIF.
ENDSELECT.
*-------
IF GV_PASSCNT = GC_COMMIT.
COMMIT WORK.
CLEAR GV_PASSCNT.
*------Commit work and go back to the select/endselect to get more records
ELSE.
EXIT.
ENDIF.
ENDDO.
ENDIF.
IF GV_ERROR = 'X'.
EXIT.
ELSE.
PERFORM F_CLOSEDATASET USING P_F_AUFK CHANGING GV_ERROR.
ENDIF.
ENDFORM.<b></b>