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

table internal in a module function

Former Member
0 Likes
1,270

Hi abappers,

I want use the values of my table internal in my function module; then in my module funtion add the table internal in the tab TABLE

Then call to my function module:

num = 3.
      CALL FUNCTION 'ZMF1'
              EXPORTING
                NOM_TABLA    = 'YXS2'
                NUM = num
             TABLES
                I_TABLA      = I_YXS2.

but when I want obtain in my function module the values of the table internal, it is emplty.

Can you help me, please?

Cordial greetings.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,232

Hi Fernandez,

Most likely when you call your function module your internal table "I_YXS2" does not contain any data.

Please put a break point at CALL FUNCTION and check if the internal table contains anything and then check inside the Function Module.

Please revert if u still face the issue.

9 REPLIES 9
Read only

Former Member
0 Likes
1,232

Hi.... could you please explain your issue more clearly ...

What I understand is that there are some values u want to take from program to your functio module and update the table .... is this what ur looking for ?

Thanks,

Adi

Read only

0 Likes
1,232

Hi Adytya,

yes I want take values from program and then later use it in my function module.

In the program the values of the table internal are correct, but when I want use it in my function module, the table internal is empty and I need modify the value of the table

CODE OF MY PROGRAM:

DATA: BEGIN OF I_YXS2 OCCURS 0.
        INCLUDE STRUCTURE YXS2.
DATA: END OF I_YXS2.

CALL FUNCTION 'ZMF1'
              EXPORTING
                NOM_TABLA    = 'YXS2'
              TABLES
                I_TABLA      = I_YXS2

CODE OF MY FUNCTION MODULE:

TABLES: YXS2.
...

LOOP AT I_YXS2.
    MOVE-CORRESPONDING I_YXS2 TO YXS2.
    MODIFY YXS2.
*  commit work and wait.
ENDLOOP.

Thank you for your attention.

Cordial greetings.

Read only

0 Likes
1,232

Should be...


TABLES: YXS2.
...
 
LOOP AT I_YXS2.
    INSERT INTO YXS2 VALUES I_YXS2.
*  commit work and wait.
ENDLOOP.

Greetings,

Blag.

Read only

Former Member
0 Likes
1,233

Hi Fernandez,

Most likely when you call your function module your internal table "I_YXS2" does not contain any data.

Please put a break point at CALL FUNCTION and check if the internal table contains anything and then check inside the Function Module.

Please revert if u still face the issue.

Read only

0 Likes
1,232

Hi Ankesh,

the table internal I_XS2 contain data (in the program), and then when I go to the table internal (in my function module) I view that the table internal no contain data.

Read only

0 Likes
1,232

That's because your redefining the internal table...


DATA: BEGIN OF I_YXS2 OCCURS 0.
        INCLUDE STRUCTURE YXS2.
DATA: END OF I_YXS2.

You already define the structure of the FM parameters...So you now must delete that DATA declaration...

Greetings,

Blag.

Read only

0 Likes
1,232

Thank you very much Alvaro,

I change in the tab TABLES of the function module the parameter I_YXS2 for I_TABLA; I change the code of the funtion module too and now all is correct:

CODE OF MY PROGRAM:

DATA: BEGIN OF I_YXS2 OCCURS 0.
        INCLUDE STRUCTURE YXS2.
DATA: END OF I_YXS2.

CALL FUNCTION 'ZMF1'
              EXPORTING
                NOM_TABLA    = 'YXS2'
              TABLES
                I_TABLA      = I_YXS2

CODE OF MY FUNCTION MODULE:

TABLES: YXS2.
...
 
LOOP AT I_TABLA.
    INSERT INTO YXS2 VALUES I_TABLA.
ENDLOOP.

Thank you at all for your attention.

Read only

0 Likes
1,232

Great! I'm glad I could help you -;)

Greetings,

Blag.

Read only

Former Member
0 Likes
1,232

Hi fernandez,

First check the code written inside the Function Module - Its import, export and tables parameters.

Check the type which you declared for the Internal tabels both in the import, export and tables parameters of the Function Module. Also check whether the number of fields and their order when assigning.

Hope this helps.

Regards,

Ravikiran.