Application Development and Automation 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: 
Read only

MB_DOCUMENT_BADI.

Former Member
0 Likes
1,233

Hi,

Documentation for this BADI says we cannot access global fields defined in class as methods are called at different time,so I am trying to Use EXPORT/IMPORT to pass on internal table to Update Method.

I am using this in Before Update Method

select * into table it_itab from i_tab where regio = 'XX'.

read table it_itab into it_itab1 index 1.

it_itab1-regio = 'ABC'.

MODIFY it_itab FROM it_itab1 INDEX 1.

EXPORT it_itab from it_itab TO MEMORY ID 'XXXX'.

ENDIF.

and Code in Update Method , will read from Memory id 'XXXX'.

IMPORT it_itab to it_itab FROM MEMORY ID 'XXXX'.

INSERT i_tab1 FROM it_itab.

free memory id 'XXXX'.

But it is inserting blank record into i_tab1, any idea why??

Thanks

Lakhbir

Hi,

Documentation for this BADI says we cannot access global fields defined in class as methods are called at different time,so I am trying to Use EXPORT/IMPORT to pass on internal table to Update Method.

I am using this in Before Update Method

select * into table it_itab from i_tab where regio = 'XX'.

read table it_itab into it_itab1 index 1.

it_itab1-regio = 'ABC'.

MODIFY it_itab FROM it_itab1 INDEX 1.

EXPORT it_itab from it_itab TO MEMORY ID 'XXXX'.

ENDIF.

and Code in Update Method , will read from Memory id 'XXXX'.

IMPORT it_itab to it_itab FROM MEMORY ID 'XXXX'.

INSERT i_tab1 FROM it_itab.

free memory id 'XXXX'.

But it is inserting blank record into i_tab1, any idea why??

Thanks

Lakhbir

8 REPLIES 8
Read only

Former Member
0 Likes
1,039

Hi,

Try this..

If you are using internal table to export & import..Use INSERT ..FROM TABLE.. to move the values to the database..

<b>INSERT i_tab1 FROM TABLE it_itab.</b>

Thanks,

Naren

Read only

0 Likes
1,039

Hi,

I think values are not passes on the Internal table from memory.

Any idea what could be wrong with EXPORT/IMPORT

Thanks

Read only

Former Member
0 Likes
1,039

Hi,

Set the update debugging flag and check if the IMPORT statement is not populating the internal table..

Thanks,

Naren

Read only

0 Likes
1,039

I am sorrym, But how to set Update Debugging flag.

Thanks

Lakhbir

Read only

Former Member
0 Likes
1,039

Hi,

Before pressing the save button in the MIGO transaction..

Press /h

Then press save button..

It will take you the debugging screen..

In the menu choose..Settings -> Update debugging..

You will get a message "Update debugging switched on"..

Thanks,

Naren

Read only

0 Likes
1,039

Thanks Naren

But Import is not reading the Values from Memory ID even EXPORT is successful.

return code sy-subrc = 0.

This might be because METHOD'S with the class are called at different time and in different roll area, but we are exporting to ABAP Memory.

Any idea why it is not able to read from Memory ID.

Read only

Former Member
0 Likes
1,039

Hi,

Question->Why can't you directly do the select and insert in the MB_DOCUMENT_UPDATE method..Instead of selecting the data in the method MB_DOCUMENT_BEFORE_UPDATE and then export it to the memory..and then import it in the method MB_DOCUMENT_UPDATE..

Add the below code directly in the method MB_DOCUMENT_UPDATE..

select * into table it_itab from i_tab where regio = 'XX'.

read table it_itab into it_itab1 index 1.

it_itab1-regio = 'ABC'.

MODIFY it_itab FROM it_itab1 INDEX 1.

INSERT i_tab1 FROM it_itab.

Thanks,

Naren

Read only

0 Likes
1,039

Yes, I can do that but was trying to do something otherway, I had to POST an FI document so doing calculations & checking in BEFORE method and if eberything is fine Just do POST in Update mode.

I ahd lenghty calculation to .. so just to minimize the delay in Update Task.

Anyway I think we cannot access Memory id In Update mode will have to live with this.

Thanks Alot for your help Naren.

Lakhbir