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

Passing values to an internal table and use it with the table painter

Hi,

I have seen this topic here before but the answers didn't help me. Maybe I,m doing something wrong.

The problem is that I defined the following structure on the |Types| tab of the |Global Definitions| section:

TYPES: BEGIN OF DETAILS,

EBELP TYPE EKPO-EBELP,

BSMNG TYPE EBAN-BSMNG,

LFDAT TYPE RM06P-LFDAT,

END OF DETAILS.

Then defined the following definition on the |Global Data| section:

WA_DETAILS TYPE STANDARD TABLE OF DETAILS WITH HEADER LINE

The problem is that when I try to assign a value to one of the fields in the program code like this:

LOOP AT WA_EKPO.

WA_DETAILS-EBELP = WA_EKPO-EBELP.

WA_DETAILS-EMATN = WA_EKPO-EMATN.

MODIFY WA_DETAILS.

ENDLOOP.

gives me the following error:

"WA_DETAILS" is not an internal table -the "OCCURS n" specification is missing.

Then if I add the "OCCURS 10" to the definition of the Global Data the error "OCCURS 10" is not expected.

How can I define, assign values and use as a parameter an internal table defined with types for use it with the table painter?

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • Posted on Oct 07, 2005 at 09:38 PM

    First..... WA_DETAILS does not have a field EMATN.

    
    WA_DETAILS-EMATN = WA_EKPO-EMATN.
    
    

    Also, you may want to use APPEND WA_DETAILS.

    Other than that, I'm not sure why its giving you that error.

    Regards,

    Rich Heilman

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      Sorry I ommit a few lines for the lenght of the post wasn't too big. The original definition in types is:

      TYPES: BEGIN OF DETAILS,

      EBELP TYPE EKPO-EBELP,

      EMATN TYPE EKPO-EMATN,

      TXZ01 TYPE EBAN-TXZ01,

      MSEHT TYPE T006A-MSEHT,

      BSMNG TYPE EBAN-BSMNG,

      LFDAT TYPE RM06P-LFDAT,

      TDTEXT TYPE TTXIT-TDTEXT,

      END OF DETAILS.

      The same error appears when use append WA_DETAILS instead of modify WA_DETAILS.

  • author's profile photo Former Member
    Former Member
    Posted on Oct 07, 2005 at 09:43 PM

    The following seems to work:

    REPORT ztest.
    
    TYPES: BEGIN OF details,
              ebelp TYPE ekpo-ebelp,
              bsmng TYPE eban-bsmng,
              lfdat TYPE rm06p-lfdat,
              ematn TYPE ekpo-ematn,
           END OF details.
    
    DATA: wa_details TYPE STANDARD TABLE OF details WITH HEADER LINE,
          wa_ekpo    TYPE STANDARD TABLE OF details WITH HEADER LINE.
    
    wa_ekpo-ebelp = '1'.
    append wa_ekpo.
    
    LOOP AT wa_ekpo.
      wa_details-ebelp = wa_ekpo-ebelp.
      wa_details-ematn = wa_ekpo-ematn.
      append wa_details.
    ENDLOOP.

    You can't use the modify because your not in a loop for wa_details.

    Rob

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 07, 2005 at 10:28 PM

    Hi,

    if it is one record in wa_details. you can directly write as follows..

    REPORT ZCR_TEST1 .

    TYPES: BEGIN OF details,

    ebelp TYPE ekpo-ebelp,

    bsmng TYPE eban-bsmng,

    lfdat TYPE rm06p-lfdat,

    ematn TYPE ekpo-ematn,

    END OF details.

    DATA: wa_details TYPE STANDARD TABLE OF details WITH HEADER LINE,

    wa_ekpo TYPE STANDARD TABLE OF details WITH HEADER LINE.

    wa_details-ebelp = '1'.

    append wa_details.

    wa_ekpo-ebelp = '3'.

    append wa_ekpo.

    LOOP AT wa_ekpo.

    wa_ekpo-ebelp = wa_details-ebelp.

    wa_ekpo-ematn = wa_details-ematn.

    modify wa_ekpo.

    endloop.

    Normally it wont be one record, so u need to put <b>read statement with key</b> in LOOP and ENDLOOP.

    Regards,

    Sriram

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      The code you wrote <i>Sriram</i>, works fine in a report or program but in code window of a Smart Forms I can't make it happen.

      The WA_EKPO table is passed as an Input Parameter and already had data on it, so there is no problem on making a LOOP at it.

      Also I can assign values to the fields of the table like 'WA_DETAILS1-EBELP = WA_EKPO-EBELP.' but the error trigers when I try to use an APPEND or MODIFY command.

      Apparently I can assign data to the field of an internal table but I can't add more than one row of data to a table.

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.