SAP R/3 форум ABAP консультантов
Russian ABAP Developer's Club

Home - FAQ - Search - Memberlist - Usergroups - Profile - Log in to check your private messages - Register - Log in - English
Blogs - Weblogs News

Using DATASET



 
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> Programming Techniques | Приемы программирования
View previous topic :: View next topic  
Author Message
admin
Администратор
Администратор



Joined: 01 Sep 2007
Posts: 1640

PostPosted: Mon Sep 10, 2007 7:32 pm    Post subject: Using DATASET Reply with quote

Example 1
Code:

*&---------------------------------------------------------------------*
*&      Form  SENDTO_UNIX
*&---------------------------------------------------------------------*
FORM SENDTO_UNIX.

* open data set to transfer extract data
  OPEN DATASET Z_FILE_NAME FOR OUTPUT IN TEXT MODE.

  IF SY-SUBRC NE 0.
* File could not be opened for writing
    WRITE: / TEXT-006.
    LI_WRITE_ERROR = 1.
    EXIT.
  ENDIF.

  LOOP AT IT_PAYR.
    TRANSFER IT_PAYR TO Z_FILE_NAME.
  ENDLOOP.

* close dataset
  CLOSE DATASET Z_FILE_NAME.

ENDFORM.                               " SENDTO_UNIX


Example 2

Code:

*&---------------------------------------------------------------------*
OPEN DATASET OUTFILE FOR OUTPUT IN TEXT MODE.
* if the timestamped file cannot be created, do not process the
* input file, because the input file is deleted after processing,
* and there would be no record of the data.
      if not sy-subrc is initial.
*'ERROR opening file & for output'
        close dataset infile.
        message i033 with outfile.
        continue.  "process next vendor's file
      endif.
      do.
        read dataset infile into izss7b20.
        case sy-subrc.
          when 0.
            transfer izss7b20 to outfile.
            if izss7b20-datacode = 'T'. "trailer rec
              perform process_one_vendor using infile.
              exit.  "process next vendor's file
            endif.
            check izss7b20-datacode = 'D'. "data rec
            move-corresponding uty_vendors to ie020.
            move-corresponding izss7b20 to ie020.
          when 4.  "EOF
            perform process_one_vendor using infile.
            exit.  "process next vendor's file
          when others.
*ERROR reading dataset & on &
            message w015 with infile sy-datum.
            exit.  "discontinue file reads
        endcase.
      enddo.
      close dataset: infile, outfile.
      delete dataset infile.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> Programming Techniques | Приемы программирования All times are GMT + 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


All product names are trademarks of their respective companies. SAPNET.RU websites are in no way affiliated with SAP AG.
SAP, SAP R/3, R/3 software, mySAP, ABAP, BAPI, xApps, SAP NetWeaver and any other are registered trademarks of SAP AG.
Every effort is made to ensure content integrity. Use information on this site at your own risk.