Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

how to read data which is not on interface of user-exit

Former Member
0 Kudos

Hi experts,

the data which I need is not on interface of user-exit. I can do export table to memory id and than in user-exit import that. Does this work always?

I have seen that sometimes is possible to see data with

(include-name)table-name. Can I always use this?

In detail: in transaction ME51N is new tabstrip created with customer fields.I have to know the purchase order for the selected item which is filled on another tabstrip.

Can anyone help me?

Thanks.

Best regards,

Danijela

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi Danijela,

To answer your question about the "(module)object" approach:

Have you been in a user exit function and the data you need wasn't passed on to you? You can easily grab the data from the memory stack using this little trick. Let's say that you need some IDoc information that was created from the function IDOC_INPUT_DELVRY... You can get it directly from the call stack like this.

The code was written in R/3 4.6C but should work in any SAP version.


DATA: i_EDIDC like EDIDC,
      i_EDIDD like EDIDD occurs 0 with header line.

CONSTANTS:
      c_EDIDD(21)  value '(SAPLV55K)IDOC_DATA[]',
      c_EDIDC(21)  value '(SAPLV55K)IDOC_CONTRL',
      c_E1ADRM1(7)      value 'E1ADRM1'
      c_SHPCON(6)  value 'SHPCON'.

Field-symbols: <FC>, <FD> .
clear: i_EDIDC, i_EDIDD.
refresh: i_EDIDD.

* Get the Control Record from memory
assign (c_EDIDC) to <FC>.
if SY-SUBRC = 0.
  i_EDIDC = <FC>.

  IF i_EDIDC-MESTYP = c_SHPCON.

*   None of the partner information can be passed directly from
*   the IDOC function, so we'll get it from memory.

*   Get IDOC data records from memory
    assign (c_EDIDD) to <FD>.
    i_EDIDD[] = <FD>.

*   Now you have the entire IDOC available to you without making
*   a DB select.
    read table i_EDIDD with key SEGNAM   = c_E1ADRM1.

*   Load new value HERE...

  ENDIF.
ENDIF.

I found this a long time ago on the web and used it successfully multiple times in the past.

Hope this helps,

Guenther

3 REPLIES 3

former_member191977
Contributor
0 Kudos

you might be having the purchase order in your main program, try accessing it in the debug mode and see.

Former Member
0 Kudos

hi,

I think export and import is the correct solution. after using the value by importing, clear the id....for own clarification.

Former Member
0 Kudos

Hi Danijela,

To answer your question about the "(module)object" approach:

Have you been in a user exit function and the data you need wasn't passed on to you? You can easily grab the data from the memory stack using this little trick. Let's say that you need some IDoc information that was created from the function IDOC_INPUT_DELVRY... You can get it directly from the call stack like this.

The code was written in R/3 4.6C but should work in any SAP version.


DATA: i_EDIDC like EDIDC,
      i_EDIDD like EDIDD occurs 0 with header line.

CONSTANTS:
      c_EDIDD(21)  value '(SAPLV55K)IDOC_DATA[]',
      c_EDIDC(21)  value '(SAPLV55K)IDOC_CONTRL',
      c_E1ADRM1(7)      value 'E1ADRM1'
      c_SHPCON(6)  value 'SHPCON'.

Field-symbols: <FC>, <FD> .
clear: i_EDIDC, i_EDIDD.
refresh: i_EDIDD.

* Get the Control Record from memory
assign (c_EDIDC) to <FC>.
if SY-SUBRC = 0.
  i_EDIDC = <FC>.

  IF i_EDIDC-MESTYP = c_SHPCON.

*   None of the partner information can be passed directly from
*   the IDOC function, so we'll get it from memory.

*   Get IDOC data records from memory
    assign (c_EDIDD) to <FD>.
    i_EDIDD[] = <FD>.

*   Now you have the entire IDOC available to you without making
*   a DB select.
    read table i_EDIDD with key SEGNAM   = c_E1ADRM1.

*   Load new value HERE...

  ENDIF.
ENDIF.

I found this a long time ago on the web and used it successfully multiple times in the past.

Hope this helps,

Guenther