3
7/16/2019 sapnote_0001661045 http://slidepdf.com/reader/full/sapnote0001661045 1/3 08-17-2012 Page 1 of 3 SAP Note 1661045 - Program to generate location product hierarchy  Note Language: English Version: 2 Validity: Valid Since 02-03-2012 Summary Symptom If procedure from OSS note 432038 applied then missing product/location combinations are automatically created during the CIF transfer of customer consignment stock. Location product hierarchy is not re-generated automatically. This note delivers report ZZ_GEN_HIER to let customer re-generate the selected hierarchy. Use this report either in foreground or as a batch program. Other terms CIF, generated location product hierarchy, /SAPAPO/RELHSHOW, aggregated planning, ZZ_GEN_HIER, /SAPAPO/RELGH_GENERATE Reason and Prerequisites Location product hierarchy is not re-generated automatically when location and or product is CIF-ed. Solution See correction instructions for the source code of report ZZ_GEN_HIER. ------------------------------------------------------------------------ |Manual Pre-Impleme nt. | ------------------------------------------------------------------------ |VALID FOR | |Software Component SCM_BASIS Supply Chain Ma...| | Release 500 All Support Package Levels | | Release 510 All Support Package Levels | | Release 701 All Support Package Levels | | Release 700 All Support Package Levels | | Release 702 All Support Package Levels | | Release 703 All Support Package Levels | ------------------------------------------------------------------------ Create report ZZ_GEN_HIER in transaction SE38. Source code is as follows: *&-------------------------------------------------------------* *& Report ZZ_GEN_HIER *& *&-------------------------------------------------------------* *& For generated location product hierarchies sometimes *& the generation is necessary. *& It is possible that the location hierarchy part is ready, *& also the product hierarchy part is ready but still the *& the generation must be carried out. *& This report will do the generation for generated hierarchies. *&-------------------------------------------------------------* REPORT zz_gen_hier.

sapnote_0001661045

Embed Size (px)

DESCRIPTION

sapnote_0001661045

Citation preview

Page 1: sapnote_0001661045

7/16/2019 sapnote_0001661045

http://slidepdf.com/reader/full/sapnote0001661045 1/3

08-17-2012 Page 1 of 3

SAP Note 1661045 - Program to generate location producthierarchy

 Note Language: English Version: 2 Validity: Valid Since 02-03-2012

Summary

Symptom 

If procedure from OSS note 432038 applied then missing product/location

combinations are automatically created during the CIF transfer of customer

consignment stock. Location product hierarchy is not re-generated

automatically.

This note delivers report ZZ_GEN_HIER to let customer re-generate the

selected hierarchy. Use this report either in foreground or as a batch

program.

Other terms

CIF, generated location product hierarchy, /SAPAPO/RELHSHOW, aggregated

planning, ZZ_GEN_HIER, /SAPAPO/RELGH_GENERATE

Reason and Prerequisites

Location product hierarchy is not re-generated automatically when location

and or product is CIF-ed.

Solution

See correction instructions for the source code of report ZZ_GEN_HIER.

------------------------------------------------------------------------

|Manual Pre-Implement. |------------------------------------------------------------------------

|VALID FOR |

|Software Component SCM_BASIS Supply Chain Ma...|

| Release 500 All Support Package Levels |

| Release 510 All Support Package Levels |

| Release 701 All Support Package Levels |

| Release 700 All Support Package Levels |

| Release 702 All Support Package Levels |

| Release 703 All Support Package Levels |

------------------------------------------------------------------------

Create report ZZ_GEN_HIER in transaction SE38. Source code is as follows:

*&-------------------------------------------------------------*

*& Report ZZ_GEN_HIER

*&

*&-------------------------------------------------------------*

*& For generated location product hierarchies sometimes

*& the generation is necessary.

*& It is possible that the location hierarchy part is ready,

*& also the product hierarchy part is ready but still the

*& the generation must be carried out.

*& This report will do the generation for generated hierarchies.

*&-------------------------------------------------------------*

REPORT zz_gen_hier.

Page 2: sapnote_0001661045

7/16/2019 sapnote_0001661045

http://slidepdf.com/reader/full/sapnote0001661045 2/3

08-17-2012 Page 2 of 3

SAP Note 1661045 - Program to generate location producthierarchy

TABLES:

/sapapo/relh_io.

DATA:

lv_relid TYPE /sapapo/relid.

PARAMETERS:

p_hier LIKE /sapapo/relh_io-relname OBLIGATORY.

INITIALIZATION.

/sapapo/relh_io-reltype = '02'.

START-OF-SELECTION.

CALL FUNCTION '/SAPAPO/REL_GET_RID_BY_RNAME'

EXPORTING

iv_relname = p_hier

IMPORTING

ev_relid = lv_relidEXCEPTIONS

not_qualified = 1

relname_not_found = 2

OTHERS = 3.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

*--------------------------------------------------------------*

* make sure the hierarchy is a generated hierarchy

*--------------------------------------------------------------*

SELECT relname

FROM /sapapo/reldstr AS a

JOIN /sapapo/relsdir AS b

ON a~relstrid = b~relstrid

INTO CORRESPONDING FIELDS OF /sapapo/relh_io

UP TO 1 ROWS

WHERE relname = p_hier

AND reltcode = ' '

AND reltype = '02'.

ENDSELECT.

IF sy-subrc <> 0.

MESSAGE e021(/sapapo/oo_rel).

ENDIF.

CALL FUNCTION '/SAPAPO/RELGH_SET_MODIFIED'

EXPORTING

iv_relid = lv_relid

iv_reltype = '02'

iv_modified = 'X'

EXCEPTIONS

not_qualified = 1

OTHERS = 2.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.ENDIF.

Page 3: sapnote_0001661045

7/16/2019 sapnote_0001661045

http://slidepdf.com/reader/full/sapnote0001661045 3/3

08-17-2012 Page 3 of 3

SAP Note 1661045 - Program to generate location producthierarchy

COMMIT WORK AND WAIT.

CALL FUNCTION '/SAPAPO/RELGH_GENERATE'

EXPORTING

iv_ghid = lv_relid

iv_check_modified = 'X'

EXCEPTIONS

not_qualified = 1

relid_not_found = 2

relstrid_not_found = 3

wrong_hierarchy_type = 4

link_table_not_specified = 5

OTHERS = 6.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ELSE.

MESSAGE s398(00) WITH 'Hierarchy'(001)

p_hier'generated successfully'(002).

COMMIT WORK.

ENDIF.

Header Data

Release Status: Released for Customer

Released on: 02-03-2012 12:48:35

Master Language: English

Priority: Recommendations/additional info

Category: ConsultingPrimary Component: SCM-APO-MD-HI Hierarchy

Secondary Components:

SCM-APO-INT-MD-PR Product

 Valid Releases

Software Component Release From  

Release

To

Release

and 

Subsequent

SCM_BASIS 500 500 500

SCM_BASIS 510 510 510

SCM_BASIS 700 700 700

SCM_BASIS 701 701 701

SCM_BASIS 702 702 702

SCM_BASIS 703 703 703