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

Archiving customized tables

Former Member
0 Likes
614

Hi,

I want to archive around 10 tables for the past 30 days. i have used the following code to archive for one table.


* Internal table to store the records that was retrieved
DATA :  BEGIN OF GET_TAB OCCURS 1000.
        INCLUDE STRUCTURE ZFIT0056.
DATA :  END OF GET_TAB.

MOVE SY-DATUM TO TEMP_DATE.

SUBTRACT 30 FROM TEMP_DATE.

IF WA_CNT <> 0.
  PERFORM MOVE_RECORDS.
ENDIF.
FORM MOVE_RECORDS.
  CLEAR GET_TAB.
  TEMP_DATE = TEMP_DATE  + 1.
  MOVE TEMP_DATE+0(4) TO DATE_YY.
  MOVE TEMP_DATE+4(2) TO DATE_MM.
  MOVE TEMP_DATE+6(2) TO DATE_DD.
  CONCATENATE 'DR' DATE_DD DATE_MM DATE_YY '.AAA' INTO FILENAME.
  SELECT * FROM ZFI00001 INTO GET_TAB WHERE FILENAME1 = FILENAME.
    IF SY-SUBRC  = 0.
      APPEND GET_TAB.
    ENDIF.
  ENDSELECT.
  PERFORM ADD_RECORDS.
ENDFORM.                  

FORM ADD_RECORDS.
  INSERT ZFI00006 FROM TABLE GET_TAB.
  IF SY-SUBRC = 0.
    PERFORM DELETE_RECORDS.
  ENDIF.
ENDFORM.                    "add_Records

FORM DELETE_RECORDS.
  DELETE FROM ZF000001WHERE FILENAME1 = FILENAME.
  IF SY-SUBRC = 0.
    WA_CNT = WA_CNT - 1.
  ENDIF.
ENDFORM.                    "delete_records

can anybody suggest me a simpler way to archive all the 10 tables in a single program.

5 REPLIES 5
Read only

Former Member
0 Likes
575

Have you considered using the SAP standard ADK (Archive Developement Kit) and Workbench to get a more modularised and easier to (re-)use tool for this project?

You would have to do [a bit of reading first|http://help.sap.com/saphelp_nw2004s/helpdata/en/2a/fa0391493111d182b70000e829fbfe/content.htm], though.

Read only

0 Likes
575

no we are not using it. we want to archive the customized tables

Read only

0 Likes
575

can anybody help me on this

Read only

0 Likes
575

pls help

Read only

Former Member
0 Likes
575

Hi,

Hope this link will helpful to you

http://www.pbs-software.com/medien/praesentationen/PBS_CUSTOM_EN.pdf

Regards,

Pravin