将 PRPS POSID 转换为来自 SAP 的格式化 WBS 元素
Convert PRPS POSID to formatted WBS Element out of SAP
我正在寻找一种方法,将 POSID
列从 PRPS
table 转换为格式化的 WBS 元素,如 SAP show us without SAP functions。
我找到了 TCJED
table 来获取掩码,我看到了一个 ABAP 函数来进行转换,但我不喜欢 table 使用 ABAP。
有人知道如何使用 TCJED table 的面具吗?
有时 POSID 末尾有一些 0
但它们不会出现在格式化的 WBS 元素中。
我想在 Java 或 SQL 中执行此操作。
[1 年零 1 个月后编辑:)]
我找到了解决方案,这里是 PL/SQL 代码:
掩码来自 tcjed table。
elementtoconvert 是原始 WBS 或原始项目。
if (trim(mask) = '' or mask is null or trim(elementtoconvert) ='' or elementtoconvert is null) then
return elementToConvert;
end if;
select substring(elementToConvert, 1, currentPos) into wbs_Element_formated;
select currentPos + 1 into currentPos;
select string_to_array(substring(mask, 2, length(mask)-1),'-') into parts;
for i in 1 .. array_upper(parts,1) loop
select parts[i] like 'X%' into isXGroup;
if (currentPos > length(elementToConvert)) then
exit;
end if;
select currentPos + length(parts[i]) into endIndex;
if (endIndex > length(elementToConvert)) then
select regexp_replace(substring(elementToConvert, currentPos), E'\s+', '') into groupValue;
else
select regexp_replace(substring(elementToConvert, currentPos, length(parts[i])), E'\s+', '') into groupValue;
end if;
if (isXGroup and length(parts[i]) > length(groupValue)) then
select groupValue || Repeat(' ', length(parts[i]) - length(groupValue)) into groupValue;
end if;
select currentPos + length(parts[i]) into currentPos;
if isXGroup = false then
if trim(groupValue) = '' then
continue;
end if;
if (groupValue ~* ('0{' || length(parts[i]) ||'}')) then
if(parts[array_upper(parts,1) -1] = parts[i]) then
exit;
end if;
select trim(substring(elementToConvert, currentPos)) into nextChars;
if(nextChars = '' or nextChars ~* ('0{' || length(parts[i]) ||'}')) then
exit;
end if;
end if;
end if;
select wbs_Element_formated || '-' || groupValue into wbs_Element_formated;
end loop;
loop
Exit when regexp_replace(wbs_Element_formated, E'\s+$', '') not like '%-';
select substring(wbs_Element_formated,1, length(wbs_Element_formated)-1) into wbs_Element_formated;
end loop;
return trim(trailing ' ' from wbs_Element_formated);
你可以拨打FMCONVERSION_EXIT_ABPSP_INPUT。此FM将POSID的内部格式转换为Dynpros中看到的外部格式。
有节目REPS_PSEXT_ID_CONV
"Convert Internal ID to External ID for Project and WBS Element"
将在 SE38 执行后将 PRPS/PROJ 外部定义存储在 table PSEXT_ID_CONV 字段 EXT_ID_CONV.
中
此程序用于 HANA 上的企业搜索。
在同一个包中,我们找到了 BADI WORKBREAKDOWN_UPDATE 和 PROJECTDEF_UPDATE,其中可以应用与 REPS_PSEXT_ID_CONV 类似的逻辑,并在 table [=32] 中提交时完成更新插入=].
要实现 BADI,还请查看 OSS 2915621 - BADi WORKBREAKDOWN_UPDATE AT_SAVE 未调用。
在 PS 配置 (tcode /nspro) 中我们发现 badi 也可用/
希望对您有所帮助,
干杯,
我找到了解决方案,这里是 PL/SQL 代码:
掩码来自 tcjed table。
elementtoconvert 是原始 WBS 或原始项目。
if (trim(mask) = '' or mask is null or trim(elementtoconvert) ='' or elementtoconvert is null) then
return elementToConvert;
end if;
select substring(elementToConvert, 1, currentPos) into wbs_Element_formated;
select currentPos + 1 into currentPos;
select string_to_array(substring(mask, 2, length(mask)-1),'-') into parts;
for i in 1 .. array_upper(parts,1) loop
select parts[i] like 'X%' into isXGroup;
if (currentPos > length(elementToConvert)) then
exit;
end if;
select currentPos + length(parts[i]) into endIndex;
if (endIndex > length(elementToConvert)) then
select regexp_replace(substring(elementToConvert, currentPos), E'\s+', '') into groupValue;
else
select regexp_replace(substring(elementToConvert, currentPos, length(parts[i])), E'\s+', '') into groupValue;
end if;
if (isXGroup and length(parts[i]) > length(groupValue)) then
select groupValue || Repeat(' ', length(parts[i]) - length(groupValue)) into groupValue;
end if;
select currentPos + length(parts[i]) into currentPos;
if isXGroup = false then
if trim(groupValue) = '' then
continue;
end if;
if (groupValue ~* ('0{' || length(parts[i]) ||'}')) then
if(parts[array_upper(parts,1) -1] = parts[i]) then
exit;
end if;
select trim(substring(elementToConvert, currentPos)) into nextChars;
if(nextChars = '' or nextChars ~* ('0{' || length(parts[i]) ||'}')) then
exit;
end if;
end if;
end if;
select wbs_Element_formated || '-' || groupValue into wbs_Element_formated;
end loop;
loop
Exit when regexp_replace(wbs_Element_formated, E'\s+$', '') not like '%-';
select substring(wbs_Element_formated,1, length(wbs_Element_formated)-1) into wbs_Element_formated;
end loop;
return trim(trailing ' ' from wbs_Element_formated);
我正在寻找一种方法,将 POSID
列从 PRPS
table 转换为格式化的 WBS 元素,如 SAP show us without SAP functions。
我找到了 TCJED
table 来获取掩码,我看到了一个 ABAP 函数来进行转换,但我不喜欢 table 使用 ABAP。
有人知道如何使用 TCJED table 的面具吗?
有时 POSID 末尾有一些 0
但它们不会出现在格式化的 WBS 元素中。
我想在 Java 或 SQL 中执行此操作。
[1 年零 1 个月后编辑:)]
我找到了解决方案,这里是 PL/SQL 代码:
掩码来自 tcjed table。 elementtoconvert 是原始 WBS 或原始项目。
if (trim(mask) = '' or mask is null or trim(elementtoconvert) ='' or elementtoconvert is null) then
return elementToConvert;
end if;
select substring(elementToConvert, 1, currentPos) into wbs_Element_formated;
select currentPos + 1 into currentPos;
select string_to_array(substring(mask, 2, length(mask)-1),'-') into parts;
for i in 1 .. array_upper(parts,1) loop
select parts[i] like 'X%' into isXGroup;
if (currentPos > length(elementToConvert)) then
exit;
end if;
select currentPos + length(parts[i]) into endIndex;
if (endIndex > length(elementToConvert)) then
select regexp_replace(substring(elementToConvert, currentPos), E'\s+', '') into groupValue;
else
select regexp_replace(substring(elementToConvert, currentPos, length(parts[i])), E'\s+', '') into groupValue;
end if;
if (isXGroup and length(parts[i]) > length(groupValue)) then
select groupValue || Repeat(' ', length(parts[i]) - length(groupValue)) into groupValue;
end if;
select currentPos + length(parts[i]) into currentPos;
if isXGroup = false then
if trim(groupValue) = '' then
continue;
end if;
if (groupValue ~* ('0{' || length(parts[i]) ||'}')) then
if(parts[array_upper(parts,1) -1] = parts[i]) then
exit;
end if;
select trim(substring(elementToConvert, currentPos)) into nextChars;
if(nextChars = '' or nextChars ~* ('0{' || length(parts[i]) ||'}')) then
exit;
end if;
end if;
end if;
select wbs_Element_formated || '-' || groupValue into wbs_Element_formated;
end loop;
loop
Exit when regexp_replace(wbs_Element_formated, E'\s+$', '') not like '%-';
select substring(wbs_Element_formated,1, length(wbs_Element_formated)-1) into wbs_Element_formated;
end loop;
return trim(trailing ' ' from wbs_Element_formated);
你可以拨打FMCONVERSION_EXIT_ABPSP_INPUT。此FM将POSID的内部格式转换为Dynpros中看到的外部格式。
有节目REPS_PSEXT_ID_CONV "Convert Internal ID to External ID for Project and WBS Element"
将在 SE38 执行后将 PRPS/PROJ 外部定义存储在 table PSEXT_ID_CONV 字段 EXT_ID_CONV.
中此程序用于 HANA 上的企业搜索。
在同一个包中,我们找到了 BADI WORKBREAKDOWN_UPDATE 和 PROJECTDEF_UPDATE,其中可以应用与 REPS_PSEXT_ID_CONV 类似的逻辑,并在 table [=32] 中提交时完成更新插入=].
要实现 BADI,还请查看 OSS 2915621 - BADi WORKBREAKDOWN_UPDATE AT_SAVE 未调用。
在 PS 配置 (tcode /nspro) 中我们发现 badi 也可用/
希望对您有所帮助,
干杯,
我找到了解决方案,这里是 PL/SQL 代码:
掩码来自 tcjed table。 elementtoconvert 是原始 WBS 或原始项目。
if (trim(mask) = '' or mask is null or trim(elementtoconvert) ='' or elementtoconvert is null) then
return elementToConvert;
end if;
select substring(elementToConvert, 1, currentPos) into wbs_Element_formated;
select currentPos + 1 into currentPos;
select string_to_array(substring(mask, 2, length(mask)-1),'-') into parts;
for i in 1 .. array_upper(parts,1) loop
select parts[i] like 'X%' into isXGroup;
if (currentPos > length(elementToConvert)) then
exit;
end if;
select currentPos + length(parts[i]) into endIndex;
if (endIndex > length(elementToConvert)) then
select regexp_replace(substring(elementToConvert, currentPos), E'\s+', '') into groupValue;
else
select regexp_replace(substring(elementToConvert, currentPos, length(parts[i])), E'\s+', '') into groupValue;
end if;
if (isXGroup and length(parts[i]) > length(groupValue)) then
select groupValue || Repeat(' ', length(parts[i]) - length(groupValue)) into groupValue;
end if;
select currentPos + length(parts[i]) into currentPos;
if isXGroup = false then
if trim(groupValue) = '' then
continue;
end if;
if (groupValue ~* ('0{' || length(parts[i]) ||'}')) then
if(parts[array_upper(parts,1) -1] = parts[i]) then
exit;
end if;
select trim(substring(elementToConvert, currentPos)) into nextChars;
if(nextChars = '' or nextChars ~* ('0{' || length(parts[i]) ||'}')) then
exit;
end if;
end if;
end if;
select wbs_Element_formated || '-' || groupValue into wbs_Element_formated;
end loop;
loop
Exit when regexp_replace(wbs_Element_formated, E'\s+$', '') not like '%-';
select substring(wbs_Element_formated,1, length(wbs_Element_formated)-1) into wbs_Element_formated;
end loop;
return trim(trailing ' ' from wbs_Element_formated);