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

Call ABAP program from existing program



 
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> ABAP Objects
View previous topic :: View next topic  
Author Message
admin
Администратор
Администратор



Joined: 01 Sep 2007
Posts: 1640

PostPosted: Sat Nov 17, 2007 10:06 pm    Post subject: Call ABAP program from existing program Reply with quote

Code:
REPORT Z_call_ABAP_program  NO STANDARD PAGE HEADING.

TABLES : BKPF , INDX.

PARAMETERS : ZBUKRS LIKE BKPF-BUKRS OBLIGATORY DEFAULT '0001',
                             ZGJAHR LIKE BKPF-GJAHR OBLIGATORY DEFAULT '1995'.
SELECT-OPTIONS : ZPERIOD FOR BKPF-MONAT OBLIGATORY.

DATA : BEGIN OF CHECK_TAB OCCURS 100,
                 CLIENT LIKE BSEG-MANDT ,
                 COMPANY LIKE BKPF-BUKRS ,
                 FINYR LIKE BKPF-GJAHR ,
                 MONAT LIKE BKPF-MONAT ,
                 LDDT LIKE BKPF-CPUDT ,
             END OF CHECK_TAB.
DATA : BEGIN OF CHECK_TABO OCCURS 100,
                  CLIENT LIKE BSEG-MANDT ,
                  COMPANY LIKE BKPF-BUKRS ,
                  FINYR LIKE BKPF-GJAHR ,
                  MONAT LIKE BKPF-MONAT ,
                  LDDT LIKE BKPF-CPUDT ,
              END OF CHECK_TABO.

DATA : BEGIN OF CT_KEY ,
                  CLIENT LIKE BSEG-MANDT ,
                  COMPANY LIKE BKPF-BUKRS ,
                  FINYR LIKE BKPF-GJAHR ,
                  MONAT LIKE BKPF-MONAT ,
                  LDDT LIKE BKPF-CPUDT ,
               END OF CT_KEY.

START-OF-SELECTION.
IMPORT CHECK_TAB FROM DATABASE INDX(VP) ID 'CDSDATE'.

LOOP AT CHECK_TAB.
      MOVE-CORRESPONDING CHECK_TAB TO CHECK_TABO. APPEND CHECK_TABO.
ENDLOOP.

LOOP AT CHECK_TAB.
     IF CHECK_TAB-FINYR = ZGJAHR AND CHECK_TAB-MONAT IN ZPERIOD AND
          CHECK_TAB-COMPANY = ZBUKRS.
          CLEAR CT_KEY.
           MOVE: CHECK_TAB-CLIENT TO CT_KEY-CLIENT ,
           CHECK_TAB-COMPANY TO CT_KEY-COMPANY,
           CHECK_TAB-FINYR TO CT_KEY-FINYR ,
            CHECK_TAB-MONAT TO CT_KEY-MONAT ,
            CHECK_TAB-LDDT TO CT_KEY-LDDT.

            EXPORT : CHECK_TAB CT_KEY TO MEMORY.
            SUBMIT ZCDSDTUP
                      WITH YCLIENT = SY-MANDT
                      WITH YCOMPANY = ZBUKRS
                      WITH YFINYR = ZGJAHR
                      WITH YMONAT = CHECK_TAB-MONAT
                      WITH YLDDT = CHECK_TAB-LDDT
                      VIA SELECTION-SCREEN AND RETURN.

               IMPORT CHECK_TAB FROM MEMORY .
        ENDIF.
ENDLOOP. 

SKIP 2.
WRITE :/2 'Position Before Update'. ULINE /2(53).
WRITE :/4 'Client' , 11 'Comp.' , 18 'Fin.Yr.' , 27 'Period' ,
35 'Data Downloaded upto'. SKIP 1.
LOOP AT CHECK_TABO.
     IF CHECK_TABO-FINYR = ZGJAHR AND CHECK_TABO-MONAT IN ZPERIOD AND
         CHECK_TABO-COMPANY = ZBUKRS.
         WRITE :/5 CHECK_TABO-CLIENT,11 CHECK_TABO-COMPANY,19 CHECK_TABO-FINYR,
                      29 CHECK_TABO-MONAT, 38 CHECK_TABO-LDDT.
      ENDIF.
ENDLOOP.

SKIP 3.
WRITE :/2 'Position After Update'. ULINE /2(53).
WRITE :/4 'Client' , 11 'Comp.' , 18 'Fin.Yr.' , 27 'Period' , 35 'Data Downloaded upto'. SKIP 1.
LOOP AT CHECK_TAB.
     IF CHECK_TAB-FINYR = ZGJAHR AND CHECK_TAB-MONAT IN ZPERIOD AND
          CHECK_TAB-COMPANY = ZBUKRS.
          WRITE :/5 CHECK_TAB-CLIENT ,11 CHECK_TAB-COMPANY , 19 CHECK_TAB-FINYR,
                       29 CHECK_TAB-MONAT , 38 CHECK_TAB-LDDT.
     ENDIF.
ENDLOOP.

SKIP 3. ULINE.
WRITE :/7 'PLEASE CONFIRM CAREFULLY THE ABOVE DATES ' ,
               /5 'BEFORE RUNNING THE DATA DOWNLOAD PROGRAM FOR CDS.'.

EXPORT CHECK_TAB TO DATABASE INDX(VP) ID 'CDSDATE'.
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 -> ABAP Objects 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.