FORM的上传和下载_RSTXSCRP

report rstxscrp line-size 80 message-id td.
*
* B20K009048 allow to override the default filenames *.STY, *.FOR,
*            *.PRI, *.TXT
* B20K047164 always call corr system for FORM/STYL import
* B20K047847 allow BINARY compressed file format
* B20K053928 allow gui upload/download
* B20K057147 add MASTLANG parameter
* B20K061027 new selection screen
* B20K061842 radioboxes for object selection
* B20K071031 use SAPSCRIPT_ORDER for corr system
*            use SAPMSPAD...  for corr system PRIN
*
data dummy(80).

dummy = 'Objektselektion und Modussteuerung'(005).

selection-screen begin of block par_obj with frame title text-005.
  selection-screen: begin of line, position 1.
    parameters: obj_form radiobutton group obj default 'X'.
    selection-screen: comment 3(30) text-r02.
  selection-screen end of line.
  selection-screen: begin of line, position 1.
    parameters: obj_styl radiobutton group obj.
    selection-screen: comment 3(30) text-r03.
  selection-screen end of line.
  selection-screen: begin of line, position 1.
    parameters: obj_text radiobutton group obj.
    selection-screen: comment 3(30) text-r04.
  selection-screen end of line.
  selection-screen: begin of line,
                    comment 3(10) text-t01.
    parameters: obj_id like stxh-tdid default 'ST'.
  selection-screen end of line.
  selection-screen: begin of line,
                    comment 3(10) text-t02.
    parameters: obj_lang like stxh-tdspras default sy-langu.
  selection-screen end of line.
  selection-screen: begin of line, position 1.
    parameters: obj_prin radiobutton group obj.
    selection-screen: comment 3(30) text-r01.
  selection-screen end of line.
  parameters:
    obj_name(40),
    mode(6) default 'EXPORT'.
selection-screen end of block par_obj.

dummy = 'Steuerparameter f黵 Datei-Operation'(006).

selection-screen begin of block par_fil with frame title text-006.
  selection-screen: begin of line, position 1.
    parameters: localfil radiobutton group fsrc default 'X'.
    selection-screen: comment 3(30) text-r12.
  selection-screen end of line.
  selection-screen: begin of line, position 1.
    parameters: servfil  radiobutton group fsrc.
    selection-screen: comment 3(30) text-r11.
  selection-screen end of line.
parameters:
* servfil  radiobutton group fsrc default 'X',
* localfil radiobutton group fsrc,
* dataset(50) default '/tmp/********&&&&' lower case,
  dataset like rlgrap-filename
          default 'C:\temp\********&&&&',                    "#EC NOTEXT
  binfile as checkbox default space,
  listfile as checkbox default space.
selection-screen end of block par_fil.
dummy = 'Kontrolle 黚er Sprachversionen'(007).
selection-screen begin of block par_lan with frame title text-007.
parameters:
  plangvec(60) default space,
  mastlang as checkbox default space.
selection-screen end of block par_lan.

data:
   textname like stxh-tdname,
   suffix(4),
   file(60),
   correction_check(1),
   object like tadir-object.

condense obj_name no-gaps.
* check OBJECT
if obj_prin = 'X'.
  object = 'PRIN'. suffix = '.PRI'.
elseif obj_form = 'X'.
  object = 'FORM'. suffix = '.FOR'.
elseif obj_styl = 'X'.
  object = 'STYL'. suffix = '.STY'.
elseif obj_text = 'X'.
  object = 'TEXT'. suffix = '.TXT'.
else.
  format color col_negative.
  write: /
    'Fehler, als Objekt ist nur TEXT,STYL,FORM,PRIN m鰃lich'(001).
  exit.
endif.
* check MODE
case mode.
  when 'EXPORT'.
    correction_check = space. "no check when exporting
  when 'IMPORT'.
    if sy-batch <> 'X'.
      correction_check = 'X'. "do check when importing
    else.
      correction_check = space. "no check in batch
    endif.
  when 'IMPOR!'.
    correction_check = space.
    mode = 'IMPORT'.
  when others.
    format color col_negative.
    write: /
      'Fehler, als Modus ist nur EXPORT oder IMPORT m鰃lich'(002).
    exit.
endcase.

* check file source
if sy-batch = 'X'.
  localfil = space.
endif.
* move DATASET into FILE
* if filename is still ********..., replace ******** with obj_name
if dataset cs '********'.
  replace '********' with obj_name(8) into dataset.
  condense dataset no-gaps.
endif.
* if filename is still ....&&&&, replace &&&& with SUFFIX
if dataset cs '&&&&'.
  replace '&&&&' with suffix into dataset.
  condense dataset no-gaps.
endif.
file = dataset.
condense file no-gaps.
* special treatment for object TEXT, the proper format for a TEXT object
* (standard text in this case) is TEXT,<name>,ST,<language>
if object = 'TEXT'.
  if obj_lang is initial.
     obj_lang = sy-langu.
  endif.
  if obj_id is initial.
     obj_id = 'ST'.
  endif.
  concatenate 'TEXT,' obj_name ',' obj_id ',' obj_lang into textname.
* no correction check for TEXT
  perform rstxscrp(rstxr3tr) using object textname mode file listfile
                                   plangvec binfile localfil mastlang.
else.
* correction check
  if correction_check <> space.
    perform correction_ask_update using object obj_name.
    check sy-subrc = 0.
  endif.
  perform rstxscrp(rstxr3tr) using object obj_name mode file listfile
                                   plangvec binfile localfil mastlang.
endif.

* ask correction system to change printer/form/style
* SY-SUBRC: 0 o.k.
*           1 not o.k.
form correction_ask_update using value(object) value(name).
tables: e071, tadir, dderr.
statics: objname(16),
         form like thead-tdform,
         style like thead-tdstyle,
         printer like tsp0a-patype.

objname = name.
clear tadir.
case object.
  when 'TEXT'.
    sy-subrc = 0. exit.
  when 'FORM'.
    form = name.
    call function 'SAPSCRIPT_ORDER_CHECK'
         exporting
              objecttype           = 'FORM'
              form                 = form
         importing
              order                = e071-trkorr
              value_tadir          = tadir
         exceptions
              invalid_input        = 1
              object_locked        = 2
              object_not_available = 3.
    if sy-subrc <> 0.
*     display message
      format color col_negative.
      write: / 'Das Objekt darf nicht 黚erschrieben werden'(003).
      sy-subrc = 1.
      exit.
    endif.
    call function 'SAPSCRIPT_ORDER_INSERT'
         exporting
              objecttype     = 'FORM'
              form           = form
              masterlang     = tadir-masterlang              "B20K8A08SO
         importing
              value_tadir    = tadir
         changing
              order          = e071-trkorr
         exceptions
              invalid_input  = 1
              order_canceled = 2.
    if sy-subrc <> 0.
      format color col_negative.
      write: / 'Das Objekt darf nicht 黚erschrieben werden'(003).
      sy-subrc = 1.
      exit.
    endif.
  when 'STYL'.
    style = name.
    call function 'SAPSCRIPT_ORDER_CHECK'
         exporting
              objecttype           = 'STYL'
              style                = style
         importing
              order                = e071-trkorr
              value_tadir          = tadir
         exceptions
              invalid_input        = 1
              object_locked        = 2
              object_not_available = 3.
    if sy-subrc <> 0.
*     display message
      format color col_negative.
      write: / 'Das Objekt darf nicht 黚erschrieben werden'(003).
      sy-subrc = 1.
      exit.
    endif.
    call function 'SAPSCRIPT_ORDER_INSERT'
         exporting
              objecttype     = 'STYL'
              style          = style
              masterlang     = tadir-masterlang              "B20K8A08SO
         importing
              value_tadir    = tadir
         changing
              order          = e071-trkorr
         exceptions
              invalid_input  = 1
              order_canceled = 2.
    if sy-subrc <> 0.
      format color col_negative.
      write: / 'Das Objekt darf nicht 黚erschrieben werden'(003).
      sy-subrc = 1.
      exit.
    endif.
  when 'PRIN'.
    printer = name(8).
    perform tr_object_check(sapmspad) using 'PRIN' printer.
    if sy-subrc <> 0.
      format color col_negative.
      write: / 'Das Objekt darf nicht 黚erschrieben werden'(003).
      sy-subrc = 1.
      exit.
    endif.
    perform tr_object_insert(sapmspad) using 'PRIN' printer.
    if sy-subrc <> 0.
      format color col_negative.
      write: / 'Das Objekt darf nicht 黚erschrieben werden'(003).
      sy-subrc = 1.
      exit.
    endif.
  when others.
    sy-subrc = 1. exit.
endcase.
endform.

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值