среда, 2 сентября 2015 г.

Как загрузить\выгрузить программу\ФМ\класс из системы (SAPLink)

Очень интересный способ переноса разработок между системами.

Как всегда, на всякий случай дублирую:

Skip to end of metadata
Go to start of metadata

Install

Known ABAP basis versions compatible with SAPlink include:
  • 6.20
  • 6.40(NetWeaver 2004)
  • 7.0 (NetWeaver 2004s)
  • 7.4

Initial

  1. Download the latest version of the SAPlink installer zip file from the SAPlink Project page which contains the following files:
    • SAPlink_installer.txt - hopefully the last program you will ever have to copy and paste
    • NUGG_SAPLINK.nugg - nugget containing necessary objects to install
  2. Extract contents of the SAPlink installer zip file
  3. Copy, paste, save, and activate the contents of the SAPlink_installer.txt file into a new program ZSAPLINK_INSTALLER onto the target SAP system
  4. Execute newly activated program ZSAPLINK_INSTALLER
  5. Use the extracted file NUGG_SAPLINK_INSTALL.nugg for the selection parameter "Installation Nugget"
    WARNING: Using checkbox "Overwrite Originals", will overwrite any existing version of the SAPlink objects that were previously installed onto the system.  Only use when reinstalling or installing a major release where a brand new install is required. Otherwise, follow the normal procedures for upgrade below.
  6. Execute
  7. To avoid an error that the implementation of an abstract class does not exist please run the installation a second time.
  8. Newly installed objects need to be activated manually, as all objects are installed as local and inactive
    1. Run transaction code SE38
    2. On initial screen of SE38, enter program name ZSAPLINK into selection parameter "Program" and hit activate command to show worklist
    3. On worklist screen, select "Whole Worklist" button on bottom to show all inactive objects in your worklist IMPORTANT NOTE: You must click the button labeled "Whole Worklist" to show and select all SAPlink related objects. There are multiple objects that are imported during the initial install and must all be activated for SAPlink to run properly
    4. Select all newly installed SAPlink related objects (ZSAPLINK) and activate
    5. Once activation for all objects is complete, SAPlink can be executed via program ZSAPLINK

среда, 26 августа 2015 г.

Добавить пользовательскую формулу в редактор формул в трансформациях

Взято отсюда, но на всякий случай, продублирую:

4. Step-By-Step Procedure

The guide starts you off by creating a BAdi implementation. This implementation will generate a class which we will use to store our custom functions (implemented as methods) in. When the custom methods are written and activated, we can then reference them in our BAdi implementation. Once linked, we will have them available in the Process Type 'Decision' in Process chain maintenance.

 For this example, we will use TVARVC table entry which will decide what process flow/steps executed in Process chain.

среда, 12 августа 2015 г.

среда, 22 июля 2015 г.

XML-парсер

Пришла задача загружать данные из внешней системы, которая отдаёт XML файл.
В одном файле приходят сразу всё таблицы.

В BW есть встроенный инструмент, "Редактор трансформаций", транзакция STRANS, с ним и будем работать.

https://www.dropbox.com/s/oa1r6bc0xmffo0a/PROG%20%28XML%20from%20WEB-server%29.docx?dl=0

После переноса цепочки, появляются "Неизвестные задания"

Вылечили такой программой:
report z_jobs_wo_variant.

data:
  lt_jobs type table of tbtcp,
  lt_valtab type table of rsparams.

field-symbols:
  <lfs_job> like line of lt_jobs.

parameters: p_delete type abap_bool.

select
    j~progname
    , j~variant
    , j~jobcount
    , j~jobname
from tbtcp as j
  join tbtco as js
    on j~jobname = js~jobname
      and j~jobcount = js~jobcount
      and js~status = 'S'
  into corresponding fields of table @lt_jobs
where progname = 'RSPROCESS'.

loop at lt_jobs
  assigning <lfs_job>.

  call function 'RS_VARIANT_CONTENTS'
    exporting
      report = <lfs_job>-progname
      variant = <lfs_job>-variant
      execute_direct = 'X'
    tables
      valutab = lt_valtab
    exceptions
      others = 1.

  if sy-subrc <> 0.
    write: / <lfs_job>-jobname, <lfs_job>-jobcount.

    if p_delete = abap_true.
      call function 'BP_JOB_DELETE'
        exporting
          jobcount = <lfs_job>-jobcount
          jobname  = <lfs_job>-jobname
        exceptions
          others   = 1.

      if sy-subrc <> 0.
        write 'not deleted'.
      else.
        write 'successfully deleted'.
      endif.
    endif.
  endif.

endloop.

NW 7.4 не работал стек ошибок DTP

Одна из переменных (Error_stack) не заполнялась, помогла нота  2037459

пятница, 3 июля 2015 г.

Если большая таблица партицирована

Если большая таблица партицирована.
Партиции закрыты для записи, только чтение.

Поэтому: 1) Табл.спейс надо открывать
2) При добавлении признака SAP заполняет его пробелом, это доло.





----  Открываем партиции активной таблицы DSO для изменения
alter tablespace WAY_OSTATKI_2008 read write;
alter tablespace WAY_OSTATKI_2009 read write;
alter tablespace WAY_OSTATKI_2010 read write;
alter tablespace WAY_OSTATKI_2011 read write;
alter tablespace WAY_OSTATKI_2012 read write;
alter tablespace WAY_OSTATKI_2013 read write;
alter tablespace WAY_OSTATKI_2014 read write;
alter tablespace WAY_OSTATKI_2015 read write;
alter tablespace WAY_OSTATKI_2016 read write;
alter tablespace WAY_OSTATKI_2017 read write;
alter tablespace WAY_OSTATKI_2018 read write;
alter tablespace WAY_OSTATKI_2019 read write;

---- Создаем копию активной таблицы и переносим индексы на новую таблицу
ALTER TABLE SAPSR3."/BIC/ANORSTWAY00"   RENAME TO "/BIC/ANORSTWAY00_SAV";

ALTER INDEX SAPSR3."/BIC/ANORSTWAY00~0" RENAME TO "/BIC/ANORSTWAY00~0_";
ALTER INDEX SAPSR3."/BIC/ANORSTWAY0001" RENAME TO "/BIC/ANORSTWAY0001_";
ALTER INDEX SAPSR3."/BIC/ANORSTWAY0002" RENAME TO "/BIC/ANORSTWAY0002_";
ALTER INDEX SAPSR3."/BIC/ANORSTWAY0003" RENAME TO "/BIC/ANORSTWAY0003_";


---- Запускаем транспорт в системе KH2

---- Добавляем поле NCPASOO во временную таблицу
ALTER TABLE SAPSR3."/BIC/ANORSTWAY00_SAV" ADD "/BIC/NCNETTUR" VARCHAR2(9) NULL ;
ALTER TABLE SAPSR3."/BIC/ANORSTWAY00_SAV" MODIFY ("/BIC/NCNETTUR" DEFAULT ' ' );

---- Добавляем поле NCPASOO во временную таблицу
ALTER TABLE SAPSR3."/BIC/ANORSTWAY00_SAV" ADD "/BIC/NCSIMV102" VARCHAR2(75) NULL ;
ALTER TABLE SAPSR3."/BIC/ANORSTWAY00_SAV" MODIFY ("/BIC/NCSIMV102" DEFAULT ' ' );

---- Добавляем поле NCPASOO во временную таблицу
ALTER TABLE SAPSR3."/BIC/ANORSTWAY00_SAV" ADD "/BIC/NCREPAYM" VARCHAR2(18) NULL ;
ALTER TABLE SAPSR3."/BIC/ANORSTWAY00_SAV" MODIFY ("/BIC/NCREPAYM" DEFAULT ' ' );

---- Добавляем поле NCPASOO во временную таблицу
ALTER TABLE SAPSR3."/BIC/ANORSTWAY00_SAV" ADD "/BIC/NCDEDT" VARCHAR2(18) NULL ;
ALTER TABLE SAPSR3."/BIC/ANORSTWAY00_SAV" MODIFY ("/BIC/NCDEDT" DEFAULT ' ' );


---- Удаляем активную таблицу DSO
drop table SAPSR3."/BIC/ANORSTWAY00";

---- Переименовывем временную таблицу в активную таблицу DSO + индексы
ALTER TABLE SAPSR3."/BIC/ANORSTWAY00_SAV" RENAME TO "/BIC/ANORSTWAY00";

ALTER INDEX SAPSR3."/BIC/ANORSTWAY0001_"  RENAME TO "/BIC/ANORSTWAY0001";
ALTER INDEX SAPSR3."/BIC/ANORSTWAY0002_"  RENAME TO "/BIC/ANORSTWAY0002";
ALTER INDEX SAPSR3."/BIC/ANORSTWAY0003_"  RENAME TO "/BIC/ANORSTWAY0003";
ALTER INDEX SAPSR3."/BIC/ANORSTWAY00~0_"  RENAME TO "/BIC/ANORSTWAY00~0";

---- Копируем данные в активную таблицу DSO
select * from SAPSR3."/BIC/ANORSTWAY00";



---- Закрываем партиции активной таблицы DSO на изменение
alter tablespace WAY_OSTATKI_2008 read only;
alter tablespace WAY_OSTATKI_2009 read only;
alter tablespace WAY_OSTATKI_2010 read only;
alter tablespace WAY_OSTATKI_2011 read only;
alter tablespace WAY_OSTATKI_2012 read only;
alter tablespace WAY_OSTATKI_2013 read only;
alter tablespace WAY_OSTATKI_2014 read only;
alter tablespace WAY_OSTATKI_2015 read only;
alter tablespace WAY_OSTATKI_2016 read only;
alter tablespace WAY_OSTATKI_2017 read only;
alter tablespace WAY_OSTATKI_2018 read only;

alter tablespace WAY_OSTATKI_2019 read only;