‎2007 Nov 22 1:23 AM
I am creating a Function Module and in Export parameter I am giving:
S_vbak like vbak-vbeln.
In tables I am giving:
ITAB like vbak
In source code I am giving :
TABLES:vbak.
SELECT vtweg FROM vbak INTO TABLE itab WHERE vbeln EQ s_vbeln.
LOOP AT itab.
WRITE:itab-vtweg.
endloop.
ENDFUNCTION.
But I am getting Zero entries,can u plz tell the error.
‎2007 Nov 22 3:23 AM
S_vbeln like vbak-vbeln. " S_VBAK is changed to S_VBELN
" In tables I am giving:
data : ITAB type standard table of vbak.
" In source code I am giving :
TABLES:vbak.
SELECT * FROM vbak INTO TABLE itab WHERE vbeln IN s_vbeln. " EQ changed to IN
LOOP AT itab.
WRITE:itab-vtweg.
endloop.
‎2007 Nov 22 3:10 AM
<b>chk vbeln "used this converstion_inpu alphaexit.</b>
S_vbak like vbak-vbeln.
In tables I am giving:
ITAB like vbak
In source code I am giving :
TABLES:vbak.
*chk p_vbeln run time length both are same or not.
SELECT vtweg FROM vbak INTO TABLE itab WHERE <b>vbeln EQ s_vbeln</b>.
<b>if sy-subrc =0. record found else where condition error</b>
LOOP AT itab.
WRITE:itab-vtweg.
endloop.
endif.
ENDFUNCTION.
‎2007 Nov 22 3:23 AM
S_vbeln like vbak-vbeln. " S_VBAK is changed to S_VBELN
" In tables I am giving:
data : ITAB type standard table of vbak.
" In source code I am giving :
TABLES:vbak.
SELECT * FROM vbak INTO TABLE itab WHERE vbeln IN s_vbeln. " EQ changed to IN
LOOP AT itab.
WRITE:itab-vtweg.
endloop.
‎2007 Nov 22 3:26 AM
Hi,
If u r using select-options, U should not use EQ u can use IN.
SELECT vtweg FROM vbak INTO TABLE itab WHERE vbeln IN s_vbeln.
Like this.
‎2007 Nov 22 3:26 AM
Hello Ajaya,
As per my understanding, in the below select statement, s_vbeln is not assigned with any value. Are you looking for values in vbak with no entry in vblen ? if not may be you need to assign a value to it and then this staement will return you the required output.
SELECT vtweg FROM vbak INTO TABLE itab WHERE vbeln EQ s_vbeln.
Best regards,
Kulwant Singh
‎2007 Nov 22 3:50 AM
Hi,ajaya.
I think you can try call this function in a program.
Regards,
feng.
‎2007 Nov 22 4:20 AM
Hi,
If u want to get the entries from VBAk based on S_VBAK,
then give S_VBAK in IMPORT parameters.
U need not write any Loop statement, because u r directly retrieving the values in to ur export table.
Ex:
Import: S_VBELN like VBAK-VBELN.
Tables: ITAB like VBAK.
Source code: Select * from VBAK into table ITAB where VBELN = S_VBELN.
Note: If u want only particular fields to be displayed, then u need to create a structure with these fields and give in Tables parameters.
‎2007 Nov 22 4:35 AM
read the itab into a structure which has the same type as the table itab.
data: wa type vbak.
loop at itab into wa
write : wa-vtweg.
endloop.
‎2007 Nov 22 5:17 AM
we will be calling this function module in some program.
right?
so just change the select statement i.e. remove the loop from there.
and try calling the FM in some prg and then you will come to know where exactly you are going wrong.
Message was edited by:
prachi s
‎2008 Jan 24 12:31 PM
try it with this coding. that one is properly written.
S_vbak like vbak-vbeln.
In tables I am giving:
ITAB like vbak
In source code I am giving :
TABLES:vbak.
SELECT vbeln vtweg FROM vbak INTO corresponding fields of TABLE itab WHERE vbeln EQ s_vbak.
LOOP AT itab.
WRITE:itab-vtweg.
endloop.
ENDFUNCTION.
now it will work.