‎2008 Apr 25 7:05 AM
hi all,
i want to display VKORG,VBELN,AUDAT from vbak
using select statement..
plz help me with how to declare the data and all internal table decleration breifly.
full ponits rewarded.
thnx
‎2008 Apr 25 7:09 AM
Hi,
Tables:Vbak.
Types:begin of ty_test,
vbeln type vbeln,
vkorg type vkorg,
audat type audat,
end of ty_test.
Data:i_test type table of ty_test,
st_test type ty_test.
select-options:s_vbeln for vbeln.
select vbeln vkorg audta from vbak
into table i_test
where vbeln in s_vbeln.
loop at i_test into st_test.
write:/ st_test-vbeln,st_test-vkorg,st_test-audat.
endloop.
Regards,
Shiva.
‎2008 Apr 25 7:09 AM
hi,
try like this
tables vbak
types : begin of ty_vbak ,
vkorg like vbak-vkorg,
vbeln like vbak-vbeln,
audat like vbak-audat,
end of ty_vbak.
data : it_vbak type table of ty_vbak,
wa_vbak type ty_vbak.
select vkorg vbeln audat
from vbak
into table it_vbak.
loop at it_vbak into wa_vbak.
write : / wa_vbak-vkorg,
wa_vbak-vbeln,
wa_vbak-audat.
endloop.
******************************************************************************************
there is another method also but performance wise not recommended
tables : vbak.
select VKORG VBELN AUDAT from vbak into vbak.
write : / vbak-vkorg,
vbak-vbeln,
vbak-audat.
endselect.
regards
prasanth
‎2008 Apr 25 7:11 AM
data : begin of t_table occurs 0,
vbeln type vbeln_va,
vkorg type vkorg,
audat type erdat,
end of t_table.
select vbeln
vkorg
audat
into table t_table from vbak.
this code will select all vbeln,vkorg and audat from vbak into your internal table t_table.
plz reward if useful
vivek
‎2008 Apr 25 7:16 AM
Hi,
Try....
TABLES: VBAK.
DATA : BEGIN OF IT OCCURS 0,
VBELN LIKE VBAK-VBELN,
VKORG LIKE VBAK-VKORG,
AUDAT LIKE VBAK-AUDAT,
END OF IT.
SELECT-OPTIONS: S_VBELN FOR VBAK-VBELN.
SELECT
VBELN
VKORG
AUDAT
INTO TABLE IT FROM VBAK
WHERE VBELN IN S_VBELN.
LOOP AT IT.
WRITE:/ IT-VBELN, IT-VKORG, IT-AUDAT.
ENDLOOP.
Reward points if usefull....
Regards
AK
‎2008 Apr 25 7:50 AM
Hi Daniel,
Try the below code(with brief explanation) and reward points if helpful.
Declare the work area containing only those fields from table * VBAK which are required
DATA: BEGIN OF vbak_wa OCCURS 0,
vkorg TYPE vkorg,
vbeln TYPE vbeln_va,
audat TYPE audat,
END OF vbak_wa.
Writing the headers for display
WRITE 😕 'Sales Organization', 25 'Sales Document', 45 'Document date'.
*Selecting the required fields from the table VBAK and taking *them into the work area and displaying its contents.
SELECT vkorg vbeln audat FROM vbak INTO vbak_wa.
WRITE 😕 vbak_wa-vkorg UNDER 'Sales Organization', vbak_wa-vbeln UNDER 'Sales Document', vbak_wa-audat UNDER 'Document date'.
ENDSELECT.