How to get data to internal table from function module tr_inspect_objects
How to get data from funtion module to an internal table .
function module name is tr_inspect_objects(code inspectore se10)
how top collect all task request data into one internal table using this fm or we have to create another fm .
If you have already made FM please give us the code .
Hi,
You can use tables E070 or E071 to get data into your internal tables instead of a function module.
Hope this helps.
BR
Dep
Similar Messages
-
Function module to get data into internal table from Excel file sheets
Hi,
I have to upload customers from excel file.
we are donloading customer data excel file sheets.
Customer data in 1 sheet, tax data the other sheet of same excel file, Customer master-Credit data in other sheet of same excel file.
so i have 3-4 sheet in one excel file.
now my requirement is to get the data from excel file into internal table.
is there any function module.
Thanks & RegardsI am sending you the idea with an example how you can upload data from an EXCEL file into an internal table. I am not sure if you can take data from different sheet in the same EXCEL file. I think that this is not possible (try it )
Upload the data into an internal table, like the way that I am describing in the above:
DATA: L_MAX_COL_NB TYPE I.
DATA: l_file_name LIKE RLGRAP-FILENAME.
Just to be sure that is the correct type for the FM.
l_file_name = P_FILE_NAME.
L_MAX_COL_NB = 58. "Maximum nb of colums that the FM can read.
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
FILENAME = l_file_name
I_BEGIN_COL = 1
I_BEGIN_ROW = 2
I_END_COL = L_MAX_COL_NB
I_END_ROW = 9999
TABLES
INTERN = PT_EXCEL
EXCEPTIONS
INCONSISTENT_PARAMETERS = 1
UPLOAD_OLE = 2
OTHERS = 3.
IF SY-SUBRC <> 0.
ENDIF.
Now you should upload the data into your own itab. The Function Module will return to you all the an itab
from all fields and columns. Define the structure of the uploading file into SE11 - Data Dictionary. Then read the fieldcatalog of this structure. In the code that I am sending to you, I am insearting an empty line into the internal table and then I am assigning this line into a corresponding field-symbol. Then I am able to change the working area - so and the line of the itab. Propably you could you the statement APPEND INITIAL LINE TO (your_table_name) ASSIGNING <your_field_symbol>, but the example was written in an old SAP version.
FIELD-SYMBOLS:
<F_REC> LIKE WA_UPLOAD_FILE, "working are of the uploading file
<F_FIELD> TYPE ANY.
DATA: COLUMN_INT TYPE I,
C_FIELDNAME(30) TYPE C.
PERFORM GET_FIELDCATOLG TABLES FIELDCAT
USING 'ZECO_CHARALAMBOUS_FILE'.
LOOP AT PT_EXCEL.
AT NEW ROW.
ASSIGN WA_UPLOAD_FILE TO <F_REC>.
ENDAT.
COLUMN_INT = PT_EXCEL-COL.
READ TABLE FIELDCAT INTO WA_FIELDCAT INDEX COLUMN_INT.
CONCATENATE '<F_REC>-' WA_FIELDCAT-FIELDNAME INTO C_FIELDNAME.
ASSIGN (C_FIELDNAME) TO <F_FIELD>.
<F_FIELD> = PT_EXCEL-VALUE.
AT END OF ROW.
APPEND WA_UPLOAD_FILE TO GT_UPLOAD_FILE.
CLEAR WA_UPLOAD_FILE.
ENDAT.
ENDLOOP.
With Regards
George
Edited by: giorgos michaelaris on Mar 4, 2010 3:44 PM -
How i get data in matrix grid from A/P Invoice
How i get data in matrix grid from A/P Invoice before click add button
Hi,
Are you trying to read the data in the matrix of a system form? Then you only have to look for the matrix with the ID you can see by visualising the System Information in B1 and then directly read from the matrix cells (using columns element in matrix), the DBDataSources are not filled in until the document has been added to the database.
There are many messages in this forum talking about how to read information in matrix item, just make a search for it.
Hope it helps
Trinidad. -
How to update value in internal table from cdpos taking fname n value_new?
hello everyone,
i want to insert value in internal table from cdpos table taking field name from fname and value from value_new.but the problem is i am not getting how to map the corresponding field of internal table with fname value which is the field name.
for example
i
fieldname
value
name1
raj
name2
sharma
i want to update field name1. this name1 is there in fname with updated value in value_new how to make name1 with fname value
thanks and regards
laxmikant soniHi Laxmikant,
If I have understood your requirement correctly, you need to update an internal table with latest 'value_new' from cdpos table where 'fname' = 'fieldname' .
Hope the below logic will help you:
FIELD-SYMBOLS: <wa_intab> LIKE LINE OF lt_intab. "the internal table you want to change
LOOP AT lt_intab ASSIGNING <wa_intab> .
READ TABLE lt_cdpos INTO wa_cdpos "lt_cdpos contains latest data selected from CDPOS
WITH KEY fname = <wa_intab>-fieldname.
IF sy-subrc = 0.
<wa_intab>-value = wa_cdpos-value_new.
ELSE.
"//logic if the name is not there in CDPOS
ENDIF.
CLEAR wa_cdpos.
ENDLOOP.
If you wish to improve performance, I suggest using
1. "transporting value_new" addition in READ TABLE,
2. select only the data which you require from CDPOS,
3. create the internal tables with only fields which you require,
4. when you are using SELECT,LOOP AT statements, limit records by using WHERE condition
Regards,
Kavya -
How to Get data into I_ table which is Created dynamically
Hi Guys ,
I created one dynamic internal table , now I am want to display same internal table in my ALV? , how can I populate data into this internal table from my internal table based on some condition.
My Requirement is?
I have to display like this
1.This is my heading (field_cat of my ALV in which pack size may varry based on the flavor).
Plant flavor pack_size1----
pack_size-n
2. I have internal table( itab2) with all the pack-sizes and plant details.
3. how can I pass the these data into (itab1) which going to display in ALV ?
I can loop at itab2.
How to pass this data into itab1 relevent fields ?
Looking for Val. Inputs
With Best Regards
Prabhu
TC-Team SAP
Pepsi India
[email protected]Hi,
This is a code snippet.
DATA: r_dyn_table TYPE REF TO data,
r_wa_dyn_table TYPE REF TO data,
l_fields_table type SOI_FIELDS_TABLE.
FIELD-SYMBOLS: <t_dyn_table> TYPE STANDARD TABLE,
<wa_dyn_table> TYPE ANY,
<w_field1> TYPE ANY,
<w_field2> TYPE ANY.
DATA: l_oref_structure TYPE REF TO cl_abap_structdescr,
l_abap_compdescr type abap_compdescr.
data: check1 type i,
check2 type i,
l_range(20).
r_dyn_table = IL_DYNDATA-r_dyn_table.
ASSIGN r_dyn_table->* TO <t_dyn_table>.
CREATE DATA r_wa_dyn_table LIKE LINE OF <t_dyn_table>.
ASSIGN r_wa_dyn_table->* TO <wa_dyn_table>.
l_oref_structure ?= cl_abap_typedescr=>describe_by_data(
wa_supl ).
loop at il_fill_itab into wa_supl.
loop at l_oref_structure->COMPONENTS into l_abap_compdescr.
ASSIGN COMPONENT l_abap_compdescr-name
OF STRUCTURE wa_supl TO <w_field1>.
check1 = sy-subrc.
ASSIGN COMPONENT l_abap_compdescr-name
OF STRUCTURE <wa_dyn_table> TO <w_field2>.
check2 = sy-subrc.
if check1 = 0 and check2 = 0.
<w_field2> = <w_field1>.
endif.
endloop.
APPEND <wa_dyn_table> TO <t_dyn_table>.
endloop.
You can access your dynamic internal table via a field symbol.
Svetlin -
How to insert data into a table from an xml document
using the XmlSql Utility, how do I insert data into a table from an xml document, using the sqlplus prompt.
if i use the xmlgen.insertXML(....)
requires a CLOB file, which i dont have, only the xml doc.
Cant i insert directly from the doc to the table?
the xmlgen examples I have seen first convert a table to a CLOB xmlString and then insert it into another table.
Isnt there any other way?Your question is little perplexing.
If you're using XML SQL Utility from
the commandline, just use putXML.
java OracleXML putXML
null -
Urgent - Append data to internal table from Application server
Hi All,
I encountered the problem while read the input file from Application server...then append it to internal table. I manage to read the input file from presentation and append the data to internal table.
Below are my coding which cause me not able the append data from Application server. Please kindly help me to solving/correct my coding. Thanks in advance .
PARAMETERS : p_inpfl LIKE rlgrap-filename. "Material Input File
SELECTION-SCREEN BEGIN OF LINE.
Application Server
SELECTION-SCREEN COMMENT 1(19) text-002 FOR FIELD rb_ux.
SELECTION-SCREEN POSITION 33.
PARAMETERS: rb_ux RADIOBUTTON GROUP g1.
Presentation Server
SELECTION-SCREEN COMMENT 40(21) text-003 FOR FIELD rb_pc.
SELECTION-SCREEN POSITION 65.
PARAMETERS: rb_pc RADIOBUTTON GROUP g1 DEFAULT 'X'.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN SKIP.
SELECTION-SCREEN END OF BLOCK b01.
FORM f_Input_file.
CLEAR: v_f_exists.
CHECK NOT p_inpfl IS INITIAL. "input file exist
IF NOT rb_pc IS INITIAL. " Pc check
PERFORM f_read_tab_delimited_file TABLES i_input
USING c_09
p_inpfl
rb_ux
CHANGING v_ifile_str_with_tab
v_f_exists
v_ifile_record_count
v_message.
IF v_f_exists EQ '1' .
UPLOAD FILE could not be read
MESSAGE e546 .
ENDIF .
IF v_ifile_record_count EQ 0 .
Zero records in upload file
MESSAGE e547 .
ENDIF.
ELSE.
OPEN DATASET p_inpfl FOR INPUT IN TEXT MODE.
DO.
READ DATASET p_inpfl INTO i_input.
IF sy-subrc EQ 0.
APPEND i_input.
ELSE.
EXIT.
ENDIF.
ENDDO.
CLOSE DATASET p_inpfl.
ENDIF.Hi,
Refere the following code for the poulating internal from the application server.
PARAMETERS : pr_sfile TYPE filename-fileintern,
Here give the logical file name from the application serevr.
data : w_param_1 LIKE filename-fileintern,
x_file(500),
w_move_file LIKE epsf-epsfilnam,
w_from_dir LIKE epsf-epsdirnam,
w_path LIKE rlgrap-filename,
input_line(1000),
w_path LIKE rlgrap-filename,
w_file LIKE rlgrap-filename,
w_dir LIKE rlgrap-filename,
w_dir1 LIKE epsf-epsdirnam,
w_file1 LIKE epsf-epsfilnam,
**************Start of the code***************
MOVE '*' TO w_param_1.
PERFORM get_file_name USING pr_sfile w_param_1.
LOOP AT it_file WHERE name CP w_file1.
CLEAR : x_file, w_path,
w_move_file, w_from_dir.
REFRESH : it_input,
it_input_err.
IF w_flag IS INITIAL.
CONCATENATE w_dir it_file-name INTO x_file.
CONDENSE x_file.
TO Move file from sever for backup storing the file name and path
w_path = x_file.
CALL FUNCTION 'TRINT_SPLIT_FILE_AND_PATH'
EXPORTING
full_name = x_file
IMPORTING
stripped_name = w_move_file
file_path = w_from_dir
EXCEPTIONS
x_error = 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.
********here it_input will be the structure of the file present on the application server
PERFORM read_file TABLES it_input
USING x_file.
CLEAR it_input_err.
REFRESH it_input.
ENDLOOP.
*******************end of the code****************
*& Form read_file
text
-->P_X_FILE text
FORM read_file TABLES it_tab
USING x_file.
OPEN DATASET x_file FOR INPUT IN TEXT MODE ENCODING DEFAULT.
IF sy-subrc NE 0.
WRITE : / text-006.
ELSE.
DO.
READ DATASET x_file INTO input_line.
IF sy-subrc = 0.
CLEAR: it_input, count.
DO.
ADD 1 TO count.
ASSIGN COMPONENT count OF STRUCTURE it_tab TO <fs>.
IF sy-subrc = 0.
SPLIT input_line AT separator INTO <fs> input_line.
ELSE.
EXIT.
ENDIF.
ENDDO.
APPEND it_tab.
ELSE.
EXIT.
ENDIF.
ENDDO.
ENDIF.
CLOSE DATASET x_file.
*& Form get_file_name
text
-->P_P_SFILE text
-->P_W_PARAM_1 text
FORM get_file_name USING p_sfile
w_param_1.
CHANGING x_file.
CALL FUNCTION 'FILE_GET_NAME'
EXPORTING
client = sy-mandt
logical_filename = p_sfile
parameter_1 = w_param_1
IMPORTING
file_name = x_file
EXCEPTIONS
file_not_found = 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.
w_path = x_file.
CALL FUNCTION 'TRINT_SPLIT_FILE_AND_PATH'
EXPORTING
full_name = w_path
IMPORTING
stripped_name = w_file
file_path = w_dir
EXCEPTIONS
x_error = 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.
w_dir1 = w_dir.
w_file1 = w_file.
CALL FUNCTION 'EPS_GET_DIRECTORY_LISTING'
EXPORTING
dir_name = w_dir1
file_mask = w_file1
TABLES
dir_list = it_file
EXCEPTIONS
invalid_eps_subdir = 1
sapgparam_failed = 2
build_directory_failed = 3
no_authorization = 4
read_directory_failed = 5
too_many_read_errors = 6
empty_directory_list = 7
OTHERS = 8.
IF sy-subrc <> 0.
WRITE : / text-006.
ENDIF.
Hope this will help you. -
How to get the final internal table after the ALV is modified?
Dear experts,
My WebDynpro application allows users to delete row, sort the column. After all this modification, I need to get the final internal table of ALV to generate a csv.file. Are there any methods to get the final interal table content of ALV?
Many thanks!
meerHi Friend ,
Please see this link for wiki of WDA Alv Hierarchy : [http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/c060fcb4-2c62-2b10-d2b2-f32407a5cc6f&overridelayout=true]
Regards, -
How to get data to excel sheet from background
Hello Experts,
I have be assigned a task where i have to find out all the reports and the variants containing a ' / '. I have written the code where i am able to scan through the entire list and get a set of reports and the variantsin the internal table. NOW i have to run the code in the background and the entire set of reports and the variants in the internal table to the excel sheet . So how do I do this? I am able to get the data in the excel sheet from the foreground using the FM GUI_download. But this FM does not work in the background.
So what should be the ideal way to do this ?
Thanks
AdityaHi,
You can write the file into Application server.
OPEN DATASET dataset FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
LOOP AT it_itab INTO wa_itab.
TRANSFER wa_itab TO dataset.
ENDLOOP.
CLOSE DATASET dataset
use CG3Y transaction to download file from app server to presentation server.
Regards
Sree -
Getting data into internal table wa_final
Hi Guys
I have change the logic for this program , I have created 2 workareas and internal table now I need help to place the data into
wa_final-max_date = wa_data-idate.
wa_final-min_date = wa_data-idate.
wa_final-max_km = wa_data-recdv.
wa_final-min_km = wa_data-recdv.
wa_final-max_hR = wa_data-recdv.
wa_final-min_hR = wa_data-recdv.
wa_final-max_lit = wa_data-recdv.
wa_final-min_lit = wa_data-recdv.
wa_final-t_max_min_km = wa_data-recdv. " min_km - max_km
wa_final-t_max_min_hr = wa_data-recdv. " min_hr - max_hr
wa_final-t_max_min_lit = wa_data-recdv. " min_lit - max_lit.
so how can I put the logic to the value please correct my program.seeing my program can anyone give some idea ?
REPORT Z_FUEL_MONTHLY_QTY LINE-SIZE 260 LINE-COUNT 75
NO STANDARD PAGE HEADING.
TABLES : equi,
equz,
imptt,
imrg,
eqkt,
iloa.
Type Declaration
*DATA: BEGIN OF ty_equi occurs 0,
equnr type equi-equnr,
END OF ty_equi.
*DATA: BEGIN of ty_eqkt occurs 0,
equnr type eqkt-equnr,
eqktx type eqkt-eqktx,
END OF ty_eqkt.
*DATA: BEGIN of ty_iloa occurs 0,
iloan type iloa-iloan,
eqfnr type iloa-eqfnr,
END OF ty_iloa.
*DATA: BEGIN of ty_imptt occurs 0,
mpobj type imptt-mpobj,
END of ty_imptt.
*DATA: BEGIN of ty_imrg occurs 0,
idate type imrg-idate,
recdv type imrg-recdv,
recdu type imrg-recdu,
END of ty_imrg.
TYPES: BEGIN OF ty_data ,
equnr type equnr, " Euipment no
eqktx type eqkt-eqktx, " Equipment Text
eqfnr type iloa-eqfnr, " Equipment Sort field
idate type imrg-idate, " Measuring Date
recdu type imrg-recdu, " Unit of measuring ='KM','L','H'
recdv type imrg-recdv, " Counter reading data
END OF ty_data.
TYPES: BEGIN OF ty_final,
equnr type equnr, " Equipment no
eqktx type eqkt-eqktx, " Equipment Text
eqfnr type iloa-eqfnr, " Equipment Sort field
min_date type imrg-idate, " Min Date
min_km type p decimals 2, " Max Km
max_km type p decimals 2, " Min km
t_max_min_km type i, " Total min_km-max_km
max_date type imrg-idate, " Max Date
min_hr type imrg-recdv, " Max hr
max_hr type imrg-recdv, " Min hr
t_max_min_hr type i, " Total min_hr-max_hr
min_lit type imrg-recdv, " Max lit
max_lit type imrg-recdv, " Min lit
t_max_min_lit type i, " Total min_lit-max_lit
fuel_con type p decimals 2, " Total_hrs / t_max_min_hr
km_l type p decimals 2, " km / L
lit_per_hr type i , " fuel comsumed / t_max_min_hr
END OF ty_final.
DATA: i_data TYPE TABLE OF ty_data, " internal table
wa_data TYPE ty_data, " work area
i_final TYPE TABLE OF ty_final, " internal table
wa_final TYPE ty_final. " work area
DATA : max_date type date ,
min_date type date,
max_km TYPE p DECIMALS 2,
min_km TYPE p DECIMALS 2,
max_hr TYPE p DECIMALS 2,
min_hr TYPE p DECIMALS 2,
max_lit TYPE p DECIMALS 2,
min_lit TYPE p DECIMALS 2,
t_max_min_km TYPE p DECIMALS 2,
t_max_min_hr TYPE p DECIMALS 2,
t_max_min_lit TYPE p DECIMALS 2.
SELECTION-SCREEN BEGIN OF BLOCK blk WITH FRAME.
SELECTION-SCREEN BEGIN OF BLOCK blk1 WITH FRAME TITLE text-001.
SELECT-OPTIONS: p_equnr FOR equi-equnr, "no-extension no intervals,
p_idate FOR imrg-idate. "NO-EXTENSION NO INTERVALS OBLIGATORY,
"p_recdu FOR imrg-recdu NO-EXTENSION NO INTERVALS ."default 'M3'" OBLIGATORY.
SELECTION-SCREEN END OF BLOCK blk1.
SELECTION-SCREEN BEGIN OF BLOCK blk2 WITH FRAME TITLE text-002.
SELECTION-SCREEN END OF BLOCK blk2.
SELECTION-SCREEN END OF BLOCK blk.
TOP-OF-PAGE.
FORMAT INTENSIFIED ON.
WRITE:/1(40) ' INVESTMENT LIMITED '.
WRITE:/50(40) ' FUEL CONSUMPTION REPORT ' CENTERED ,
2 'Page', sy-pagno.
FORMAT INTENSIFIED OFF.
WRITE:/50(40) '----
' CENTERED .
FORMAT INTENSIFIED ON.
WRITE:/2 sy-datum COLOR 3, sy-uzeit .
"WRITE:/1 S903-SPMON ."p_yearf.
ULINE.
"CENTERED.
write: /2 'Date From :'.
write: /2 'Equipment No :'.
write: /2 'Unit :'.
SKIP.
ULINE.
WRITE:/1 sy-vline,
2 'EQUIP NO', 10 sy-vline,
11 'NAME', 40 sy-vline,
41 'SORT', 60 sy-vline,
61 'MIN DATE', 74 sy-vline,
75 'MAX DATE', 87 sy-vline,
88 'MIN KM', 100 sy-vline,
101 'MAX KM' , 113 sy-vline,
114 'TOTALK', 126 sy-vline,
127 'MIN HR', 139 sy-vline,
140 'MAX HR', 152 sy-vline,
153 'TOTALH' , 167 sy-vline,
168 'MIN LIT', 180 sy-vline,
181 'MAX LIT', 193 sy-vline,
194 'TOTALL', 206 sy-vline,
207 'FUEL CON', 219 sy-vline,
220 'KM L', 232 sy-vline,
233 'LIT PER KM', 246 sy-vline.
FORMAT COLOR 3 ON.
ULINE.
END-OF-PAGE.
START-OF-SELECTION.
select a~equnr d~eqktx f~eqfnr e~idate e~recdu e~recdv
into table i_data
from equi AS a
inner join equz as b
on a~equnr = b~equnr
inner join iloa as f
on b~iloan = f~iloan
inner join imptt as c
on a~objnr = c~mpobj
inner join eqkt as d
on a~equnr = d~equnr
inner join imrg as e
on e~point = c~point
where a~equnr in p_equnr
and
e~idate in p_idate.
loop at i_data into wa_data.
CLEAR: wa_final.
READ TABLE i_final into wa_final
with key equnr = wa_data-equnr.
if sy-subrc EQ 0.
PERFORM prepare_final_rec USING'M'. " Modify Existing Record
ElSE.
PERFORM prepare_final_rec USING'A'. " Append New Record.
ENDIF.
ENDLOOP.
LOOP AT i_final into wa_final.
WRITE:/1 sy-vline,
2 wa_final-equnr , 10 sy-vline,
11 wa_final-eqktx , 40 sy-vline,
41 wa_final-eqfnr , 60 sy-vline,
61 wa_final-min_date , 74 sy-vline,
75 wa_final-max_date , 87 sy-vline,
88 wa_final-min_km EXPONENT 0 DECIMALS 2 LEFT-JUSTIFIED , 100 sy-vline,
101 wa_final-max_km EXPONENT 0 DECIMALS 2 LEFT-JUSTIFIED , 113 sy-vline,
114 wa_final-t_max_min_km EXPONENT 0 DECIMALS 2 LEFT-JUSTIFIED , 126 sy-vline,
127 wa_final-min_hr EXPONENT 0 DECIMALS 2 LEFT-JUSTIFIED , 139 sy-vline,
140 wa_final-max_hr EXPONENT 0 DECIMALS 2 LEFT-JUSTIFIED , 152 sy-vline,
153 wa_final-t_max_min_hr EXPONENT 0 DECIMALS 2 LEFT-JUSTIFIED , 167 sy-vline,
168 wa_final-min_lit EXPONENT 0 DECIMALS 2 LEFT-JUSTIFIED , 180 sy-vline,
181 wa_final-max_lit EXPONENT 0 DECIMALS 2 LEFT-JUSTIFIED , 193 sy-vline,
194 wa_final-t_max_min_lit EXPONENT 0 DECIMALS 2 LEFT-JUSTIFIED , 206 sy-vline,
207 wa_final-fuel_con EXPONENT 0 DECIMALS 2 LEFT-JUSTIFIED , 219 sy-vline,
220 wa_final-km_l EXPONENT 0 DECIMALS 2 LEFT-JUSTIFIED , 232 sy-vline,
233 wa_final-lit_per_hr EXPONENT 0 DECIMALS 2 LEFT-JUSTIFIED , 246 sy-vline.
ULINE.
endloop.
FORM prepare_final_rec USING p_mode TYPE char1.
SORT i_data BY equnr idate descending .
if wa_data-recdu = 'KM'.
max_km = wa_data-recdv.
min_km = wa_data-recdv.
endif.
if wa_data-recdu ='H'.
max_hr = wa_data-recdv.
min_hr = wa_data-recdv.
endif.
if wa_data-recdu ='L'.
max_lit = wa_data-recdv.
min_lit = wa_data-recdv.
endif.
at new equnr.
read table i_final into wa_final index sy-tabix.
write:/ wa_final-equnr, wa_final-eqktx ,wa_final-eqfnr ,wa_final-idate ,
'Min KM',min_km EXPONENT 0 DECIMALS 2 color 7 ,
'Min H',min_hr EXPONENT 0 DECIMALS 2 color 7 ,
'Min L',min_lit EXPONENT 0 DECIMALS 2 color 7.
endat.
*at end of equnr.
read table i_data into wa_data index sy-tabix.
write:/ wa_final-equnr, wa_final-eqktx ,wa_final-eqfnr ,wa_final-idate ,
'Max KM', max_km EXPONENT 0 DECIMALS 2 color 7,
'Max H', max_hr EXPONENT 0 DECIMALS 2 color 7,
'Max L', max_lit EXPONENT 0 DECIMALS 2 color 7.
*endat.
wa_final-max_date = wa_data-idate.
wa_final-min_date = wa_data-idate.
wa_final-max_km = wa_data-recdv.
wa_final-min_km = wa_data-recdv.
wa_final-max_hR = wa_data-recdv.
wa_final-min_hR = wa_data-recdv.
wa_final-max_lit = wa_data-recdv.
wa_final-min_lit = wa_data-recdv.
wa_final-t_max_min_km = wa_data-recdv. " min_km - max_km
wa_final-t_max_min_hr = wa_data-recdv. " min_hr - max_hr
wa_final-t_max_min_lit = wa_data-recdv. " min_lit - max_lit.
IF p_mode = 'A'.
wa_final-equnr = wa_data-equnr.
wa_final-eqktx = wa_data-eqktx.
wa_final-eqfnr = wa_data-eqfnr.
APPEND wa_final TO i_final.
ELSE.
MODIFY i_final FROM wa_final
TRANSPORTING
max_date
min_date
max_km
min_km
max_hr
min_hr
max_lit
min_lit
t_max_min_km
t_max_min_hr
where equnr = wa_data-equnr.
ENDIF.
ENDFORM. " PREPARE_FINAL_REC
regards;Hi
Thanks , where to use the loop and endloop.
I want individual data to go into wa_final but confused how to start to get
min date..max..date..minkm_value..maxkm_value...total min-max,
min_hr,max_hr,total diff , min_lit,max_lit, total as in the program but how the data will go according to the values in wa_final
regards
Piroz -
Regarding fetching data into internal table from D.B Tables, D.B View
Hi All,
I Have following 5 tables in my Database.
LTAP
TABNAME
FIELDNAME
KEYFLAG
LTAP
MANDT
X
LTAP
LGNUM
X
LTAP
TANUM
X
LTAP
TAPOS
X
LTAP
VLPLA
Z0MNH
TABNAME
FIELDNAME
KEYFLAG
Z0MNH
MANDT
X
Z0MNH
WERKS
X
Z0MNH
ZMANNO
X
Z0MNH
LGNUM
X
Z0MNH
AENAM
Z0MNH
BUDAT
Z0MNH
CPUTM
Z0MNH
LAEDA
Z0MNH
STATUS
Z0MNH
USNAM
Z0MNH
ZARDAT
Z0MNH
ZARTIM
Z0MNH
ZCLDAT
Z0MNH
ZCLTIM
Z0MNH
ZDPDAT
Z0MNH
ZDPTIM
Z0MNH
ZDRIVR
Z0MNH
ZINDAT
Z0MNH
ZINTIM
Z0MNH
ZLOAD
Z0MNH
ZNOTES
Z0MNH
ZPRDAT
Z0MNH
ZPRTIM
Z0MNH
ZSUPR
Z0MNH
ZTRAILR
Z3MANBOXIDHDR
TABNAME
FIELDNAME
KEYFLAG
Z3MANBOXIDHDR
MANDT
X
Z3MANBOXIDHDR
WERKS
X
Z3MANBOXIDHDR
ZMANNO
X
Z3MANBOXIDHDR
EXIDV
X
Z3MANBOXIDHDR
NLPLA
Z3MANBOXIDHDR
NLTYP
Z3MANBOXIDHDR
VLTYP
Z3MANBOXIDHDR
Z0PAL
Z3MANBOXIDHDR
Z3COMENT
Z3MANBOXIDHDR
Z3RECPT_FLAG
Z3MANBOXIDITM
TABNAME
FIELDNAME
KEYFLAG
Z3MANBOXIDITM
MANDT
X
Z3MANBOXIDITM
WERKS
X
Z3MANBOXIDITM
ZMANNO
X
Z3MANBOXIDITM
EXIDV
X
Z3MANBOXIDITM
ITEM_NO
Z3MANBOXIDITM
MATNR
Z3MANBOXIDITM
VEMEH
Z3MANBOXIDITM
VEMNG
Z3MANBOXIDITM
Z_CARTON
Z3MANBOXIDSERIAL
TABNAME
FIELDNAME
KEYFLAG
Z3MANBOXIDSERIAL
MANDT
X
Z3MANBOXIDSERIAL
WERKS
X
Z3MANBOXIDSERIAL
EXIDV
X
Z3MANBOXIDSERIAL
ZMANNO
X
Z3MANBOXIDSERIAL
ITEM_NO
Z3MANBOXIDSERIAL
SERNR
Based on all the above tables i need to fill in below internal table field as given below:
<b>Internal Table I_TAB
ZMANNO
LGNUM
WERKS
EXIDV
ITEM_NO
MATNR
SERNR
VEMNG
VEMEH
VLTYP
NLTYP
VLPLA
NLPLA
ZLOAD
USNAM
STATUS
BUDAT
CPUTM
ZINDAT
ZINTIM
ZARDAT
ZARTIM
ZCLDAT
ZCLTIM</b>
Extract data from Manifest header <b>Z0MNH, Z3MANBOXIDHDR,
Z3MANBOXIDITM, Z3MANBOXIDSER and LTAP</b> tables based on selection parameter.
Selection Screen will have folowing Select-option fields-
<b>LGNUM
WERKS
ZMANNO
USNAM
ZLOAD
EXIDV
MATNR
SERNR
VLTYP
NLTYP
VLPLA
NLPLA
BUDAT
ZINDAT
ZARDAT
ZCLDAT</b>
Based on above selection criteria i need to fetch above internal table fields data.
Then need to Move corresponding header and item data in ITAB_RESULT internal table.
I need to fetch above fields based on above 5 tables and put in final Internal Table.
Can anybody tell me the logic how can i write the same.
Also can anybody tell me i am trying to create a DataBaseView for
Z0MNH, Z3MANBOXIDHDR, Z3MANBOXIDITM, Z3MANBOXIDSERIAL and LTAP tables.
<b>Note:
1. Z3MANBOXIDITM table may contain multiple material[MATNR] for same box-id[EXIDV] (with another line item).
2. Z3MANBOXIDSERIAL table may contain multiple record for one box id[EXIDV]+item_no[ITEM_NO].</b>
But what are the <b>TABLE/JOIN Conditions</b> i need to write while creating <b>DB View</b> for above <b>5</b> tables.
Can anybody solve above 2 issues!
Thanks in advance.
Thanks,
Deep.Hi Deep,
While creation of DB view just make sure abt the key relation between the tables. Based on that u can join the tables...First fetch the data from header table then by using for all entries u can fetch the line items data.
Hope this helps you. Reply for queries, shall post the updates.
Regards.
Kumar. -
How to get data in ABAP program from multicube in external BW system
Hi friends,
I want to get data from one multicube which resides in an external BW system, in my ABAP program internal table. Is there any SAP standard RFC / BAPI for this or is there any other way around or I have to design my own program to get the data ?
To make my requirement clearer, my ABAP program is in one BW box and the above mentioned multicube in another BW box. I want to get data from the multicube into my program.
Any help is appreciated with points.Look at the following FM; you may find the FM RSDRI_INFOPROV_READ_RFC useful.
Call the FM in your program and read data and update.
RSAD_INFOCUBE_READ_REMOTE_DATA
RSDRI_INFOPROV_READ_RFC
Ravi Thothadri -
How to format data in internal table
Hi Friendz...
In a program i have transferred the data from a Excel Spread sheet (.xls file) to an internal table using FM <b>"ALSM_EXCEL_TO_INTERNAL_TABLE"</b>.
The internal table is like this:
begin of xl_data occurs 0,
vendor name
street
address
vat reg no
bank no
end of xl_data.
now i have to include some more fields to this internal table and then i have to download this data to a <b>.txt</b> file.
could you please tell me how should i do this?Please see this sample program. It will upload from excel into internal table, move data to another itab with other fields and download to C:\ drive.
report zrich_0002.
types: begin of ttab ,
fld1(30) type c,
fld2(30) type c,
fld3(30) type c,
fld4(30) type c,
fld5(30) type c,
end of ttab.
types: begin of ttab2 ,
fld1(30) type c,
fld2(30) type c,
fld3(30) type c,
fld4(30) type c,
fld5(30) type c,
fld6(30) type c,
fld7(30) type c,
end of ttab2.
data: itab type table of ttab with header line.
data: itab2 type table of ttab2 with header line.
selection-screen skip 1.
parameters: p_file type localfile default
'C:test.txt'.
selection-screen skip 1.
at selection-screen on value-request for p_file.
call function 'KD_GET_FILENAME_ON_F4'
exporting
static = 'X'
changing
file_name = p_file.
start-of-selection.
clear itab. refresh itab.
perform upload_data.
loop at itab.
clear itab2.
move-corresponding itab to itab2.
itab2-fld6 = 'Another Field'.
itab2-fld7 = 'No, really last one'.
append itab2.
endloop.
call function 'GUI_DOWNLOAD'
exporting
filename = 'C:itab2.txt'
tables
data_tab = itab2
exceptions
others = 22.
* Upload_Data
form upload_data.
data: file type rlgrap-filename.
data: xcel type table of alsmex_tabline with header line.
file = p_file.
call function 'ALSM_EXCEL_TO_INTERNAL_TABLE'
exporting
filename = file
i_begin_col = '1'
i_begin_row = '1'
i_end_col = '200'
i_end_row = '5000'
tables
intern = xcel
exceptions
inconsistent_parameters = 1
upload_ole = 2
others = 3.
loop at xcel.
case xcel-col.
when '0001'.
itab-fld1 = xcel-value.
when '0002'.
itab-fld2 = xcel-value.
when '0003'.
itab-fld3 = xcel-value.
when '0004'.
itab-fld4 = xcel-value.
when '0005'.
itab-fld5 = xcel-value.
endcase.
at end of row.
append itab.
clear itab.
endat.
endloop.
endform.
Regards,
Rich Heilman -
Req : to capture the filter data in internal table from ALV
hi friends..
i have an requirement, plz guide me to solve this..
let consider in alv grid i m displaying 10 data(10 rows)
by using filter let assume now i m getting 5 rows (from the 10 rows).
i want to capture these 5 rows in an internal table..
plz giude me to resolve this..
thanks in advance
by
selvaHi
u can think to do this programatically.
1 add one button on alv tool bar say capture.
2. filetr the requiredd rows .
3. seelct all filterd rows.
4. say capture.
5.At user command write a code to get the selcted alv rows
in different internal table.
6 you can use FM get_selected_rows for this purpose. -
Getting data into internal table as per our format
Hi friends plz go through my requirement and provide me a solution for it.
data :
wa_t343j type t343j.
start-of-selection.
select single *
into wa_t343j
from t343j
WHERE lgnum = 'XYZ' and
lgtyp = 'ABC'.
In the work area wa_t343j iam getting the following values
lgnum lgtyp ste01 ste02 ste03 st304 ste05 ste06 ste07 ste08
XYZ ABC 5 3 1 2 4
now my requiremnt is i want this value in a sepearte internal table in the below format.
data :
begin of it_temp,
index type i,
field type ltap-vlpla,
value type ltap-vlpla,
end of it_temp.
Internal table it_temp
Index field value
1 LGNUM XYZ
2 LGTYP ABC
3 STE01 5
4 STE02
9 STE07 4
10 STE08
i need those values in this format.
Thanks in advance,
Regards,
Kumar.
Edited by: satish abap on Aug 12, 2008 8:59 PMDo something like this..
Types : begin of tt_temp,
index type i,
field type char30,
value type char30,
end of tt_temp.
data: it_temp type table of tt_temp.
data: wa_temp like line of it_temp.
data: it_fieldlist type table of rstrucinfo.
data: wa_fieldlist like line of it_fieldlist.
data: lv_repid type sy-repid.
FIELD-SYMBOLS: <fs> type any.
lv_repid = sy-repid.
call function 'GET_COMPONENT_LIST'
exporting
program = lv_repid
fieldname = 'wa_t343j'
tables
components = it_fieldlist.
Loop at it_fieldlist into wa_fieldlist.
clear wa_temp.
wa_temp-index = sy-tabix.
wa_temp-field = wa_fieldlist-compname.
assign COMPONENT wa_temp-field of STRUCTURE wa_t343j to <fs>.
wa_temp-value = <fs>.
append wa_temp to it_temp.
endloop.
Regards,
Rich Heilman
Maybe you are looking for
-
Re-set i pod touch's wi-fi password
I purchased a i pod touch for my son. I wanted to charge and set up for xmas. When I plugged it into my computer for set up it linked the wi-fi to my sons account that he had when he had a nano. we do not remember the password. so now I cant downl
-
No metronome sound out of the internal speakers
Hi everybody, there's no metronome sound coming out of the internal speaker of my Mac while playback. All settings are fine (play while playback, use internal speakers, "Klopfgeist" switched off) and it worked well with the same settings in Logic Exp
-
Sales Order Account Assign to Non Billing Element
Team, Is it possible to account assign Sales Order (VA01) to Non Billing Element. My limited understanding was that only billing element WBS can be account assigned and Revenue or Billing can be done. Reg/ Tony
-
What is the flip or scroll view i have seen on firefox
when a image search comes up, the images are all in a row and flip or scroll left to right, al on a black back ground
-
Can't get rid of the red x on my iPod
I can't get my iPod to get out of the Red X mode, I've tried the tutorials to put into disk mode with no success. Any suggestions?