Displaying internal table horizontally using FM REUSE_ALV_GRID_DISPLAY
Hi everyone,
I'm quite having difficulty deciphering on how I can display my internal table in ALV_GRID horizontally. Example:
my itab:
lastname(15),
firstname(20),
minit(1).
OUTPUT:
LASTNAME FIRSTNAME MINIT
Is this possible? Can someone help me by giving me the correct codes? Thanks in advance.
Anna Bechayda
by default it is printing horizontally.
i think you are declaring your itab like this but when you will fetch or append the data into itab it will be like this
firstnam lastname minit
a b 1
b c 2
like this. just pass your itab to reuse alv fn module. but one thing you have to build your fieldcatalog for that.
regards
shiba dutta
Similar Messages
-
Populate and display internal table results using search help exit...
I have copied F4IF_SHLP_EXIT_EXAMPLE and made changes. I want this search help exit to populate and display contents related to 'FIELD1' when the user enters a specific value for it in the search help screen, meaning when the user restricts the search by that value. For field2, field3, field4, field5, field6, field7, and field8 I am using a custom view.
Following is the code:
TYPES: BEGIN OF t_search,
field2 TYPE field2,
field3 TYPE field3,
field4 TYPE field4,
field5 TYPE field5,
field6 TYPE field6,
field7 TYPE field7,
field8 TYPE field8,
field1 TYPE field1,
END OF t_search.
DATA: it_itab TYPE TABLE OF t_search,
wa TYPE t_search,
wa_selopt TYPE ddshselopt,
wa_fielddescr TYPE dfies.
ranges: r_field1 for std_table1-field1
STEP SELECT (Select values)
FREE: r_field1.
**Get the value entered for FIELD1 in search help
LOOP AT shlp-selopt INTO wa_selopt.
CASE wa_selopt-shlpfield.
WHEN 'FIELD1'.
r_field1-sign = wa_selopt-sign.
r_field1-option = wa_selopt-option.
r_field1-low = wa_selopt-low.
r_field1-high = wa_selopt-high.
APPEND r_field1.
CLEAR: r_field1.
ENDCASE.
ENDLOOP.
**Select 'ID' and 'FIELD1' from table into lt_itab
SELECT id field1
INTO TABLE lt_itab
FROM std_table1
WHERE field1 IN r_field1.
IF sy-subrc = 0.
**Now, based on the particular IDs from lt_itab, I need to select other values
from other tables which also have 'ID' as the key.
SELECT std_table2~field2
std_table2~field3
std_table3~field4
std_table3~field5
std_table3~field6
std_table4~field7
std_table4~field8
std_table1~field1
INTO CORRESPONDING FIELDS OF TABLE it_itab
FROM std_table2
INNER JOIN std_table3 ON
std_table3mandt = std_table2mandt AND
std_table3id = std_table2id
INNER JOIN std_table4 ON
std_table4mandt = std_table2mandt AND
std_table4id = std_table2id
INNER JOIN std_table1 ON
std_table1mandt = std_table2mandt AND std_table1id = std_table2id
WHERE
std_table1~field1 IN r_field1.
'id' is common in all the std_tables --> std_table1, std_table2, std_table3, std_table4.
STEP DISP (Display values)
**Then I need to gather all the results in my internal table it_itab and display
in search help results for the value of FIELD1 entered by the user in the search help.
CALL FUNCTION 'F4UT_PARAMETER_RESULTS_PUT'
EXPORTING
parameter = 'FIELD1'
fieldname = 'FIELD1'
TABLES
shlp_tab = shlp_tab
record_tab = record_tab
source_tab = it_itab
CHANGING
shlp = shlp
callcontrol = callcontrol.
I am not getting all the data in my internal table and wanted to know if there is anyting wrong in my select statement.
Any guidance will be appreciated and awarded appropriate points.
Thanks.the webdynpro fieldname and the search help input parameter name were made same.
-
Need to display Internal table records on screen without using table contro
Hi Experts,
I have a requirement to display internal table on screen which is having three columns (Material no, Serial No and quantity).
But I can't use table control as it is not supported by hand held devices.
They are going to use this transaction on hand held devices.
Thanks In advance.
GauravYou should be able to use the good old STEP LOOP processing for this... create your three fields in the row then convert them to a STEP-LOOP.
You can look up in the help how to work with STEP-LOOPs if you are not familiar with it. It was the way to manage table-like information before the age of table controls -
Need a POP-UP which can display internal table data in ALV format
HI All,
I need to display INTERNAL TABLE values through a POP-UP. Only condition is that the window with the internal table data should be in ALV format and not in TEXT only format.
To clarify, I used FM 'POPUP_WITH_TABLE_DISPLAY_OK' and 'POPUP_WITH_TABLE_DISPLAY', but both display the data in TEXT format and there is no provision to put the FIELD names there. Everthing needs to be put into internal table and it displays it in text format.
So I want a FM where I can display internal tabel data in ALV format( same format that would appear if you creata search help for a filed and output window would have all the ALV features like SORT buttons etc.
Hope there is some FM to achieve this ALV format data thing.
Thanks in advance for all your help.
Regards
FX3check this
REPORT y_demo_alv_3.
TYPE-POOLS: slis.
DATA: BEGIN OF i_outtab OCCURS 0.
INCLUDE STRUCTURE sflight.
DATA: w_chk TYPE c. "For multiple selection
DATA: END OF i_outtab.
* I_OUTTAB TYPE SFLIGHT OCCURS 0,
DATA: i_private TYPE slis_data_caller_exit,
i_selfield TYPE slis_selfield,
W_exit(1) TYPE c.
PARAMETERS: p_title TYPE sy-title.
START-OF-SELECTION.
SELECT * FROM sflight INTO TABLE i_outtab.
CALL FUNCTION 'REUSE_ALV_POPUP_TO_SELECT'
EXPORTING
i_title = p_title
i_selection = 'X'
i_zebra = 'X'
* I_SCREEN_START_COLUMN = 0
* I_SCREEN_START_LINE = 0
* I_SCREEN_END_COLUMN = 0
* I_SCREEN_END_LINE = 0
i_checkbox_fieldname = 'W_CHK'
* I_LINEMARK_FIELDNAME =
* I_SCROLL_TO_SEL_LINE = 'X'
i_tabname = 'I_OUTTAB'
i_structure_name = 'SFLIGHT'
* IT_FIELDCAT =
* IT_EXCLUDING =
* I_CALLBACK_PROGRAM =
* I_CALLBACK_USER_COMMAND =
* IS_PRIVATE = I_PRIVATE
IMPORTING
es_selfield = i_selfield
e_exit = w_exit
TABLES
t_outtab = i_outtab
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
* MESSAGE i000(0k) WITH sy-subrc.
ENDIF.
*****the internal table is modified with a cross sign for marking the
***rows selected
LOOP AT i_outtab WHERE w_chk = 'X'.
WRITE: / i_outtab-carrid, i_outtab-price.
ENDLOOP. -
I want to create an internal table without using header line and occurs 0?
hi experts,
Can anybody help me to declare an internal table without using headerline and occurs 0 options but still i have to use the functionalities that occurs 0 and header line options provide.Hi Saisri,
You can use the internal table without headerline and create a header for then internal table with the same structure. We need to use the header while manipulating with the data of the internal table.
example:
types: begin of ty_afpo,
kdauf type kdauf,
kdpos type kdpos,
ltrmp type ltrmp,
end of ty_afpo.
data : t_afpo type standard table of ty_afpo, " internal table declaration
wa_afpo type ty_afpo. " work area declaration
<after populating the data into the internal table>
loop at t_afpo into wa_afpo.
write:/ wa_afpo-kdauf, wa_afpo-kdpos, wa_afpo-ltrmp.
endloop.
This I think shall give you a basic understanding of how things work.
<b>Reward points if this helps,</b>
Kiran -
Static internal table issue - Used in BI Extractor
Hi,
We are reading data from a table in to a static internal table and using this table for future lookups.
Once in a while we can't find data while doing a lookup from this static internal table , But most of the time it works.
Is it possible that data from this static internal table is removed due to memory issues during peak periods.
Thanks in advanceHere is the code and it is there in a function module.This function module is called from a different FM in a loop.
TABLES: OIU_CM_MAT_PRCD.
STATICS: i_mat_prcd LIKE OIU_CM_MAT_PRCD OCCURS 10 WITH HEADER LINE.
DATA: ws_lines like sy-toccu.
DESCRIBE TABLE i_mat_prcd LINES ws_lines.
IF ws_lines = 0.
SELECT * INTO TABLE i_mat_prcd
FROM OIU_CM_MAT_PRCD.
IF i_matnr > ' '.
SORT i_mat_prcd BY matnr.
ELSE.
SORT i_mat_prcd BY majpd_cd pd_cd.
ENDIF.
ENDIF.
IF i_matnr > ' '.
READ TABLE i_mat_prcd WITH KEY matnr = i_matnr
BINARY SEARCH.
IF SY-SUBRC = 0.
CHG_MAJOR = i_mat_prcd-MAJPD_CD.
CHG_MINOR = i_mat_prcd-PD_CD.
CONCATENATE i_mat_prcd-majpd_cd i_mat_prcd-pd_cd
INTO chg_prod.
ENDIF. " i_matnr > blank -
How to display smartforms table lines useing different background colour
Hi all:
How to display smartforms table lines useing different background colour .
for example:
line1:green
line2:red
line3:green
line4:red
line5:green
line6:red
line7:green
line8:red
Any help is highly appreciated!!
启明星Hi,
Create a two lines one for header and second for data in the table.
1)In table painter we can find the pencil mark.
2)select the pencil mark
3)now select the line which you need to shade
4) now select the shading colour in the table painter and the provide the resolution up to 100% and select table pattrn for that line.
5) Now you can use this for the header now only the header gets shaded and the remaining gets unshaded.
reward points if useful
Thanks and Regards,
Nishant -
Can i send back an internal table by using Changing clause?
i'm using a Perform statement in SAP Script and i have written corresponding subroutine in an Zprogram.
In that subroutine i want to create one internal table and send back it to script.
can i send back an internal table by using Changing clause?
if it is possible, pls give me the idea................Hi,
While calling the formroutine,just u can pass the individual values using the ITCSY.In form,you are decalring the internal table with structure itcsy-input.
Then,you need to place the loop on the table and print in script.
But, passing the internal table in script,is not recomnded..
Regards,
Shiva Kumar -
How to use dynamic internal table when using gui_upload?
Hi Experts,
my scenario is like i have header data, item data and serial numbers.
so with respect to the quantity in unit of measure ,there will be number of serial numbers..
i have declared the dynamic internal table,but i am not getting the logic to change the structure accordingly with respect to the flat file entries..
is it possible to do or its not possible....any suggestion!!!!i have declared like this....
TYPES: BEGIN OF ty_final,
bldat TYPE string, "Document Date
budat TYPE string, "Psting Date
bktxt TYPE string, "Document Header Text
werks TYPE string, "Plant
lgort TYPE string, "Storage Location
matnr TYPE string, "Material Number
erfmg TYPE string, "Quantity in Unit Of Entry
anln1 TYPE string, "Asset Number
anln2 TYPE string, "Asset Subnumber
sernr TYPE string, "serial Number
END OF ty_final.
DATA : it_final TYPE TABLE OF ty_final,
wa_final TYPE ty_final.
FIELD-SYMBOLS : <fs_final> TYPE table.
ASSIGN it_final TO <fs_final>.
after this i called gui upload and passed internal table it_final..
but i have to change the internal table structure dynamically before the upload function.so that it will match with the flat file...
Regards
KarthickThere are at least two approaches you can use to change/generate new dynamic-structured table. Either with [RTTI + RTTS|https://wiki.sdn.sap.com/wiki/display/Snippets/CreatingFlatandComplexInternalTablesDynamicallyusingRTTI] or using [CL_ALV_TABLE_CREATE|http://www.sdn.sap.com/irj/scn/advancedsearch?query=cl_alv_table_create] . In this one just determine fieldcatalog of current table and change it accordingly, then regenarate table.
There are plenty of examples in SCN for this. You should not face difficulties applying this.
Regards
Marcin -
How to display Internal Table in ALV?
Hi all,
can anyone teach me the simple way to insert my internal table records to ALV by providing me the sample codes from the start of declaration to the end? Below is how i define my internal table:
DATA: DOM_NAME(40) TYPE C,
P_TABLE(40) TYPE C.
TYPES: BEGIN OF ITAB6,
FIELDNAME TYPE DD03M-FIELDNAME,
END OF ITAB6.
P_TABLE = 'ABC'
DOM_NAME = 'TRY'
DATA: ITAB6 TYPE STANDARD TABLE OF ITAB6 WITH HEADER LINE.
SELECT FIELDNAME FROM DD03M INTO TABLE ITAB6 WHERE TABNAME = P_TABLE AND
DOMNAME = DOM_NAME.
Hope that anyone can just start the part of alv from the continuation of my codes. cus i went through others thread but it seem to be confusing me. thx! hope to get replies asap.hai
copy this program and past in to the wk bench....(se38)
thn execute it...
REPORT ZALVTEST2_RNJ .
*ABAP LIST VIEWER
This is a basic ALV with the followings:-
- Page Heading
- Page No
- Sub-Total
- Grand Total
*REPORT ZALV.
TYPE-POOLS: SLIS.
DATA: G_REPID LIKE SY-REPID,
GS_PRINT TYPE SLIS_PRINT_ALV,
GT_LIST_TOP_OF_PAGE TYPE SLIS_T_LISTHEADER,
GT_EVENTS TYPE SLIS_T_EVENT,
GT_SORT TYPE SLIS_T_SORTINFO_ALV,
GS_LAYOUT TYPE SLIS_LAYOUT_ALV,
GT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
FIELDCAT_LN LIKE LINE OF GT_FIELDCAT,
COL_POS TYPE I.
DATA: BEGIN OF ITAB,
FIELD1(5) TYPE C,
FIELD2(5) TYPE C,
FIELD3(5) TYPE P DECIMALS 2,
END OF ITAB.
DATA: BEGIN OF ITAB1 OCCURS 0.
INCLUDE STRUCTURE ITAB.
DATA: END OF ITAB1.
DATA: BEGIN OF ITAB_FIELDCAT OCCURS 0.
INCLUDE STRUCTURE ITAB.
DATA: END OF ITAB_FIELDCAT.
Print Parameters
PARAMETERS:
P_PRINT AS CHECKBOX DEFAULT ' ', "PRINT IMMEDIATE
P_NOSINF AS CHECKBOX DEFAULT 'X', "NO SELECTION INFO
P_NOCOVE AS CHECKBOX DEFAULT ' ', "NO COVER PAGE
P_NONEWP AS CHECKBOX DEFAULT ' ', "NO NEW PAGE
P_NOLINF AS CHECKBOX DEFAULT 'X', "NO PRINT LIST INFO
P_RESERV TYPE I. "NO OF FOOTER LINE
INITIALIZATION.
G_REPID = SY-REPID.
PERFORM PRINT_BUILD USING GS_PRINT. "Print PARAMETERS
START-OF-SELECTION.
TEST DATA
MOVE 'TEST1' TO ITAB1-FIELD1.
MOVE 'TEST1' TO ITAB1-FIELD2.
MOVE '10.00' TO ITAB1-FIELD3.
APPEND ITAB1.
MOVE 'TEST2' TO ITAB1-FIELD1.
MOVE 'TEST2' TO ITAB1-FIELD2.
MOVE '20.00' TO ITAB1-FIELD3.
APPEND ITAB1.
DO 50 TIMES.
APPEND ITAB1.
ENDDO.
END-OF-SELECTION.
PERFORM BUILD.
PERFORM EVENTTAB_BUILD CHANGING GT_EVENTS.
PERFORM COMMENT_BUILD CHANGING GT_LIST_TOP_OF_PAGE.
PERFORM CALL_ALV.
FORM BUILD.
DATA FIELD CATALOG
Explain Field Description to ALV
DATA: FIELDCAT_IN TYPE SLIS_FIELDCAT_ALV.
CLEAR FIELDCAT_IN.
FIELDCAT_LN-FIELDNAME = 'FIELD1'.
FIELDCAT_LN-TABNAME = 'ITAB1'.
*FIELDCAT_LN-NO_OUT = 'X'. "FIELD NOT DISPLAY, CHOOSE FROM LAYOUT
FIELDCAT_LN-KEY = ' '. "SUBTOTAL KEY
FIELDCAT_LN-NO_OUT = ' '.
FIELDCAT_LN-SELTEXT_L = 'HEAD1'.
APPEND FIELDCAT_LN TO GT_FIELDCAT.
CLEAR FIELDCAT_IN.
FIELDCAT_LN-FIELDNAME = 'FIELD2'.
FIELDCAT_LN-TABNAME = 'ITAB1'.
FIELDCAT_LN-NO_OUT = 'X'.
FIELDCAT_LN-SELTEXT_L = 'HEAD2'.
APPEND FIELDCAT_LN TO GT_FIELDCAT.
CLEAR FIELDCAT_IN.
FIELDCAT_LN-FIELDNAME = 'FIELD3'.
FIELDCAT_LN-TABNAME = 'ITAB1'.
FIELDCAT_LN-REF_FIELDNAME = 'MENGE'. "<- REF FIELD IN THE DICTIONNARY
FIELDCAT_LN-REF_TABNAME = 'MSEG'. "<- REF TABLE IN THE DICTIONNARY
FIELDCAT_LN-NO_OUT = ' '.
FIELDCAT_LN-DO_SUM = 'X'. "SUM UPON DISPLAY
APPEND FIELDCAT_LN TO GT_FIELDCAT.
DATA SORTING AND SUBTOTAL
DATA: GS_SORT TYPE SLIS_SORTINFO_ALV.
CLEAR GS_SORT.
GS_SORT-FIELDNAME = 'FIELD1'.
GS_SORT-SPOS = 1.
GS_SORT-UP = 'X'.
GS_SORT-SUBTOT = 'X'.
APPEND GS_SORT TO GT_SORT.
CLEAR GS_SORT.
GS_SORT-FIELDNAME = 'FIELD2'.
GS_SORT-SPOS = 2.
GS_SORT-UP = 'X'.
*GS_SORT-SUBTOT = 'X'.
APPEND GS_SORT TO GT_SORT.
ENDFORM.
FORM CALL_ALV.
ABAP List Viewer
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = G_REPID
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = ' '
I_STRUCTURE_NAME = 'ITAB1'
IS_LAYOUT = GS_LAYOUT
IT_FIELDCAT = GT_FIELDCAT[]
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT = GT_SORT[]
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT =
IT_EVENTS = GT_EVENTS[]
IT_EVENT_EXIT =
IS_PRINT = GS_PRINT
IS_REPREP_ID =
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
T_OUTTAB = ITAB1
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2.
ENDFORM.
HEADER FORM
FORM EVENTTAB_BUILD CHANGING LT_EVENTS TYPE SLIS_T_EVENT.
CONSTANTS:
GC_FORMNAME_TOP_OF_PAGE TYPE SLIS_FORMNAME VALUE 'TOP_OF_PAGE'.
*GC_FORMNAME_END_OF_PAGE TYPE SLIS_FORMNAME VALUE 'END_OF_PAGE'.
DATA: LS_EVENT TYPE SLIS_ALV_EVENT.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
I_LIST_TYPE = 0
IMPORTING
ET_EVENTS = LT_EVENTS.
READ TABLE LT_EVENTS WITH KEY NAME = SLIS_EV_TOP_OF_PAGE
INTO LS_EVENT.
IF SY-SUBRC = 0.
MOVE GC_FORMNAME_TOP_OF_PAGE TO LS_EVENT-FORM.
APPEND LS_EVENT TO LT_EVENTS.
ENDIF.
define END_OF_PAGE event
READ TABLE LT_EVENTS WITH KEY NAME = SLIS_EV_END_OF_PAGE
INTO LS_EVENT.
IF SY-SUBRC = 0.
MOVE GC_FORMNAME_END_OF_PAGE TO LS_EVENT-FORM.
APPEND LS_EVENT TO LT_EVENTS.
ENDIF.
ENDFORM.
FORM COMMENT_BUILD CHANGING GT_TOP_OF_PAGE TYPE SLIS_T_LISTHEADER.
DATA: GS_LINE TYPE SLIS_LISTHEADER.
CLEAR GS_LINE.
GS_LINE-TYP = 'H'.
GS_LINE-INFO = 'HEADER 1'.
APPEND GS_LINE TO GT_TOP_OF_PAGE.
CLEAR GS_LINE.
GS_LINE-TYP = 'S'.
GS_LINE-KEY = 'STATUS 1'.
GS_LINE-INFO = 'INFO 1'.
APPEND GS_LINE TO GT_TOP_OF_PAGE.
GS_LINE-KEY = 'STATUS 2'.
GS_LINE-INFO = 'INFO 2'.
APPEND GS_LINE TO GT_TOP_OF_PAGE.
CLEAR GS_LINE.
GS_LINE-TYP = 'A'.
GS_LINE-INFO = 'ACTION'.
APPEND GS_LINE TO GT_TOP_OF_PAGE.
ENDFORM.
FORM TOP_OF_PAGE.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = GT_LIST_TOP_OF_PAGE.
WRITE: SY-DATUM, 'Page No', SY-PAGNO LEFT-JUSTIFIED.
ENDFORM.
FORM END_OF_PAGE.
WRITE at (sy-linsz) sy-pagno CENTERED.
ENDFORM.
PRINT SETTINGS
FORM PRINT_BUILD USING LS_PRINT TYPE SLIS_PRINT_ALV.
LS_PRINT-PRINT = P_PRINT. "PRINT IMMEDIATE
LS_PRINT-NO_PRINT_SELINFOS = P_NOSINF. "NO SELECTION INFO
LS_PRINT-NO_COVERPAGE = P_NOCOVE. "NO COVER PAGE
LS_PRINT-NO_NEW_PAGE = P_NONEWP.
LS_PRINT-NO_PRINT_LISTINFOS = P_NOLINF. "NO PRINT LIST INFO
LS_PRINT-RESERVE_LINES = P_RESERV.
ENDFORM.
*END OF ZALV PROGRAM
regard
nawa -
Problem in displaying internal table contents to excel(color)
Hello Gurus!!!!!
The code is given below :-
*& Module pool ZDEMO_DOWNLD1
PROGRAM ZDEMO_DOWNLD1.
*& Module USER_COMMAND_0100 INPUT
text
MODULE USER_COMMAND_0100 INPUT.
DATA : f_name(120) type c,
f_name1(120) type c.
case sy-ucomm.
when 'ATTACH'.
CALL FUNCTION 'WS_FILENAME_GET'
EXPORTING
DEF_FILENAME = ' '
DEF_PATH = ' '
MASK = ' '
MODE = ' '
TITLE = ' '
IMPORTING
FILENAME = f_name
RC =
EXCEPTIONS
INV_WINSYS = 1
NO_BATCH = 2
SELECTION_CANCEL = 3
SELECTION_ERROR = 4
OTHERS = 5
*f_name = DEF_FILENAME.
f_name1 = f_name.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
endcase.
ENDMODULE. " USER_COMMAND_0100 INPUT
*& Module STATUS_0100 OUTPUT
text
MODULE STATUS_0100 OUTPUT.
SET PF-STATUS 'xxxxxxxx'.
SET TITLEBAR 'xxx'.
type-pools ole2.
data: h_excel type ole2_object, " Excel object
h_mapl type ole2_object, " list of workbooks
h_map type ole2_object, " workbook
h_zl type ole2_object, " cell
h_f type ole2_object, " font
h_interior type ole2_object. " Color
*tables: spfli.
DATA: ls_emp TYPE zpm_emp_det,
lt_emp TYPE zpm_emp_det OCCURS 0,
l_projectname TYPE zpm_emp_item_det-project_name,
l_projectname_last TYPE zpm_emp_item_det-project_name,
l_empid TYPE zpm_emp_item_det-empid,
l_empid_last TYPE zpm_emp_item_det-empid.
DATA: l_projectname_key TYPE lvc_nkey,
l_role_of_emp_key TYPE lvc_nkey,
l_last_key TYPE lvc_nkey.
DATA : lt_project_main TYPE TABLE OF zsach_pm ,
ls_project_main TYPE zsach_pm,
lt_project TYPE zsach_pm OCCURS 0,
ls_project TYPE zsach_pm.
internal table for excel headings
DATA : BEGIN OF lt_project_ex OCCURS 0,
line(50) TYPE c,
END OF lt_project_ex.
DATA: lt_project1 TYPE zsach_pm OCCURS 0,
ls_project1 TYPE zsach_pm.
DATA : lt_project_temp TYPE zsach_pm OCCURS 0 ,
ls_project_temp TYPE zsach_pm.
DATA: lt_project2 TYPE zsach_pm OCCURS 0,
ls_project2 TYPE zsach_pm.
TYPES: BEGIN OF st_username,
username TYPE zuser_names-username,
END OF st_username.
DATA: it_tab TYPE TABLE OF st_username,
wa_tab TYPE st_username.
data : lt_project_excel like zsach_pm occurs 0 with header line.
*DATA: f_name TYPE string.
data h type i.
table of flights
data: it_spfli like spfli occurs 10 with header line.
*& Event START-OF-SELECTION
SELECT empid
project_name
role_of_emp
competancy
manager
price_category
rate_per_hour
first_day_pro
last_day_pro
ckey
FROM zpm_emp_item_det
INTO CORRESPONDING FIELDS OF TABLE lt_project.
LOOP AT lt_project INTO ls_project.
ENDLOOP.
SELECT projectid project_name client begin_date end_date
FROM zpm_project_det
INTO CORRESPONDING FIELDS OF TABLE lt_project_temp FOR ALL ENTRIES IN lt_project
WHERE project_name = lt_project-project_name.
LOOP AT lt_project_temp INTO ls_project_temp.
MODIFY lt_project FROM ls_project_temp TRANSPORTING
projectid project_name client begin_date end_date
WHERE project_name = ls_project_temp-project_name.
ENDLOOP.
SELECT empid
employee_name
designation
employee_type
date_of_joining
FROM zpm_emp_head_det
INTO CORRESPONDING FIELDS OF TABLE lt_project1 FOR ALL ENTRIES IN lt_project
WHERE empid = lt_project-empid.
LOOP AT lt_project1 INTO ls_project1.
MODIFY lt_project FROM ls_project1 TRANSPORTING
empid
employee_name
designation
employee_type
date_of_joining
WHERE empid = ls_project1-empid.
ENDLOOP.
tell user what is going on
call function 'SAPGUI_PROGRESS_INDICATOR'
exporting
PERCENTAGE = 0
text = text-007
exceptions
others = 1.
start Excel
create object h_excel 'EXCEL.APPLICATION'.
perform err_hdl.
set property of h_excel 'Visible' = 1.
perform err_hdl.
tell user what is going on
call function 'SAPGUI_PROGRESS_INDICATOR'
exporting
PERCENTAGE = 0
text = text-008
exceptions
others = 1.
get list of workbooks, initially empty
call method of h_excel 'Workbooks' = h_mapl.
perform err_hdl.
add a new workbook
call method of h_mapl 'Add' = h_map.
perform err_hdl.
tell user what is going on
call function 'SAPGUI_PROGRESS_INDICATOR'
exporting
PERCENTAGE = 0
text = text-009
exceptions
others = 1.
output column headings to active Excel sheet
perform fill_cell using 1 1 1 'Project ID'(001).
perform fill_cell using 1 2 1 'Emp ID'(002).
perform fill_cell using 1 3 1 'Project Name'(003).
perform fill_cell using 1 4 1 'Client'(004).
perform fill_cell using 1 5 1 'Begin Date'(005).
perform fill_cell using 1 6 1 'End Date'(006).
perform fill_cell using 1 7 1 'Role of Employee'(007).
perform fill_cell using 1 8 1 'Module / Competancy'(008).
perform fill_cell using 1 9 1 'Employee name'(009).
perform fill_cell using 1 10 1 'Price Category'(010).
perform fill_cell using 1 11 1 'Rate P/H'(011).
perform fill_cell using 1 12 1 '1st day in project'(012).
perform fill_cell using 1 13 1 'Last day in project'(013).
perform fill_cell using 1 14 1 'Currency'(014).
perform fill_cell using 1 15 1 'Manager'(015).
perform fill_cell using 1 16 1 'Emp Type'(016).
perform fill_cell using 1 17 1 'Designation'(017).
perform fill_cell using 1 18 1 'Joining Date'(018).
perform fill_cell using 1 19 1 'Last Date'(019).
loop at lt_project into ls_project.
*lt_project_excel[] = lt_project[].
endloop.
copy flights to active EXCEL sheet
h = sy-tabix + 1.
*perform fill_cell1 using h 1 0 ls_project-PROJECTID.
*perform fill_cell1 using h 2 0 ls_project-EMPID.
*perform fill_cell1 using h 3 0 ls_project-PROJECT_NAME.
*perform fill_cell1 using h 4 0 ls_project-client.
*perform fill_cell1 using h 5 0 ls_project-BEGIN_DATE.
*perform fill_cell1 using h 6 0 ls_project-END_DATE.
*perform fill_cell1 using h 7 0 ls_project-ROLE_OF_EMP.
*perform fill_cell1 using h 8 0 ls_project-COMPETANCY.
*perform fill_cell1 using h 9 0 ls_project-EMPLOYEE_NAME.
*perform fill_cell1 using h 10 0 ls_project-PRICE_CATEGORY.
*perform fill_cell1 using h 11 0 ls_project-RATE_PER_HOUR.
*perform fill_cell1 using h 12 0 ls_project-FIRST_DAY_PRO.
*perform fill_cell1 using h 13 0 ls_project-LAST_DAY_PRO.
*perform fill_cell1 using h 14 0 ls_project-CKEY.
*perform fill_cell1 using h 15 0 ls_project-MANAGER.
*perform fill_cell1 using h 16 0 ls_project-EMPLOYEE_TYPE.
*perform fill_cell1 using h 17 0 ls_project-DESIGNATION.
*perform fill_cell1 using h 18 0 ls_project-DATE_OF_JOINING.
*perform fill_cell1 using h 19 0 ls_project-LAST_WORKING_DAT.
perform fill_cell1 using h 1 0 lt_project_excel-PROJECTID.
perform fill_cell1 using h 2 0 lt_project_excel-EMPID.
perform fill_cell1 using h 3 0 lt_project_excel-PROJECT_NAME.
perform fill_cell1 using h 4 0 lt_project_excel-client.
perform fill_cell1 using h 5 0 lt_project_excel-BEGIN_DATE.
perform fill_cell1 using h 6 0 lt_project_excel-END_DATE.
perform fill_cell1 using h 7 0 lt_project_excel-ROLE_OF_EMP.
perform fill_cell1 using h 8 0 lt_project_excel-COMPETANCY.
perform fill_cell1 using h 9 0 lt_project_excel-EMPLOYEE_NAME.
perform fill_cell1 using h 10 0 lt_project_excel-PRICE_CATEGORY.
perform fill_cell1 using h 11 0 lt_project_excel-RATE_PER_HOUR.
perform fill_cell1 using h 12 0 lt_project_excel-FIRST_DAY_PRO.
perform fill_cell1 using h 13 0 lt_project_excel-LAST_DAY_PRO.
perform fill_cell1 using h 14 0 lt_project_excel-CKEY.
perform fill_cell1 using h 15 0 lt_project_excel-MANAGER.
perform fill_cell1 using h 16 0 lt_project_excel-EMPLOYEE_TYPE.
perform fill_cell1 using h 17 0 lt_project_excel-DESIGNATION.
perform fill_cell1 using h 18 0 lt_project_excel-DATE_OF_JOINING.
perform fill_cell1 using h 19 0 lt_project_excel-LAST_WORKING_DAT.
*endloop.
disconnect from Excel
*CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
EXPORTING
DOCUMENT_DATA =
PUT_IN_OUTBOX = ' '
SENDER_ADDRESS = SY-UNAME
SENDER_ADDRESS_TYPE = 'B'
COMMIT_WORK = ' '
IMPORTING
SENT_TO_ALL =
NEW_OBJECT_ID =
SENDER_ID =
TABLES
PACKING_LIST =
OBJECT_HEADER =
CONTENTS_BIN =
CONTENTS_TXT =
CONTENTS_HEX =
OBJECT_PARA =
OBJECT_PARB =
RECEIVERS =
EXCEPTIONS
TOO_MANY_RECEIVERS = 1
DOCUMENT_NOT_SENT = 2
DOCUMENT_TYPE_NOT_EXIST = 3
OPERATION_NO_AUTHORIZATION = 4
PARAMETER_ERROR = 5
X_ERROR = 6
ENQUEUE_ERROR = 7
OTHERS = 8
*IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
*ENDIF.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
free object h_excel.
perform err_hdl.
ENDMODULE. " STATUS_0100 OUTPUT
FORM FILL_CELL *
sets cell at coordinates i,j to value val boldtype bold *
form fill_cell using i j bold val.
call method of h_excel 'Cells' = h_zl exporting #1 = i #2 = j.
perform err_hdl.
set property of h_zl 'Value' = val .
perform err_hdl.
get property of h_zl 'Font' = h_f.
perform err_hdl.
set property of h_f 'Bold' = bold .
perform err_hdl.
SET PROPERTY OF h_f 'ColorIndex' = 11 .
perform err_hdl.
endform.
*& Form fill_cell1
text
-->P_H text
-->P_1 text
-->P_0 text
-->P_IT_SPFLI_CARRID text
form fill_cell1 using i j bold val.
call method of h_excel 'Cells' = h_zl exporting #1 = i #2 = j.
perform err_hdl.
set property of h_zl 'Value' = val .
perform err_hdl.
get property of h_zl 'Font' = h_f.
perform err_hdl.
set property of h_f 'Bold' = bold .
perform err_hdl.
SET PROPERTY OF h_f 'ColorIndex' = 14 .
perform err_hdl.
endform. " fill_cell1
*& Form ERR_HDL
outputs OLE error if any *
--> p1 text
<-- p2 text
form err_hdl.
if sy-subrc <> 0.
write: / 'Error in OLE-Automation:'(010), sy-subrc.
stop.
endif.
endform. " ERR_HDL
Entire excel file is displayed ,but the problem is I want to display the excel file in one shot i.e not <b>line by line</b>
Kindly suggest if there is any keyword or FM to display the contents in excel using internal table.
It should not take much time. Just by executing code , the contents of internal table should be displayed.
Helpful answers will be rewarded
Thanks,
SachinHi Kavitha,
maybe it's not sophisticated enough for your requirement, but I found function XXL_FULL_API easy to use. This will give same functionality as 'download' button in ALV-Grid display.
Regards,
Christian -
How to display internal table content to table control
hi experts
I am very new to dialog programming
I have the Internal table in a report program containing data that needs to be displayed in table control.
Can you explain in step by step.
Thanks in advance.
Regards
RajaramHi Raja
Dialog-driven programs, or any program started using a transaction code, are known as SAP transactions, or just transactions. The term "transaction" is used in several different contexts in the IT world. In OLTP (Online Transaction Processing), where several users are working in one system in dialog mode, the term "transaction" stands for a user request. In conjunction with database updates, it means a change in state in the database.
Programs with type M can only be started using a transaction code, in which an initial screen is defined. Programs with type 1 can be started either using a transaction code, or by entering the program name in one of the transactions SE38 or SA38. Screens call dialog modules in the associated ABAP program from their flow logic. Type M programs serve principally as containers for dialog modules, and are therefore known as module pools. Type 1 programs, or function modules can also switch to dialog mode by calling screens using the CALL SCREEN statement. The program code of the corresponding executable program or function pool must then contain the corresponding dialog modules.
Programs that are partially or wholly dialog-driven cannot be executed in the background. They are therefore sometimes referred to as dialog programs.
<u><b>Transaction code</b></u>
The transaction code starts a screen sequence. You create transaction codes in the Repository Browser in the ABAP Workbench or using Transaction SE93. A transaction code is linked to an ABAP program and an initial screen. As well as using a transaction code, you can start a screen sequence from any ABAP program using the CALL SCREEN statement.
<u><b>Screens</b></u>
Each dialog in an SAP system is controlled by one or more screens. These screens consist of a screen mask and its flow logic. Since the flow logic influences the program flow, screens are sometimes referred to as "dynamic programs". You create screens using the Screen Painter in the ABAP Workbench. Each screen belongs to an ABAP program.
The screen has a layout that determines the positions of input/output fields and other graphical elements such as checkboxes and radio buttons. The flow logic consists of two parts:
Process Before Output (PBO). This defines the processing that takes place before the screen is displayed.
Process After Input (PAI). This defines the processing that takes place after the user has chosen a function on the screen.
All of the screens that you call within an ABAP program must belong to that program. The screens belonging to a program are numbered. For each screen, the system stores the number of the screen which is normally displayed next. This screen sequence can be either linear or cyclic. From within a screen chain, you can even call another screen chain and, after processing it, return to the original chain. You can also override the statically-defined next screen from within the dialog modules of the ABAP program.
<u><b>GUI status</b></u>
Each screen has a GUI status. This controls the menu bars, standard toolbar, and application toolbar, with which the user can choose functions in the application. Like screens, GUI statuses are independent components of an ABAP program. You create them in the ABAP Workbench using the Menu Painter.
<b><u>ABAP Program</u></b>
Each screen and GUI status in the R/3 System belongs to one ABAP program. The ABAP program contains the dialog modules that are called by the screen flow logic, and also process the user input from the GUI status. ABAP programs that use screens are also known as dialog programs. In a module pool (type M program); the first processing block to be called is always a dialog module. However, you can also use screens in other ABAP programs, such as executable programs or function modules. The first processing block is then called differently; for example, by the runtime environment or a procedure call. The screen sequence is then started using the CALL SCREEN statement.
Dialog modules are split into PBO modules and PAI modules. Dialog modules called in the PBO event are used to prepare the screen, for example by setting context-specific field contents or by suppressing fields from the display that are not needed. Dialog modules called in the PAI event are used to check the user input and to trigger appropriate dialog steps, such as the update task.
<b><u>Passing Data Between ABAP Programs and Screens</u></b>
How are fields from ABAP programs displayed on the screen? And how is user input on the screen passed back to the ABAP program? Unlike in list programming, you cannot write field data to the screen using the WRITE statement. Instead, the system transfers the data by comparing the names of screen fields with the names of the ABAP fields in the program. If it finds a pair of matching names, the data is transferred between the screen and the ABAP program. This happens immediately before and immediately after displaying the screen.
<u><b>
Field Attributes</b></u>
For all screen fields of a dialog screen, field attributes are defined in the Screen Painter. If a field name in the screen corresponds to the name of an ABAP Dictionary field, the system automatically establishes a reference between these two fields. Thus, a large number of field attributes for the screen are automatically copied from the ABAP Dictionary. The field attributes together with data element and domain of the assigned Dictionary field form the basis for the standard functions the screen executes in a dialog (automatic format check for screen fields, automatic value range check, online help, and so on).
<u><b>Error Dialogs</b></u>
Another task of the screen processor is to conduct error dialogs. Checking the input data is carried out either automatically using check tables of the ABAP Dictionary or by the ABAP program itself. The screen processor includes the error message into the received screen and returns the screen to the user. The message may be context-sensitive, that is, the system replaces placeholders in the message text with current field contents. In addition, only fields whose contents is related to the error and for which a correction may solve the error can accept input. See also Messages on Screens.
<b>
<u>Data Consistency</b></u>
To keep data consistent within complex applications, ABAP offers techniques for optimizing database updates that operate independent of the underlying database and correspond to the special requests of dialog programming. See also Programming Database Updates.
TRANSACTION CODES
MENU PAINTER : SE 41.
SCREEN PAINTER : SE 51 .
BOTH : SE 80 .
 ONLY EXISTING PROGRAMS CAN BE VIEWED IN SE 41 , SO USE SE 38 .
CONCEPT :
STEPS :
1. GIVE TRANSACTION CODE SE 38 , CREATE A REPORT NAMED
" ZVRPRDIALOGTEST2 " . SAVE , CHECK , ACTIVATE IT .
2. THEN GIVE CODE SE 51. GIVE SAME PROGRAM NAME AS SE38 .
GIVE SCREEN NUMBER , PRESS CREATE .
3. GIVE SHORT DESCRIPTION . THEN CLICK ELEMENT LIST .
4. THE SCREEN COMES , TYPE " OKCODE " .
5. CLICK FLOW LOGIC , THE SCREEN COMES .
6. one screen will come.
7. SAVE . CHECK , ACTIVATE .
8. CLICK LAYOUT . SCREN PAINTER SCREEN COMES .
9. PRESS " F6 " . TYPE TABLE NAME , PRESS ENTER . THE SCREEN COMES .
10 . TO SELECT THE DESIRED FIELDS , CLICK THE " TO SELECT " AREA IN
EACH ROW , PRESS ENTER .
11 . AFTER CLICKING , PRESS ENTER .
12. THE FINAL SELECTION WIL COME
13 . GIVE THE NESSARY BUTTONS IN THE SCREEN PAINTER .
14 . DOUBLE CLICK IN EACH BUTTON GIVE LABLE , FUNCTION CODE .
15 . THE FINAL SCREEN WIL COME
16 . SAVE . CHECK .ACTIVATE. TO CHECK SCREEN PRESS F8.
17 . TO WRITE CODING : PRESS FLOW LOGIG .
18 . THE SCREEN COMES .
19 . DOUBLE CLICK FIRST EVENT ( MODULE STATUS _ 3000 ).
20 . PBO MODULE WINDOW COMES , PRESS TICK MARK .
21 . EDITOR COMES . SAVE .
TYPING PROGRAM IN THE EDITOR
Steps :
THE EDITOR WILL BE AS SHOWN ABOVE , NOW TYPE THE FOLLOWING CODE .
NOTE :
BEFORE TYPING CODE : TAKE COMMENTS FROM , THEN TYPE LIKE :
SET PF_STATUS ' PRSTATUS '
SET TITLEBAR 'PRTITLE' .
*& Module STATUS_3000 OUTPUT
* text
TABLES : ZVTIKFS.
DATA BEGIN OF INT_TAB OCCURS 0.
INCLUDE STRUCTURE ZVTIKFS.
DATA END OF INT_TAB.
DATA OKCODE LIKE SY-UCOMM.
DATA INDEX TYPE I VALUE 1.
* MODULE STATUS_3000 OUTPUT *
MODULE STATUS_3000 OUTPUT.
SET PF-STATUS 'PRSTATUS'. "COMMENTS TOOK
SET TITLEBAR 'PRTITLE1'. " COMMENTS TOOK
SELECT * FROM ZVTIKFS INTO TABLE INT_TAB.
READ TABLE INT_TAB INDEX INDEX.
ZVTIKFS-NAME = INT_TAB-NAME.
ZVTIKFS-ADDRESS = INT_TAB-ADDRESS.
ZVTIKFS-PHONE = INT_TAB-PHONE.
ZVTIKFS-AREA = INT_TAB-AREA.
ENDMODULE. " STATUS_3000 OUTPUT
*& Module USER_COMMAND_3000 INPUT
* text
MODULE USER_COMMAND_3000 INPUT.
CASE OKCODE.
WHEN 'INS'.
INSERT ZVTIKFS.
WHEN 'DEL'.
DELETE ZVTIKFS.
WHEN 'PRE'.
INDEX = INDEX - 1.
IF INDEX < 1.
INDEX = 1.
ENDIF.
WHEN 'NEX'.
INDEX = INDEX + 1.
IF INDEX > SY-DBCNT.
INDEX = SY-DBCNT.
ENDIF.
WHEN 'EXI'.
LEAVE PROGRAM.
ENDCASE.
ENDMODULE. " USER_COMMAND_3000 INPUT
NEXT :
SAVE , CHECK , ACTIVATE .
TO COME TO DESIGN MENU
<b>STEPS :</b>
1 . TRANSACTION CODE : SE 80 . OBJECT NAVIGATOR WINDOW COMES .
NOTE : IF YOUR REOORT DOSENOT COME DO THE FOLLOWING PROCESS
<u><b>Vey useful link:</b></u>http://sap.mis.cmich.edu/sap-abap/abap09/index.htm
<u><b>Other links:</b></u>
http://help.sap.com/saphelp_nw2004s/helpdata/en/fc/eb2d40358411d1829f0000e829fbfe/content.htm
http://help.sap.com/saphelp_nw04/helpdata/en/10/e7dbde82ba11d295a40000e8353423/content.htm
<u><b>For Screens</b></u>
http://help.sap.com/saphelp_47x200/helpdata/en/e4/2adbef449911d1949c0000e8353423/content.htm
<u><b>Screen elements</b></u>
http://help.sap.com/saphelp_47x200/helpdata/en/47/e07f5f2b9911d2954f0000e8353423/content.htm
<u><b>Processing Screens</b></u>
http://help.sap.com/saphelp_47x200/helpdata/en/47/e07f682b9911d2954f0000e8353423/content.htm
<u><b>Complex Screen elements</b></u>
http://help.sap.com/saphelp_47x200/helpdata/en/fd/02da2a61d811d295750000e8353423/content.htm
<b><u>DIALOG Programming</u></b>
http://help.sap.com/saphelp_webas630/helpdata/en/9f/db9cdc35c111d1829f0000e829fbfe/content.htm
http://www.sapdevelopment.co.uk/dialog/dialoghome.htm
http://www.sap-img.com/
http://help.sap.com/saphelp_46c/helpdata/en/08/bef2dadb5311d1ad10080009b0fb56/content.htm
http://www.sapgenie.com/links/abap.htm
http://help.sap.com/saphelp_nw04/helpdata/en/c9/5472fc787f11d194c90000e8353423/frameset.htm
http://help.sap.com/saphelp_47x200/helpdata/en/52/670ba2439b11d1896f0000e8322d00/frameset.htm
http://www.allsaplinks.com/dialog_programming.html
http://sap.mis.cmich.edu/sap-abap/abap09/
http://www.sapdevelopment.co.uk/dialog/dialoghome.htm
http://help.sap.com/saphelp_webas630/helpdata/en/9f/db9cdc35c111d1829f0000e829fbfe/content.htm
http://sap.mis.cmich.edu/abap-00/
http://www.allsaplinks.com/files/using_table_in_screen.pdf
http://help.sap.com/saphelp_46c/helpdata/en/08/bef2dadb5311d1ad10080009b0fb56/content.htm
http://www.sapgenie.com/links/abap.htm
http://help.sap.com/saphelp_nw04/helpdata/en/c9/5472fc787f11d194c90000e8353423/frameset.htm
http://www.sapdevelopment.co.uk/dialog/dialoghome.htm
http://help.sap.com
http://www.sapgenie.com/abap/example_code.htm
http://help.sap.com/saphelp_47x200/helpdata/en/52/670ba2439b11d1896f0000e8322d00/frameset.htm
http://www.allsaplinks.com/dialog_programming.html
http://www.sapbrain.com/TUTORIALS/default.html
http://www.sappoint.com/abap/spmp.pdf
http://sappoint.com/abap.html
http://www.sap-img.com/abap.htm
http://sap.ittoolbox.com/code/archives.asp?i=10&t=450&a=t
http://www.sapdevelopment.co.uk/dialog/dialoghome.htm
http://www.sap-img.com/abap/
http://www.sapdevelopment.co.uk/dialog/dialoghome.htm
http://www.sap-img.com/
http://www.sappoint.com/faq/faqdiapr.pdf
http://www.allsaplinks.com/dialog_programming.html
Reward all helpfull answers
Regards
Pavan -
Internal table oerations using for all entries
Hi folks
I want to display an output of
SO number, SO Date( from VBAK) ,
SO Item, SO item category (from VBAP) ,
MAterial no., MAt type (from MARA)
Using 3 internal tables for each table fields and applying FOR ALL ENTRIES and populating a final output table say I_output.
Can u please give me a SAMPLE CODE on this.
I wont forget to reward points
Regards,RAMhi
pls see the following code...
DATA: BEGIN OF it_vbak OCCURS 0,
vbeln TYPE vbeln,
erdat TYPE sy-datum,
END OF it_vbak,
BEGIN OF it_vbap OCCURS 0,
vbeln TYPE vbeln,
posnr TYPE posnr,
matnr TYPE matnr,
pstyv TYPE pstyv,
END OF it_vbap,
BEGIN OF it_mara OCCURS 0,
matnr TYPE matnr,
mtart TYPE mtart,
END OF it_mara,
BEGIN OF it_final OCCURS 0,
vbeln TYPE vbeln,
erdat TYPE sy-datum,
posnr TYPE posnr,
matnr TYPE matnr,
pstyv TYPE pstyv,
mtart TYPE mtart,
END OF it_final.
SELECT vbeln erdat INTO TABLE it_vbak FROM vbak.
IF NOT it_vbak[] IS INITIAL.
SELECT vbeln posnr matnr pstyv INTO TABLE it_vbap FROM vbap
FOR ALL ENTRIES IN it_vbak WHERE vbeln = it_vbak-vbeln.
IF NOT it_vbap[] IS INITIAL.
SELECT matnr mtart INTO TABLE it_mara FROM mara
FOR ALL ENTRIES IN it_vbap WHERE matnr = it_vbap-matnr.
ENDIF.
ENDIF.
LOOP AT it_vbak.
MOVE-CORRESPONDING it_vbak TO it_final.
LOOP AT it_vbap WHERE vbeln = it_vbak-vbeln.
READ TABLE it_mara WITH KEY matnr = it_vbap-matnr.
MOVE-CORRESPONDING it_vbap TO it_final.
MOVE-CORRESPONDING it_mara TO it_final.
APPEND it_final.
ENDLOOP.
ENDLOOP.
thx
pavan
**pls reward for helpful answers -
REUSE_ALV_LIST_DISPLAY does not display internal table contents
Hi,
Im having a weird problem at my hand. Im using the function module REUSE_ALV_LIST_DISPLAY to display a basic list. I have the contents in an internal table. I have built a field catalog and its working fine. Im passing the internal table to the FM, but in the output I can't see any of the table entries.
Im new to ALV programming. Please guide me in this regard. Also I would be thankful, if I could be provided with some links for learning more about 'ALV Lists'.Hi,
Check out whether the data is present in the intenaltable or not. Try to debug ur program where it is not processing.
If the problem persists try to post ur code in this thread. Let me check it.
ALV programs.
http://www.geocities.com/mpioud/Abap_programs.html
. How do I program double click in ALV?
http://www.sapfans.com/forums/viewtopic.php?t=11601
http://www.sapfans.com/forums/viewtopic.php?t=23010
How can I use ALV for reports that are going to be run in background?
http://www.sapfans.com/forums/viewtopic.php?t=83243
http://www.sapfans.com/forums/viewtopic.php?t=19224
ALV
http://www.sapfans.com/forums/viewtopic.php?t=58286
http://www.sapfans.com/forums/viewtopic.php?t=76490
http://www.sapfans.com/forums/viewtopic.php?t=20591
http://www.sapfans.com/forums/viewtopic.php?t=66305 - http://www.sapgenie.com/abap/reports.htm
http://www.allsaplinks.com/material.html
http://www.sapdevelopment.co.uk/reporting/reportinghome.htm
http://wiki.ittoolbox.com/index.php/Code:Ultimate_ALV_table_toolbox
ALV
1. Please give me general info on ALV.
http://www.sapfans.com/forums/viewtopic.php?t=58286
http://www.sapfans.com/forums/viewtopic.php?t=76490
http://www.sapfans.com/forums/viewtopic.php?t=20591
http://www.sapfans.com/forums/viewtopic.php?t=66305 - this one discusses which way should you use - ABAP Objects calls or simple function modules.
2. How do I program double click in ALV?
http://www.sapfans.com/forums/viewtopic.php?t=11601
http://www.sapfans.com/forums/viewtopic.php?t=23010
3. How do I add subtotals (I have problem to add them)...
http://www.sapfans.com/forums/viewtopic.php?t=20386
http://www.sapfans.com/forums/viewtopic.php?t=85191
http://www.sapfans.com/forums/viewtopic.php?t=88401
http://www.sapfans.com/forums/viewtopic.php?t=17335
4. How to add list heading like top-of-page in ABAP lists?
http://www.sapfans.com/forums/viewtopic.php?t=58775
http://www.sapfans.com/forums/viewtopic.php?t=60550
http://www.sapfans.com/forums/viewtopic.php?t=16629
5. How to print page number / total number of pages X/XX in ALV?
http://www.sapfans.com/forums/viewtopic.php?t=29597 (no direct solution)
6. ALV printing problems. The favourite is: The first page shows the number of records selected but I don't need this.
http://www.sapfans.com/forums/viewtopic.php?t=64320
http://www.sapfans.com/forums/viewtopic.php?t=44477
7. How can I set the cell color in ALV?
http://www.sapfans.com/forums/viewtopic.php?t=52107
8. How do I print a logo/graphics in ALV?
http://www.sapfans.com/forums/viewtopic.php?t=81149
http://www.sapfans.com/forums/viewtopic.php?t=35498
http://www.sapfans.com/forums/viewtopic.php?t=5013
9. How do I create and use input-enabled fields in ALV?
http://www.sapfans.com/forums/viewtopic.php?t=84933
http://www.sapfans.com/forums/viewtopic.php?t=69878
10. How can I use ALV for reports that are going to be run in background?
http://www.sapfans.com/forums/viewtopic.php?t=83243
http://www.sapfans.com/forums/viewtopic.php?t=19224
11. How can I display an icon in ALV? (Common requirement is traffic light icon).
http://www.sapfans.com/forums/viewtopic.php?t=79424
http://www.sapfans.com/forums/viewtopic.php?t=24512
12. How can I display a checkbox in ALV?
http://www.sapfans.com/forums/viewtopic.php?t=88376
http://www.sapfans.com/forums/viewtopic.php?t=40968
http://www.sapfans.com/forums/viewtopic.php?t=6919
Go thru these programs they may help u to try on some hands on
ALV Demo program
BCALV_DEMO_HTML
BCALV_FULLSCREEN_DEMO ALV Demo: Fullscreen Mode
BCALV_FULLSCREEN_DEMO_CLASSIC ALV demo: Fullscreen mode
BCALV_GRID_DEMO Simple ALV Control Call Demo Program
BCALV_TREE_DEMO Demo for ALV tree control
BCALV_TREE_SIMPLE_DEMO
BC_ALV_DEMO_HTML_D0100
Regards,
Priyanka. -
New page in smart form when displaying internal table data in table
Hi ,
My requirement in smartform is like
I'm using the tables to display the internal table data in main window .
based on SORTF field in the internal table ,when SORTF field value changes all the related to that SORTF value should be displayind in the new page.
Please anybody tell me that , how to do this?
Thanks
NaveenHi Navi,
Try this Logic.
1) Go to Smartform,
2) Declare a flag variable w_flag type c
3)Go to Main Window
a) Go to table
b) Create one more Table Line
c) Create a CODE Line in that.
write inside CODE as Below:-
CLEAR: w_flag.
ON CHANGE OF w_final-sortf.
w_flag = 'X'.
ENDON.
d) Create one COMMAND Under CODE line created above.
click on check Box "Go to New Page" ( Page1 or Page2 or give as reqd ).
click on conditions tabe of COMMAND
write: w_flag = 'X'.
Hope this will work
Reward Points if Useful
regards
Avi.............
Maybe you are looking for
-
How to find a program which modifies the variant of a standard program?
Hi, I have an issue where the variant values of the standard program RKEVEXT3 (Transaction : KEFC), is getting changed by a background job.I need to find the program which modifies the values of the variant. Any input on this will be helpful. Regards
-
Database Control in Oracle 10g
hello eveybody i have got oracle10g installed on windows 2003 machine.i have two instances of oracle and two databases.now from the Database Control i am able to login to the default instance i.e ORCL. now i want to login to the other instance that i
-
USE OF PARAMETERS IN DISCOVERER
Hi, from El Salvador my question is? in a query that have parameters, when customize the parameters, how can put TO_DATE(SYSDATE)-1 in default value ?
-
VCast Ad on usb connection - Any way to stop it?
I've had my Incredible a couple of weeks now and generally love it. Just one issue that is really bugging me: How can you stop it opening a browser window with the VCast Media Manager ad every time you connect the usb?! I even downloaded the wretch
-
Is there a group policy that doesn't allow users to upgrade IE? We would like all users to use IE 10