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,
Sachin
Hi 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
Similar Messages
-
Writing internal table contents to excel
hi,
i need to write data in my internal table to an excel spread sheet which should be similar to my internal table structure.
can someone help me out.
thanks,
ravi.Hi,
Try this one
FORM f9008_f4_hlp_for_pc_file.
DATA: li_filetable TYPE STANDARD TABLE OF file_table,
lv_return TYPE i,
lw_filetable TYPE file_table.
CALL METHOD cl_gui_frontend_services=>file_open_dialog
EXPORTING
window_title = 'Select file for download'
default_extension = '.txt'
initial_directory = 'C:'
CHANGING
file_table = li_filetable
rc = lv_return
EXCEPTIONS
file_open_dialog_failed = 1
cntl_error = 2
error_no_gui = 3
OTHERS = 4
IF sy-subrc <> 0.
MESSAGE e006 WITH text-077.
ELSE.
READ TABLE li_filetable INTO lw_filetable INDEX 1.
v_fnam = lw_filetable-filename.
ENDIF.
FORM f9007_download_file TABLES p_output.
DATA: lv_size TYPE i.
CALL FUNCTION 'WS_DOWNLOAD'
EXPORTING
filename = v_fnam
filetype = 'DAT'
IMPORTING
filelength = lv_size
TABLES
data_tab = p_output
EXCEPTIONS
file_open_error = 1
file_write_error = 2
invalid_filesize = 3
invalid_type = 4
no_batch = 5
unknown_error = 6
invalid_table_width = 7
gui_refuse_filetransfer = 8
customer_error = 9
OTHERS = 10.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDFORM. " f9007_download_file
<b>While downloading file, u wont get the header part, u have to append the header part</b>. Then u pass the final output table with header to the function module.
So that it will read the first line that will be header and then remaning data.
<i>Sample code:</i>U can create an internal table.
TYPES: begin of ty_itab ,
name(4) TYPE c,
***(3) Type c,
end of ty_itab.
DATA: i_itab type standard table of ty_itab,
w_itab type ty_itab.
Then do as below.
w_itab-name = 'NAME'.
w_itab-*** = '***'.
APPEND w_itab to i_output_final.
i_output[] = i_output_final.
APPEND i_output_final.
Now pass this final table to the functionmodule, so it is now with header.
Try this out.
Get back to me if u want any clarification. -
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. -
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 -
How to move large number of internal table data to excel by program
Hi,
Iam working on a classical report wherein my requirement is:
Have around 25 internal tables which I am displaying using a selection screen.I need to transfer this all internal tables data to Excel file by executing.
Now, let me know how can I transfer all those to excel by execution.
P.S.: GUI_DOWNLOAD or any other excel download related FMs are used to transfer for single/fewer internal tables.
But here I need to download 25 internal tables data through program.
How can I meet the requirement..?
Kindly advice.
Thanks,
Shiv.Hi,
Refer to the following code:
*& Report ZDOWNLOAD_PROGRAM
report zdownload_program.
parameter : p_path type rlgrap-filename default 'C:\Pdata.xls'.
data : gt_output type standard table of trdirt,
wa_output type trdirt,
p_filen type string.
at selection-screen on value-request for p_path.
clear p_path.
call function 'F4_FILENAME'
importing
file_name = p_path.
start-of-selection.
select * from trdirt
into table gt_output
where name like 'Z%'
or name like 'Y%'.
end-of-selection.
move : p_path to p_filen.
call function 'GUI_DOWNLOAD'
exporting
BIN_FILESIZE =
filename = p_filen
filetype = 'ASC'
APPEND = ' '
write_field_separator =
cl_abap_char_utilities=>horizontal_tab
HEADER = '00'
TRUNC_TRAILING_BLANKS = ' '
WRITE_LF = 'X'
COL_SELECT = ' '
COL_SELECT_MASK = ' '
DAT_MODE = ' '
CONFIRM_OVERWRITE = ' '
NO_AUTH_CHECK = ' '
CODEPAGE = ' '
IGNORE_CERR = ABAP_TRUE
REPLACEMENT = '#'
WRITE_BOM = ' '
TRUNC_TRAILING_BLANKS_EOL = 'X'
WK1_N_FORMAT = ' '
WK1_N_SIZE = ' '
WK1_T_FORMAT = ' '
WK1_T_SIZE = ' '
WRITE_LF_AFTER_LAST_LINE = ABAP_TRUE
IMPORTING
FILELENGTH =
tables
data_tab = gt_output
FIELDNAMES =
exceptions
file_write_error = 1
no_batch = 2
gui_refuse_filetransfer = 3
invalid_type = 4
no_authority = 5
unknown_error = 6
header_not_allowed = 7
separator_not_allowed = 8
filesize_not_allowed = 9
header_too_long = 10
dp_error_create = 11
dp_error_send = 12
dp_error_write = 13
unknown_dp_error = 14
access_denied = 15
dp_out_of_memory = 16
disk_full = 17
dp_timeout = 18
file_not_found = 19
dataprovider_exception = 20
control_flush_error = 21
others = 22
if sy-subrc <> 0.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
endif.
Regards
Rajesh Kumar -
How to download values in an internal table into an excel file
is there any fn module to download the values in an internal table into an excel file..
hi
the function module "GUI_DOWNLOAD" downloads the data from
an internal table into a file (can be xl, dat ,doc etc) .
Plz follow the usage below ;
Parameters : pa_pfile LIKE rlgrap-filename OBLIGATORY.
Data : lv_filename TYPE STRING.
lv_filename = pa_pfile.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
BIN_FILESIZE =
FILENAME = lv_filename
FILETYPE = 'ASC'
APPEND = ' '
WRITE_FIELD_SEPARATOR = 'X'
HEADER = '00'
TRUNC_TRAILING_BLANKS = ' '
WRITE_LF = 'X'
COL_SELECT = ' '
COL_SELECT_MASK = ' '
DAT_MODE = ' '
CONFIRM_OVERWRITE = ' '
NO_AUTH_CHECK = ' '
IMPORTING
FILELENGTH =
TABLES
DATA_TAB = tb_download " table data to b downlaoded
EXCEPTIONS
FILE_WRITE_ERROR = 1
NO_BATCH = 2
GUI_REFUSE_FILETRANSFER = 3
INVALID_TYPE = 4
NO_AUTHORITY = 5
UNKNOWN_ERROR = 6
HEADER_NOT_ALLOWED = 7
SEPARATOR_NOT_ALLOWED = 8
FILESIZE_NOT_ALLOWED = 9
HEADER_TOO_LONG = 10
DP_ERROR_CREATE = 11
DP_ERROR_SEND = 12
DP_ERROR_WRITE = 13
UNKNOWN_DP_ERROR = 14
ACCESS_DENIED = 15
DP_OUT_OF_MEMORY = 16
DISK_FULL = 17
DP_TIMEOUT = 18
FILE_NOT_FOUND = 19
DATAPROVIDER_EXCEPTION = 20
CONTROL_FLUSH_ERROR = 21
OTHERS = 22
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Regards
Pankaj -
Download internal table data to Excel in background
Hi all ,
Can anyone tell that how i can download internal table data
into Excel sheet in Backgroud Mode .
I used both fun mod ws and gui download but these are not working in background mod .
Please help issue is urgent .
Answer is rewarded by point .
With Regards ,
Nilesh Jainhi,
you have to use function module 'SAP_CONVERT_TO_XLS_FORMAT'.
DATA:
ITAB1 TYPE TRUXS_T_TEXT_DATA.
CALL FUNCTION 'SAP_CONVERT_TO_XLS_FORMAT'
EXPORTING
I_FIELD_SEPERATOR = ';'
I_LINE_HEADER =
i_filename = filename
I_APPL_KEEP = ' '
tables
i_tab_sap_data = itab
CHANGING
I_TAB_CONVERTED_DATA = itab1
EXCEPTIONS
CONVERSION_FAILED = 1
OTHERS = 2
*IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
*ENDIF.
try this one.
reward points if useful,
thanks & regards,
rajee. -
Downloading the internal table contents into presentation server
Hi
I have a requirement like i need to download the contetns of my internal table into an excel sheet in the presemtation server and i am using GUI_DOWNLOAD.
I would like to place my header also in the excel sheet can any one suggest me how to do that?
thanksHi,
U can see the following example,
TYPES:
BEGIN OF TYPE_S_FLIGHT,
MANDT(15) TYPE C,
CARRID(15) TYPE C,
CONNID(15) TYPE C,
FLDATE(15) TYPE C,
END OF TYPE_S_FLIGHT.
data:
T_HEADER TYPE TABLE OF TYPE_S_FLIGHT WITH HEADER LINE,
t_sflight type table of SFLIGHT.
T_HEADER-MANDT = 'MANDT'.
T_HEADER-CARRID = 'CARRID'.
T_HEADER-CONNID = 'CONNID'.
T_HEADER-FLDATE = 'FLDATE'.
APPEND T_HEADER.
PERFORM GUI_DOWNLOAD TABLES T_HEADER USING ' '.
select MANDT
CARRID
CONNID
FLDATE
from sflight into CORRESPONDING FIELDS OF table t_sflight.
PERFORM GUI_DOWNLOAD TABLES T_SFLIGHT USING 'X'.
form GUI_DOWNLOAD TABLES P_TABLE USING VALUE(P_APPEND).
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = 'C:\TEMP1\FLIGHT.XLS'
APPEND = P_APPEND
WRITE_FIELD_SEPARATOR = 'X'
tables
data_tab = P_TABLE
In this case u have to populate the one table for header. The other one is for data.
Thanks,
Nithya.
Edited by: Nithya Murugesan on Feb 8, 2009 1:00 PM -
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 -
Problem in processing internal table
Hi All,
Im facing some problem with an internal table with header.
This is Xvbkd with heaer line.
Header 100 0000000049 000010 EXW China
1 100 0000000049 000000 CIF HK
2 100 0000000049 000010 CIF HK
3 100 0000000049 000020 CIF HK
Now I want modify the internal table of 2nd record. The data above has modified in the header.but not reflected in the body.
Here is my code:
SELECT SINGLE inco1 inco2
INTO (knvv-inco1, knvv-inco2)
FROM knvv
WHERE kunnr EQ w_shipto
AND vkorg EQ vbak-vkorg
AND vtweg EQ vbak-vtweg
AND spart EQ vbak-spart.
IF sy-subrc EQ 0 AND
knvv-inco1 NE space or
knvv-inco2 NE space.
MOVE: knvv-inco1 TO wa_xvbkd-inco1,
knvv-inco2 TO wa_xvbkd-inco2.
READ table xvbkd with key vbeln = xvbap-vbeln
posnr = xvbap-posnr.
IF sy-subrc = 0.
xvbkd-inco1 = wa_xvbkd-inco1.
xvbkd-inco2 = wa_xvbkd-inco2.
modify table xvbkd from wa_xvbkd transporting inco1 inco2.
endif.
ENDIF.
Requirement: is the 2nd record(item 10) in above internal table has to reflect the change with EXW and China.
Pls help me with ur valuable suggestions.
Regards,
Priyatry,
SELECT SINGLE inco1 inco2
INTO (knvv-inco1, knvv-inco2)
FROM knvv
WHERE kunnr EQ w_shipto
AND vkorg EQ vbak-vkorg
AND vtweg EQ vbak-vtweg
AND spart EQ vbak-spart.
IF sy-subrc EQ 0 AND
knvv-inco1 NE space or
knvv-inco2 NE space.
MOVE: knvv-inco1 TO xvbkd-inco1,
knvv-inco2 TO xvbkd-inco2.
READ table xvbkd with key vbeln = xvbap-vbeln
posnr = xvbap-posnr.
IF sy-subrc = 0.
modify xvbkd index sy-tabix.
endif.
ENDIF.
Regards,
John
Edited by: jvanpelt on Jul 16, 2010 9:36 AM -
Download internal table data in excel format
Hi ,
i have a requirement where i need to download the internal table data in excel format .. I tried using the FM SAP_CONVERT_TO_XLS_FORMAT but this downloads to excel sheet same as .txt file foemat without columns ... i need to have the data in excel sheet with column heading and separated by each coulmn which should be similar as a general sheet with column names and the respective data in the columns . Appreciate any inputs .
Thanks,
Latha.Hi,
you can this in Debugging mode,
say,once you got entire data into ITAB
salect the TABLE option and provide the table name
now on the top most you can see excel icon,you click
on that,now system will prompts you for to the file to be saved.
Regards,
Vijaya. -
How to convert internal table data into excel format?
Hi all,
I want to convert internal table data in excel format and then
send it as email attachment in workflow.
Please tell me how do i perform this.
Regards,
Arpita.Hi Arpita,
Try this sample code::
Send mail
maildata-obj_name = 'TEST'.
maildata-obj_descr = 'Test Subject'.
loop at htmllines.
mailtxt = htmllines.
append mailtxt.
endloop.
mailrec-receiver = 'your receiver mail id'.
mailrec-rec_type = 'U'.
append mailrec.
call function 'SO_NEW_DOCUMENT_SEND_API1'
exporting
document_data = maildata
document_type = 'EXL'
put_in_outbox = 'X'
tables
object_header = mailtxt
object_content = mailtxt
receivers = mailrec
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.
Hope it will help you.
Regards,
NIkita -
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. -
Problem in changing the internal table contents of a standard program
Dear All,
I am making changes to internal table LT_PPDIT of standard program SAPLHRPT in the user exit EXIT_SAPLACC4_001 while payroll posting to accounting with tcode PC00_M99_CIPE. But though the changed value of LT_PPDIT is visible within the exit still the value of LT_PPDIT when we come outside exit is the same as what was before entering exit.
Please suggest is there any way of modifying internal table of a standard program in the user exit.
Regards,
KanupriyaHi,
I think the internal table is getting refreshed or something like that after the user exit.
Try debugging after the user exit and put breakpoints at clear and modify statements.
Then you ll find out where its regaining the oringinal value after getting changes.
After locating that point try finding some enhancmenent point there and including your code so that your value of internal able gets modified.
Regards,
Subhashini -
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.
Maybe you are looking for
-
Public distribution of iPad app, but not in Apple's App Store
I know we can make a Digital Publishing Suite app avalable for private distribution with an Adobe Enterprise account and an Apple Enterprise account. But we have a client who wants to make an app available to the public for download on a company web
-
How to know whether recalculate the cost of production order?
Hi Masters We know, the valuation of goods receipt is determined by the plan cost of the production order for production order. But often, production order was recalculated after partial delivery to stock. So I want to know when was
-
Hello all, I am using Netweaver 2004s with IE 7.0 . I am not able to view the options provided by EP whenever I right click on the elements of portal content , it gives me the normal browser options on right clicking . Please suggest anythin
-
I have a regular IPod I've been using with iTunes through Firewire. I bought a nano as a second player but can't get iTunes to recognize it. It's connected through USB. What am I doing wrong? Bill
-
Hey guys- i know this from e.g. joomla and so i wanted to ask, if it is possible, to get sth. like that in muse too. The Idea: Creating a ftp folder - let´s say ´Images´ - All images, that are uploaded in that folder should be screened in a muse webs