Hārdža
Hārdža

Reputation: 75

Inserting data into BAPIRET2_TAB structure

My method is using an export parameter of type BAPIRET2_TAB. I need to fill the values of this structure, but I cant access the structure directly. For example, parameter-message = 'text', etc.

How can I do this?

These are the parameters I need to pass:

lv_msg_line. type i
lv_syntax_text. //Error message 

And this is syntax checker.

syntax-check for l_tab_code

  program   lv_progname
  message   l_error_message
  line      l_error_line
  word      l_error_word
  id 'ERR'  table l_tab_errors.

Upvotes: 0

Views: 3575

Answers (1)

Bruno Lucattelli
Bruno Lucattelli

Reputation: 347

Like said above in the comments, BAPIRET2_TAB is not a structure, and therefore cannot have its components accessed directly via STRUCTURE-FIELD paradigm.

What you need is to declare an structure like this

DATA error_line TYPE LINE OF BAPIRET2_TAB.

Then, you can use it to fill the data in...

error_line-program = sy-repid.
error_line-id = sy-msgid.

... and so forth. Then, lastly, you append the error_line item to your BAPIRET2_TAB.

APPEND error_line TO bapi2tab.
CLEAR error_line.

Hope it helps.

Upvotes: 2

Related Questions