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

Загрузка/выгрузка транспортых запросов.



 
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> Transport and Upgrade | Транспорт и Обновления
View previous topic :: View next topic  
Author Message
admin
Администратор
Администратор



Joined: 01 Sep 2007
Posts: 1639

PostPosted: Fri Jan 18, 2008 7:50 pm    Post subject: Загрузка/выгрузка транспортых запросов. Reply with quote

Code:

*=====================================================================
* Report  Z_REQUEST "download/upload request"
*=====================================================================
REPORT  z_request                               .

PARAMETERS:
*application server:
* folder data
  p_srvd   LIKE  sapb-sappfad
             DEFAULT 'C:\usr\sap\trans\data'    OBLIGATORY,
* folder cofiles
  p_srvc   LIKE  sapb-sappfad
             DEFAULT 'C:\usr\sap\trans\cofiles' OBLIGATORY,
*presentation server
  p_file   LIKE  sapb-sappfad
             DEFAULT 'C:' OBLIGATORY.

SELECTION-SCREEN SKIP.

*kind
PARAMETERS:
* download
  p_dn RADIOBUTTON GROUP 1 USER-COMMAND btnrad,
* upload
  p_up RADIOBUTTON GROUP 1.

SELECTION-SCREEN SKIP.

PARAMETERS:
  p_req    LIKE e070-trkorr MODIF ID dn,
  p_dreq   LIKE e070-trkorr MODIF ID up,
  p_creq   LIKE e070-trkorr MODIF ID up.


AT SELECTION-SCREEN OUTPUT.
  PERFORM change_visible.

AT SELECTION-SCREEN.
  PERFORM check_oblig.

*========================================================
*start-of-selection
*========================================================
START-OF-SELECTION.

  IF     p_dn = 'X'.
     PERFORM dowload USING p_srvd p_file p_req 'R'.
     PERFORM dowload USING p_srvc p_file p_req 'K'.
  ELSEIF p_up = 'X'.
     PERFORM upload  USING p_srvd p_file p_req  p_dreq.
     PERFORM upload  USING p_srvc p_file p_req  p_creq.
  ENDIF.


*&---------------------------------------------------------------------*
*&      Form  dowload
*&---------------------------------------------------------------------*
FORM dowload  USING    r_srv r_file r_req r_let.
  DATA: l_srv  LIKE sapb-sappfad,
        l_file LIKE sapb-sappfad.

  PERFORM getname:
      USING r_srv  r_req r_let CHANGING  l_srv,
      USING r_file r_req r_let CHANGING  l_file.


  CALL FUNCTION 'ARCHIVFILE_SERVER_TO_CLIENT'
    EXPORTING
      path       = l_srv
      targetpath = l_file
    EXCEPTIONS
      error_file = 1
      OTHERS     = 2.
  IF sy-subrc <> 0.
    WRITE: / text-001, r_srv, l_file.
  ELSE.
    WRITE: / text-002 , l_file.
  ENDIF.

ENDFORM.                    " dowload
*&---------------------------------------------------------------------*
*&      Form  upload
*&---------------------------------------------------------------------*
FORM upload  USING    r_srv r_path r_req  r_file.
DATA: l_srv  LIKE sapb-sappfad,
      l_file like sapb-sappfad.


  concatenate r_srv   '\'  r_file into l_srv.
  concatenate r_path  '\'  r_file into l_file.

  CALL FUNCTION 'ARCHIVFILE_CLIENT_TO_SERVER'
    EXPORTING
      path       = l_file
      targetpath = l_srv
    EXCEPTIONS
      error_file = 1
      OTHERS     = 2.


  IF sy-subrc <> 0.
    WRITE: / text-003, l_srv.
  ELSE.
    WRITE: / text-004, l_srv.
  ENDIF.

ENDFORM.                    " upload
*&---------------------------------------------------------------------*
*&      Form  getname
*&---------------------------------------------------------------------*
FORM getname  USING     r_source  r_req r_let
           CHANGING     r_name.

* D11K900236 --> K900002.D11   r_let = 'K'
* D11K900236 --> R900002.D11   r_let = 'R'

  CONCATENATE r_source '\' r_let r_req+4 '.' r_req(3)  INTO r_name.

ENDFORM.                    " getname


*&---------------------------------------------------------------------*
*&      Form  change_visible
*&---------------------------------------------------------------------*
FORM change_visible .
  LOOP AT SCREEN.

    IF screen-group1  CS 'DN'.
      IF p_dn = 'X'.
        screen-active = 1.
      ELSEIF p_up = 'X'.
        screen-active = 0.
      ENDIF.
      MODIFY SCREEN.
    ELSEIF screen-group1  CS 'UP'.
      IF p_dn = 'X' or (  p_up = space and p_dn =  space ).
        screen-active = 0.
      ELSEIF p_up = 'X' .
        screen-active = 1.
      ENDIF.
      MODIFY SCREEN.
    ENDIF.
  ENDLOOP.
ENDFORM.                    " change_visible
*&---------------------------------------------------------------------*
*&      Form  check_oblig
*&---------------------------------------------------------------------*
FORM check_oblig .
  check sy-ucomm = 'ONLI'.

  IF p_dn = 'X' AND ( p_req IS  INITIAL ) .
     MESSAGE e002(sy) WITH text-005.
  ENDIF.

  IF p_up = 'X' .
     if  p_dreq IS  INITIAL.
         MESSAGE e002(sy) WITH text-006.
     endif.
     if  p_creq is initial.
         MESSAGE e002(sy) WITH text-007.
     endif.
  ENDIF.

ENDFORM.                    " check_oblig
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 -> Transport and Upgrade | Транспорт и Обновления 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.