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: 

FUNCTION MODULE

Former Member
0 Kudos


Tables:
itab1 like itab.

Import Parameters:
p_erdat like vbak-erdat.
p_vkorg like vbak-vkorg.
p_vtweg like vbak-vtweg.
p_spart like vbak-spart.

Source Code:
DATA:BEGIN OF ITAB OCCURS 0,
       vbeln LIKE vbak-vbeln,
       bsark LIKE vbak-bsark,
       vtweg LIKE vbak-vtweg,
       spart LIKE vbak-spart,
       vdatu LIKE vbak-vdatu,
       END OF ITAB.

  SELECT vbeln bsark vtweg spart vdatu
  FROM vbak
  INTO CORRESPONDING FIELDS OF TABLE ITAB1
  WHERE
  erdat = p_erdat AND
  vkorg = p_vkorg AND
  vtweg = p_vtweg AND
  spart = p_spart.

I have created a Function Module in which I have given the above entries,but I am not getting any data in internal table itab1.Can anyone please suggest.points will be no doubt rewarded.

1 ACCEPTED SOLUTION

naimesh_patel
Active Contributor
0 Kudos

In order to get the values from this select query you must pass all 4 fields with values. If you don't put value to any field you will not get any data in the itab.

Make your fields as mandatory parameters.

Regards,

Naimesh Patel

10 REPLIES 10

naimesh_patel
Active Contributor
0 Kudos

In order to get the values from this select query you must pass all 4 fields with values. If you don't put value to any field you will not get any data in the itab.

Make your fields as mandatory parameters.

Regards,

Naimesh Patel

0 Kudos

I am passing all 4 fields and it is also showing 2 entries but when i am entering inside it,it shows no entries,only 2 columns that is keypart and funcpart is coming.

Plz suggest.

0 Kudos

make sure the alpha exit ( Padding zeros) are fine...

0 Kudos

Hi,

Your table Parameter is WRONG. YOu have declared it with type ITAB ( Which is a structure with two fields KEYPART

FUNCPART )

You should declare your own structure with required fields and then use that structure for declaring the parameter ITAB1 in your TABLES parameter for the Function Module

Declare a new structure with fields vbeln bsark vtweg spart vdatu.

Or

Declare your Tables Parameter ITAB1 with type VBAK

Message was edited by:

Abhishek Jolly

0 Kudos

Check the date format which you are passing

Thanks,

Srinivas

0 Kudos
> I am passing all 4 fields <-- assuming that these are 4 import parameters
> and it is also showing 2 entries <-- what is 'it'? 2 entries means you see 2 records in itab1?
> but when i am entering inside it,it shows no entries, <-- What do you mean by "inside it"?
> only 2 columns that is keypart and funcpart is coming. <-- What do you mean by funcpart and keypart?

0 Kudos

I mean when I loook into itab1 in output, not a single field that are present in itab is present in itab1.

Is there any error in declaring internal table?

0 Kudos

Hi,

Your TABLES Parameter is WRONG. YOu have declared it with type ITAB ( Which is a structure with two fields KEYPART

FUNCPART )

You should declare your own structure with required fields and then use that structure for declaring the parameter ITAB1 in your TABLES parameter for the Function Module

<b>Create a new structure with fields vbeln bsark vtweg spart vdatu and use it in the tables parameter for ITAB1</b>

Or

<b>Declare your Tables Parameter ITAB1 LIKE VBAK</b>

<b>The TABLES Parameter ITAB1 is not using the Local Internal table structure declared in the Source code. Its using the Data dictinoary structure ITAB</b>

0 Kudos

Try:

  SELECT vbeln bsark vtweg spart vdatu
  FROM vbak
  APPENDING CORRESPONDING FIELDS OF TABLE ITAB1    "<===
  WHERE ...

Rob

former_member194669
Active Contributor
0 Kudos

Hi,

1. change itab1 to itab


SELECT vbeln bsark vtweg spart vdatu
  FROM vbak
  INTO CORRESPONDING FIELDS OF TABLE ITAB "<<<<
  WHERE
  erdat = p_erdat AND
  vkorg = p_vkorg AND
  vtweg = p_vtweg AND
  spart = p_spart.

2. If you are not getting value then first go to se16 --> enter table name VBAK and give all input values for erdat, vkorg, vtweg, spart and check whether you are getting entries?