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

SEM-BPS: Characteristic Relationships Combination proposal

Hi,

this is very urgent. I need an example (code) of function module in order to create a combination proposal.

I have 3 characteristics and I don't need to plan all the combinations, I need to create the combinations stored in a table, these are the combinations needed to be planned. I writo a function module based in the on-line help but I think I'm coding it wrong.

Any help will be highly appreciated.

Add a comment
10|10000 characters needed characters exceeded

Related questions

4 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Aug 27, 2004 at 09:24 AM

    Hi,

    Your function module must have interface like this:

    ""Local interface:

    *" IMPORTING

    *" REFERENCE(I_AREA) TYPE UPC_Y_AREA

    *" REFERENCE(ITO_CHA) TYPE UPC_YTO_CHA

    *" REFERENCE(ITO_CHASEL) TYPE UPC_YTO_CHASEL

    *" EXPORTING

    *" REFERENCE(ETH_CHAS) TYPE HASHED TABLE

    *" EXCEPTIONS

    *" FAILED

    One way to get the correct format of your record is:

    DATA:

    plnarea_attr TYPE REF TO cl_sem_planarea_attributes,

    str_data TYPE REF TO data.

    FIELD-SYMBOLS:

    <line> TYPE ANY.

    plnarea_attr = cl_sem_planarea_attributes=>get_instance( i_area ).

    CREATE DATA str_data TYPE (plnarea_attr->typename_s_chas).

    ASSIGN str_data->* TO <line>.

    ( I think you can also do it like:

    CREATE DATA str_data LIKE LINE OF eth_chas.

    ASSIGN str_data->* TO <line>. )

    Then point field symbol(s) to the characteristic(s):

    FIELD-SYMBOLS:

    <comp_code> TYPE ANY. "(for instance Company Code)

    ASSIGN COMPONENT '0COMP_CODE' OF STRUCTURE <line>

    TO <comp_code>.

    etc..

    Build an internal table of your combinations and loop through it, populating the return table:

    LOOP AT itab INTO str.

    <0COMP_CODE> = str-comp_code.

    INSERT <line> INTO TABLE eth_chas.

    ENDLOOP.

    Hope this helps

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 25, 2005 at 05:54 AM

    Hi,

    I am trying to write a function module for a Combination Proposal and have tried to use this code. However, when the line "INSERT <line> INTO TABLE eth_chas." executes, I get the following error - Line types of an internal table and a work area not compatible.

    How is anything compatible with a HASHED TABLE?

    Thanks,

    Linda

    Add a comment
    10|10000 characters needed characters exceeded

    • Hi Linda,

      From the error message you mention I assume that <line> has the wrong type. You could use the following coding:

      field-symbols: <ls_chas> type any.

      data: ls_chas type ref to data.

      CREATE DATA ls_chas LIKE LINE OF eth_chas.

      ASSIGN ls_chas->* TO <ls_chas>.

      Now you have a work area that is compatible with the table. You can change fields in your work area using field symbols, e.g.

      field-symbols: <l_fiscper> type any.

      ASSIGN COMPONENT '0FISCPER' OF STRUCTURE <ls_chas>

      TO <l_fiscper>.

      The normal insert (like you have used it) should work now.

      Best regards,

      Gerd Schoeffl,

      SAPNetWeaverRIG BI

  • author's profile photo Former Member
    Former Member
    Posted on Jan 25, 2005 at 11:05 PM

    Hi Gerd,

    Thanks but I tried your code, which is similar to the alternative example given in this thread by KR and I get a different error - "Field symbol has not yet been assigned." at the line where I try to assign something to <l_fiscper>. For example:

    ASSIGN COMPONENT '0FISCPER' OF STRUCTURE <ls_chas>

    TO <l_fiscper>.

    <l_fiscper> = '2006007'. *** This line is in error now.

    Do you have a FULL working example?

    Thanks,

    Linda

    Add a comment
    10|10000 characters needed characters exceeded

    • Hello Linda,

      Well - yes, you are right, my example is similar to the other one given in the thread - I saw that too late.

      I had a look at my proposal and the other proposal again and they are both syntactically correct and I do not see any reason why the should not work. Can you give me all the coding that is processed before the error occurs?

      Regards,

      Gerd

  • author's profile photo Former Member
    Former Member
    Posted on Jan 26, 2005 at 10:15 PM

    Hi Gerd,

    I have emailed the code to your SAP email address.

    Regards,

    Linda

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hello,

      I am trying to use the code above and I am having the same issues as Linda reported. Could anyone post a working piece of ABAP?

      At this point I could figure out that the exit is called in the program UPC_CHAS_CHECK_COMBINATION, but the export parameter looks like is not to being used anywhere.

      Any help would be apreciated.

      Thanks

      Alex Zetune

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.