Skip to Content
author's profile photo Former Member
Former Member

End Routine Implementation Issue

Hi Colleagues,

I want to implemente an end routine in order to populate the material type from the material master data.

The source structure of my transformation contain the material.

The target structure of my transformation contain the material and material type infoobject.

I have implemented the following source code in the end routine based on the sdn doc below :

http://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/e73bfc19-0e01-0010-23bc-ef0ad53f2fab

My source code is :

***************************************************

  • Global data declaration

***************************************************

  • List of all Employees and corresponding sales organisation

DATA: BEGIN OF I_S_MATERIAL_TYPE,

MATERIAL TYPE /BI0/PMATERIAL-MATERIAL,

MATERIAL_TYPE TYPE /BI0/PMATERIAL-MATL_TYPE,

END OF I_S_MATERIAL_TYPE.

DATA: i_t_material_type like table of I_S_material_type.

METHOD end_routine.

*=== Segments ===

FIELD-SYMBOLS:

<RESULT_FIELDS> TYPE tys_TG_1.

DATA:

MONITOR_REC TYPE rstmonitor.

$$ begin of routine - insert your code only below this line -

***************************************************

  • local data declaration

***************************************************

data: e_s_result type tys_TG_1.

data: e_t_result type tyt_TG_1.

data: material_type like e_s_result-matl_type.

***************************************************

  • read master data in local table once

***************************************************

SELECT MATERIAL MATL_TYPE FROM /BI0/PMATERIAL

into corresponding fields of table i_t_material_type

WHERE MATERIAL = <RESULT_FIELDS>-material

AND objvers = 'A'.

***************************************************

  • Do the calculation and add the new rows

***************************************************

*>>

  • loop over the input result data package

loop at RESULT_PACKAGE into e_s_result.

  • get Counter

read table i_t_material_type into e_t_result with key

material = e_s_result-material.

move material_type to e_s_result-matl_type.

append e_s_result to e_t_result.

endloop.

  • add the lines to the output package

refresh RESULT_PACKAGE.

move e_t_result[] to RESULT_PACKAGE[].

$$ end of routine - insert your code only before this line -

ENDMETHOD. "end_routine

$$ end of routine - insert your code only before this line -

ENDMETHOD. "end_routine

I have the following error message :

E:"E_T_RESULT" cannot e converted to the line type of

"ME->I_T_MATERIAL_TYPE"

Question :

Can someone explain me what is the issue in my source code ?

Cheers,

Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Sep 08, 2010 at 07:21 PM

    Hi,

    I see that you are using corresponding fields in your select statement. /bi0/pmaterial has matl_type, but your structure L_S_MATERIAL_TYPE has Material_type. so select statment will not store values of Matl_type. Use matl_type in l_s_material_type too.

    Secondly you are moving a table into another table by using,

    move e_t_result] to RESULT_PACKAGE[.

    Try this instead,

    loop at RESULT_PACKAGE assigning <RESULT_FIELDS>-

    read table i_t_material_type with key

    material = e_s_result-material.

    <RESULT_FIELDS>-matl_type = i_t_material_type-matl_type

    Modify result_pacakage from <result_fields>

    endloop.

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      To everybody who provide me advise ! thanks a lot for your time ! I get it now !!!!

      ***************************************************

      • local data declaration

      ***************************************************

      data: e_s_result type tys_TG_1.

      data: e_t_result type tyt_TG_1.

      data: matl_type like e_s_result-matl_type.

      ***************************************************

      • read master data in local table once

      ***************************************************

      SELECT MATERIAL MATL_TYPE FROM /BI0/PMATERIAL

      into corresponding fields of table i_t_matl_type

      WHERE MATERIAL = <RESULT_FIELDS>-material

      AND objvers = 'A'.

      ***************************************************

      • Do the calculation and add the new rows

      ***************************************************

      *>>

      • loop over the input result data package

      loop at RESULT_PACKAGE assigning <result_fields>.

      • into e_s_result.

      read table i_t_matl_type into wa_matl_type

      with key

      material = e_s_result-material.

      <RESULT_FIELDS>-matl_type = wa_matl_type-matl_type.

      Modify RESULT_PACKAGE from <result_fields>.

      • move matl_type to e_s_result-matl_type.

      • append e_s_result to e_t_result.

      endloop.

  • Posted on Sep 09, 2010 at 12:57 AM

    Hi

    if you know as you mention :

    "The source structure of my transformation contain the material.

    The target structure of my transformation contain the material and material type infoobject."

    Why don't you just use standard derivation in the transformation is does exactly the same as a select statement.

    In the transformation position your self in the field material type create a rule add the source field material on the right select infoobject 0material and it is done.

    Forget the end or start routine go for unit rule your treatment is not that heavy. What is the advantage ? Or Do you have several matltype for an article (normally this is not the case if loaded from SAP ECC)

    Otherwise a simple way to get the material type with abap in the unit rule is :

    declare the field material type then do a simple select statement:

    data : wa_matltype type /bi0/matltype (check definition on the infoobject)

    select matltype from /bi0/pmaterial into wa_matltype where material = material. (look at how it is declared)

    result = wa_matltype.

    done, good luck

    Boujema

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.