Problem while processing internal table
Hi ,
I have to read 2 line item of same invoice no
for eg.
IN_NO ! MAT ! AMT
XYZ ! MAT1 ! 125
XYZ ! MAT2 ! 325
In o/p its display only 325 for both line items
I used this statement for readiing..
loop at i_final
loop at i_itab1 where knumv = i_final-knumv.
move i_itab1-kwert to i_vbtab-comm .
clear i_itab1-kwert.
endloop.
endloop.
In debuging i have determine that both first line item
amt is coming in header line but while coming in body.
I become the second line item amt
Can any one help me
You still are not MODIFYing the table if you intend to write it later
loop at i_final
loop at i_itab1 where knumv = i_final-knumv.
move i_itab1-kwert to i_final-comm .
* clear i_itab1-kwert. "<== No need for this at all
endloop.
endloop.
Additionally, you're moving to your primary loop table. Never going to see two for it unless you write to a 3rd table or
replace the CLEAR with a WRITE:/ .......
Edited by: Paul Chapman on May 14, 2008 10:35 AM
Similar Messages
-
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 -
Problem while exporting internal table to memory id using EXPORT
Hi friends,
Iam facing a following problem.
I have 4 line items in my va01 tcode.
now when i give material number and quantity and hit enter the processing for that line item starts.
iam moving that current line item to a internal table lt_vbap in userexit_check_vbap.
now for the 2nd line item also i have to move to internal table lt_vbap.
but my problem is that in internal table lt_vbap iam not getting all the line items.
every time the current line item is being processed the the previous line items are being refreshed.
from lt_vbap internal table.
how can i export internal table.
code
move vbap to lt_vbap.
append lt_vbap.
export lt_vbap to memory id 'ZXYZ'.>
Prakash Pandey wrote:
> Hi Priyanka,
>
> The internal table lt_vbap will always be empty unless you import it from the Memory ID (in your case ZXYX).
>
> Use the code this way:
>
> IMPORT lt_vbap FROM MEMORY ID 'ZXYX'.
>
> move vbap to lt_vbap.
>
> append lt_vbap.
>
> export lt_vbap to memory id 'ZXYZ'.
>
> Regards,
> Prakash Pandey
The memory id shud be same in both cases -
Problem while dropping a table
Dear All,
I am facing a problem while dropping a table in Oracle 10g.
I am able to find the number of records in the table but unble to delete it.
SQL> select count(*) from merchant_audit;
COUNT(*)
30028278
SQL> drop table merchant_audit;
drop table merchant_audit
ERROR at line 1:
ORA-00942: table or view does not exist
I have to drop this table from the database. Please help.
regards,
SanthoshHi,
IS it a table ? Is it your table ?
Read this example :
sqlplus scott/*****
SQL> create table merchant_audit(col1 number);
Table created.
SQL> create public synonym merchant_audit for merchant_audit;
Synonym created.
SQL> grant select on merchant_audit to merchant;
Grant succeeded.
SQL> conn merchant/merchant
Connected.
SQL> select count(*) from merchant_audit;
COUNT(*)
0
SQL> drop table merchant_audit;
drop table merchant_audit
ERROR at line 1:
ORA-00942: table or view does not exist
SQL>
See owner into the dba_tables, and if synonym into dba_synonyms.
Nicolas.
Message was edited by:
Nicolas Gasparotto -
Problems while processing maintenance service orders - external(PM)
Hi...........
i am Praveen, fresher to SAP R/3 - PM. I am facing some problems while processing maintenance orders - external service.( IDES )
I used control key PM 03 for external servicing. as per my knowledge it should create Purchase requisition for the external processing . but instead of that it gives following message.
" Relevancy to MRP is set at 3, since order is released or activated"
If i press help it tells that
" relevancy to material planning is currently set to 3, set it to 3"
So i searched lot for the setting but i could not find that setting anywhere.
If i press enter insted of help in the first problem it gives following message
" purchase requisition cannot be generated"
If i press help button it gives message that
" Due to setting, system is trying to generate purchase requisition but you haven't maintained service package for the activity/element. maintain service package for activity/element."
so i serached this setting too but i could not find this one too.
In tab - Activity type, it gives message that
" no activity types assigned to cost centre 4220 controlling area 1000 on Dt-month-year(current date)"
SO I checked with the settings of activity type in controlling , where i assigned activity type 1410 to all cost categories by selecting cost centre category ' * '. but still i am facing same problems.
So i am requesting all of my seniors that please help me out to overcome these problems.
these problems are badly effecting my daily practise on SAP R/3.
So once again i am requesting all of my seniors please help me out.
Thanks and best regards,
Praveen Kumar K B
91-9980531794Hi praveen,
After entering PM03 control key you need to enter the services package by clicking on the "external " button at the bottom of the screen .
Here you enter the services.
You can see RES./PURC.REQ value indicator in ACT.DATA view .This value is defaulted to 3.
when you try to change it 2 you will get the same error. however you can change it to 1. (this implies the components in this order will not be available for materila planning).
you can change it to 1 and continue with creating a work order. if you want to change it to 2 you need to do a configuration setting.
regards,
prasad -
Problem while processing large files
Hi
I am facing a problem while processing large files.
I have a file which is around 72mb. It has around more than 1lac records. XI is able to pick the file if it has 30,000 records. If file has more than 30,000 records XI is picking the file ( once it picks it is deleting the file ) but i dont see any information under SXMB_MONI. Either error or successful or processing ... . Its simply picking and igonring the file. If i am processing these records separatly it working.
How to process this file. Why it is simply ignoring the file. How to solve this problem..
Thanks & Regards
Sowmya.Hi,
XI pickup the Fiel based on max. limit of processing as well as the Memory & Resource Consumptions of XI server.
PRocessing the fiel of 72 MB is bit higer one. It increase the Memory Utilization of XI server and that may fali to process at the max point.
You should divide the File in small Chunks and allow to run multiple instances. It will be faster and will not create any problem.
Refer
SAP Network Blog: Night Mare-Processing huge files in SAP XI
/people/sravya.talanki2/blog/2005/11/29/night-mare-processing-huge-files-in-sap-xi
/people/michal.krawczyk2/blog/2005/11/10/xi-the-same-filename-from-a-sender-to-a-receiver-file-adapter--sp14
Processing huge file loads through XI
File Limit -- please refer to SAP note: 821267 chapter 14
File Limit
Thanks
swarup
Edited by: Swarup Sawant on Jun 26, 2008 7:02 AM -
Need help in processing internal table
Hi all,
Im facing a problem in processing an internal table..especially with MODIFY.
The internal table is having following records.(t_vttp)
TKNUM VBELN KUNNR NAME1 LAND1
0000975179|0071004839|0000022946|HUNTSMAN APC LIMITED |SA |
0000975180|0071004845|0000022946| | |
In the above, there are two delviry documents with same customers.
The customer data is coming from different internal table.
LOOP AT t_vttp.
READ TABLE t_kna1_temp INTO wa_kna1_temp WITH KEY kunnr = t_vttp-kunnr.
IF sy-subrc = 0.
t_vttp-name1 = wa_kna1_temp-name1.
t_vttp-land1 = wa_kna1_temp-land1.
MODIFY t_vttp INDEX sy-tabix TRANSPORTING name1 land1.
ENDIF.
ENDLOOP.
Here for second record,,the customer name and country is nt getting populated to t_vttop.
Pls correct where it is going wrong.
Thanks,
PriyaHi Try the follwoing code with a little modification in your code.
LOOP AT t_vttp.
READ TABLE t_kna1_temp INTO wa_kna1_temp WITH KEY kunnr = t_vttp-kunnr.
IF sy-subrc = 0.
t_vttp-name1 = wa_kna1_temp-name1.
t_vttp-land1 = wa_kna1_temp-land1.
MODIFY t_vttp INDEX sy-tabix TRANSPORTING name1 land1.
append t_vttp.
ENDIF.
clear: wa_kna1_temp, t_vttp.
ENDLOOP
Also Please debugg your code and check if you are getting values.
also check the value of t_vttp-kunnr in debugging for the second run of your loop.
thanks
lalit -
Problem populating an internal table
Hello,
I am having a problem with filling an internal table. I cannot seem to grasp this and I struggle with this in every program. I am attaching pieces of my program so that maybe someone can help me. I have a selection screen that I populate with dates. if the dates are populated, I want to use these dates for the selection. If the dates are initial, I want to read an entry from the TVARV table and populate the dates that will used in the selection. I tried various code statements and I cannot get it to work. i get messages like "is a table without a header line and therefore has no component "LOW" or other messages similar to this. I would like that if the s_udate is populated, I could fill the tvarv table and not have to call the form.
also if anyone has some documentation on working with internal tables without header lines (I think I read in here that internal tables without header lines is the way to go ), could you please include that as well so that I could try to understand how this suppose to work
thanks in advance for the help
TYPES: BEGIN OF ty_tvarv_date,
low TYPE tvarv_val, "start date
high TYPE tvarv_val, "end date
END OF ty_tvarv_date.
TYPES: ty_t_tvarv_date TYPE STANDARD TABLE OF ty_tvarv_date INITIAL SIZE 0,
DATA it_tvarv_date TYPE STANDARD TABLE OF ty_tvarv_date INITIAL SIZE 0.
SELECTION-SCREEN BEGIN OF BLOCK a WITH FRAME TITLE text-001.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 2(22) text-002.
SELECT-OPTIONS s_udate FOR sy-datlo.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN END OF BLOCK a.
PERFORM select_date_tvarv CHANGING it_tvarv_date.
PERFORM select_data643_mseg USING it_tvarv_date
it_zfi_gl_subcontrk[]
CHANGING it_mseg643.
<b>*******************************************************************</b>
FORM select_date_tvarv CHANGING p1_it_tvarv_date TYPE ty_t_tvarv_date.
IF s_udate IS INITIAL.
SELECT low high
FROM tvarv
INTO TABLE p1_it_tvarv_date
WHERE name EQ 'Z_SUBCONTRK_DATES'.
IF sy-subrc NE 0.
IF sy-batch IS INITIAL.
MESSAGE i899 WITH text-027.
LEAVE LIST-PROCESSING.
ELSE.
MESSAGE e899 WITH text-027.
ENDIF.
ENDIF.
ELSE.
MOVE s_udate to p1_it_tvarv_date.
MOVE s_udate-low(8) to p1_it_tvarv_date-low.
MOVE s_udate-high(8) to p1_it_tvarv_date-high.
ENDIF.
ENDFORM. " FORM SELECT_DATE_TVARV
<b>*******************************************************************</b>
FORM select_data643_mseg USING p1_tvarv_date TYPE ty_t_tvarv_date
p1_zfi_gl_subcontrk TYPE ty_t_zfi_gl_subcontrk
CHANGING p1_it_mseg TYPE ty_t_mseg643.
DATA: wa_tvarv_date type ty_tvarv_date.
READ TABLE p1_tvarv_date INTO wa_tvarv_date INDEX 1.
SELECT abukrs awerks amatnr aerfmg a~erfme
akostl abwart amblnr awempf acharg akzbew algort bbudat
FROM mseg AS a INNER JOIN mkpf AS b ON amblnr EQ bmblnr
AND b~budat <= wa_tvarv_date-high
AND b~budat >= wa_tvarv_date-low
INTO TABLE p1_it_mseg
FOR ALL ENTRIES IN p1_zfi_gl_subcontrk
WHERE a~bukrs EQ p1_zfi_gl_subcontrk-bukrs_from
AND a~werks EQ p1_zfi_gl_subcontrk-werks_from
AND a~wempf EQ p1_zfi_gl_subcontrk-werks_to643
AND a~matnr EQ p1_zfi_gl_subcontrk-matnr
AND a~bwart EQ'643'.
IF sy-subrc NE 0.
IF sy-batch IS INITIAL.
MESSAGE i899 WITH text-027.
LEAVE LIST-PROCESSING.
ELSE.
MESSAGE e899 WITH text-027.
ENDIF.
ENDIF.
ENDFORM. " FORM SELECT_DATA643_MSEGIn tables with header line, you need not define an explicit work area.
System will create a so-called work area, which is called header line.
This header line is like any other work area. the difference is that it can be accessed using internal table name. A record will be by default read into header line in a READ statement.
For ex,
READ TABLE p1_tvarv_date INTO wa_tvarv_date INDEX 1.
Here you used to read the 1st record into wa_tvarv_date.
But after making it table with header line you can use
READ TABLE p1_tvarv_date INDEX 1.
This will move the data to header line and it can be accessed by name p1_tvarv_date.
See the code below.
TYPES: BEGIN OF ty_tvarv_date,
low TYPE tvarv_val, "start date
high TYPE tvarv_val, "end date
END OF ty_tvarv_date.
TYPES: ty_t_tvarv_date TYPE STANDARD TABLE OF ty_tvarv_date INITIAL SIZE 0,
DATA it_tvarv_date TYPE STANDARD TABLE OF ty_tvarv_date <b>WITH HEADER LINE INITIAL</b> SIZE 0.
SELECTION-SCREEN BEGIN OF BLOCK a WITH FRAME TITLE text-001.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 2(22) text-002.
SELECT-OPTIONS s_udate FOR sy-datlo.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN END OF BLOCK a.
PERFORM select_date_tvarv CHANGING it_tvarv_date.
PERFORM select_data643_mseg USING it_tvarv_date
it_zfi_gl_subcontrk[]
CHANGING it_mseg643.
FORM select_date_tvarv CHANGING p1_it_tvarv_date TYPE ty_t_tvarv_date.
IF s_udate IS INITIAL.
SELECT low high
FROM tvarv
INTO TABLE p1_it_tvarv_date
WHERE name EQ 'Z_SUBCONTRK_DATES'.
IF sy-subrc NE 0.
IF sy-batch IS INITIAL.
MESSAGE i899 WITH text-027.
LEAVE LIST-PROCESSING.
ELSE.
MESSAGE e899 WITH text-027.
ENDIF.
ENDIF.
ELSE.
MOVE s_udate to p1_it_tvarv_date.
MOVE s_udate-low(8) to p1_it_tvarv_date-low.
MOVE s_udate-high(8) to p1_it_tvarv_date-high.
ENDIF.
ENDFORM. " FORM SELECT_DATE_TVARV
FORM select_data643_mseg USING p1_tvarv_date TYPE ty_t_tvarv_date
p1_zfi_gl_subcontrk TYPE ty_t_zfi_gl_subcontrk
CHANGING p1_it_mseg TYPE ty_t_mseg643.
<b>READ TABLE p1_tvarv_date INDEX 1.</b>
SELECT abukrs awerks amatnr aerfmg a~erfme
akostl abwart amblnr awempf acharg akzbew algort bbudat
FROM mseg AS a INNER JOIN mkpf AS b ON amblnr EQ bmblnr
<b>AND b~budat <= p1_tvarv_date-high
AND b~budat >= p1_tvarv_date-low</b>
INTO TABLE p1_it_mseg
FOR ALL ENTRIES IN p1_zfi_gl_subcontrk
WHERE a~bukrs EQ p1_zfi_gl_subcontrk-bukrs_from
AND a~werks EQ p1_zfi_gl_subcontrk-werks_from
AND a~wempf EQ p1_zfi_gl_subcontrk-werks_to643
AND a~matnr EQ p1_zfi_gl_subcontrk-matnr
AND a~bwart EQ'643'.
IF sy-subrc NE 0.
IF sy-batch IS INITIAL.
MESSAGE i899 WITH text-027.
LEAVE LIST-PROCESSING.
ELSE.
MESSAGE e899 WITH text-027.
ENDIF.
ENDIF.
ENDFORM. " FORM SELECT_DATA643_MSEG -
Problem in convering internal table to CSV file
Hi,
Iam converting internal table data to CSV format with the code given below.
LOOP AT it_details_final INTO wa_details_final.
CLEAR : t_attachment.
CONSTANTS : c_sep TYPE c VALUE ','.
CONCATENATE wa_details_final-wf_rectype
wa_details_final-wf_bankn
wa_details_final-wf_znme1
wa_details_final-wf_rzawe
wa_details_final-wf_lifnr
wa_details_final-wf_chect
wa_details_final-wf_rwbtr
wa_details_final-wf_chkladat
cl_abap_char_utilities=>newline
INTO t_attachment SEPARATED BY c_sep.
APPEND t_attachment.
CLEAR t_attachment.
ENDLOOP.
Problem is ,data in one of the fields contain comma ( , ).
So, data after comma is getting shifted to the adjacent cell.
Please help me
Thanks & Regards,
SravanthiHello,
Try this perform
the ignorefields variable is used if you dont want a particular field in the output. You can ignore it for now
DATA: p_ignoredfields(1024).
CONSTANTS : const_sep TYPE c VALUE ','.
* itab to store data ready to be sent to csv file
DATA: BEGIN OF wa_csvdata,
line(4096),
END OF wa_csvdata.
DATA: gt_csvdata LIKE TABLE OF wa_csvdata.
*& Form CONVERT_TO_CSV
* text
FORM convert_to_csv TABLES lt_datatab USING value(p_ignoredfields).
FIELD-SYMBOLS: <wa_datatab> TYPE ANY.
FIELD-SYMBOLS: <wa_field> TYPE ANY.
* character variable incase table fields are of a diff type (ie: int)
DATA: lv_data TYPE string.
* set to X if the no data has been put into the csv workarea
DATA: flag_firstcol TYPE xflag.
* move the structure one character to the right since first char
* is position 0 in SAP
SHIFT p_ignoredfields BY 1 PLACES RIGHT.
REFRESH gt_csvdata.
CLEAR wa_csvdata.
LOOP AT lt_datatab ASSIGNING <wa_datatab>.
flag_firstcol = 'X'.
DO.
* one by one assign each position of the structure to the field
ASSIGN COMPONENT sy-index OF STRUCTURE <wa_datatab> TO <wa_field>.
IF sy-subrc <> 0.
EXIT.
ELSE.
* if the current field needs to be ignored then continue the do loop
IF p_ignoredfields+sy-index(1) = '.'.
CONTINUE.
ENDIF.
* we use lv_data since concatenate fails for integer types
lv_data = <wa_field>.
* remove commas in the data
WHILE sy-subrc = 0.
REPLACE const_sep WITH '' INTO lv_data.
ENDWHILE.
* if this data belongs to the first non ignored column
IF flag_firstcol = 'X'.
wa_csvdata = lv_data.
flag_firstcol = ''.
ELSE.
CONCATENATE wa_csvdata const_sep lv_data INTO wa_csvdata.
ENDIF.
ENDIF.
ENDDO.
APPEND wa_csvdata TO gt_csvdata.
CLEAR wa_csvdata.
ENDLOOP.
ENDFORM. " CONVERT_TO_CSV -
Problem in returning internal table from FM in ABAP Objects
Hi All,
I have to return an internal table from one of the FM i created in the controller class (_IMPL) of a view.
The problem here is, the internal table i m getting here
is of type to a structure!.
but i have to return it as type ref to DATA, which cant be assigned directly.
Now, my question is.. How can i convert ..
internal table type structure
to
internal table type ref to DATA.
Thanks and Regards,
sudeep v d.Hi Sudeep.
Can you see if something like this works for you?
DATA: dref type ref to DATA.
FIELD-SYMBOL: <fs> type ANY.
LOOP AT <internaltable> INTO <structure>
ASSIGN "<component_name>" component of <structure> TO <fs>
CREATE DATA dref type <structure>.
dref->* = <fs>.
ENDLOOP. -
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 -
Problem in the internal table of open dataset statement
Hi abapers,
I am using the open dataset command to download my file at application server into an internal table.
But some colums of the internal table are string since i do not want to truncate any of the long text present in the file.
The open dataset command does not allow the internal table to have string components.
Is there any workaround by which i can download all the text components of the file without truncating them .
Regards,
Adityatry to use field symbols:-
FORM download_file .
DATA: l_file TYPE rlgrap-filename,
l_line TYPE string.
DATA: v_excel_string(1000) TYPE c,
v_len TYPE i,
v_zover TYPE i .
FIELD-SYMBOLS: <f> TYPE ANY .
CLEAR wa_fin.
*--- Seting File path
CONCATENATE p_cfile v_file sy-datum INTO l_file.
*--- Open data set
OPEN DATASET l_file FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
IF sy-subrc = 0.
LOOP AT it_down INTO wa_down.
CLEAR : v_excel_string, v_zover, v_len.
DO.
ASSIGN COMPONENT sy-index OF STRUCTURE wa_down TO <f>.
IF sy-subrc <> 0.
EXIT. "exits do loop and process next record in itab
ENDIF.
DESCRIBE FIELD <f> LENGTH v_len IN CHARACTER MODE.
v_excel_string+v_zover(v_len) = <f> .
v_zover = v_zover + v_len .
ENDDO.
TRANSFER v_excel_string TO l_file.
CLEAR : v_excel_string,
wa_down ,
v_zover .
ENDLOOP.
*--- Close data set
CLOSE DATASET l_file.
IF sy-subrc = 0.
*--- Success Message
MESSAGE s000(000) WITH text-018.
ENDIF.
ELSE.
*--- Error unable to open file.
MESSAGE e000(000) WITH text-017.
ENDIF.
ENDFORM. " DOWNLOAD_FILE
Thanks ,
Ruchi Tiwari -
Problem in declaring internal table
hai experts ,
i am new to web dynpro abap .. my problem is i want to declare a internal table for a table using the web dynpro code wizard .. i found many threads regarding that .. but for mee its not working .. many of them posted that get_static_attributes_table method will solve the problem .. but i used the method in the wizard but it saying that method does not exist ..pls solve the problem ..
say where to enter the method in the wizard ..
thanks & kind regards
chinnaiyaHi Chinnaiya,
Your post isnt that clear as to what you intend to do. Do you intend to just create an internal table declaration which would be able to hold your context nodes data or do you wish to use the get_static_attributes method to fetch all your tables data into this internal table?
If you want to just declare an internal table which can hold the data then you would have to do it manually. You can't generate your internal table declaration using the code wizard. Suppose your context nodes name is SFLIGHT then you can use the below syntax to declare a table & work area respectively.
DATA: lt_sflight TYPE wd_this->elements_sflight, " Internal table
wa_sflight TYPE wd_this->element_sflight. " Work area
For each node <node> of a controller context, a structure type element_<node> is implicitly generated in the interface IF_<ctrl>. The structure fields correspond to the attributes a node element consists of. Similarly for each node <node> of a controller context, a standard table type elements_<node> is implicitly generated in the interface IF_<ctrl>. The line type of this table is element_<node>. This constant can be used to
type an internal table that can hold the attributes of multiple node elements. So as how said here you can even declare the work area and internal table like shown below in your MAIN view:
DATA: lt_sflight TYPE if_main=>elements_sflight, " internal table
wa_sflight TYPE if_main=>element_sflight. " work area
But the disadvantage of this approach as how pointed out by Thomas in 1 of this earlier threads is that this coding works fine only for this particular view. If you copy the same code and try to use it in another view say VIEW1 then it wouldn't work as the interface name would have changed from if_main to if_view1. So its suggested to use the earlier approach.
Regards,
Uday -
Missing records while downloading internal table to excel because of ' " '
Friends...
I am trying to download the contents of an internal table to an excel file.
Now i tried to download the contents in debugging mode. I noticed there is this character " in one of the fields of my internal table, and i came to know, that presence of such special characters results in the internal table not getting exaclty downloaded to excel format.
Is there any way to solve this problem. I thought of removing the field itself from the internal table but, thats not possible. Its mandatory to have that field in the table.
Regards.Well.. by doing so.. the number of records etc is comin correctly, but the field in which the special character " is present, will be shown without " right.... so.. infact... the output is incorrect ....
I am sorry, i cant share the file because of security reasons.. -
Hi friends/experts,
My case is:
1. A dialog screen 100 to display/ update some fields of an internal table itab, Records are processed one by one on the screen
2. Need UPDATE, DELETE, PREV. NEXT buttons to process records.
I have made the screen with fields and buttons. What I like to know is how to code DELETE, PREV. and NEXT buttons. Could you kindly provide a sample to do that?
Thanks.
YuHi,
check this sample code..
***Create a global variable for storing the current index that is getting displayed..
***I am assuming V_CURRENT_INDEX TYPE SYINDEX.
CASE SY-UCOMM.
WHEN 'NEXT'.
INcrement the index.
V_CURRENT_INDEX = V_CURRENT_INDEX + 1.
DESCRIBE TABLE ITAB.
IF V_CURRENT_INDEX > SY-TFILL.
If the current index is greater than the number of rows.
set the sy-tfill.
V_CURRENT_INDEX = SY-TFILL.
MESSAGE S208(00) WITH 'Last record reached'.
LEAVE SCREEN.
ENDIF.
Read the internal table with the current index.
READ TABLE ITAB INDEX V_CURRENT_INDEX.
Move the values to the screen variables from the header line of ITAB.
WHEN 'PREV'.
Decrement the counter.
V_CURRENT_INDEX = V_CURRENT_INDEX - 1.
IF V_CURRENT_INDEX < 0.
If the current index is Lesser than zero set 1.
V_CURRENT_INDEX = 1.
MESSAGE S208(00) WITH 'First record reached'.
LEAVE SCREEN.
ENDIF.
Read the internal table with the current index.
READ TABLE ITAB INDEX V_CURRENT_INDEX.
Move the values to the screen variables from the header line of ITAB.
ENDCASE.
Thanks,
Naren
Maybe you are looking for
-
Dear sir, i used this apple id in my IPAD 4,But some how i forgot the apple id password that was stored in my iPad. i reset the same in my another device. I put the new password in my I pad. Due to mismatching of password that was stored in iPad and
-
After filling out my complete acct info in iTunes Store in order to purchase an album that exceeds the amt of my credit from a gift card, I am prompted to check with the customer support for iTunes, and it will not simply charge my credit card that I
-
Playing SWF files in FLV Player
Hi, I would like to know whether swf files can play in an FLV Player or not. If not possible, is there any option for developing an independent swf player. If so, please tell me the technique that can be used to develop swf player. Reg
-
Issue in Production Support Due to FLAT-FILE
Hi friends, Good morning to every one!!! I got an issue from end user.. He was having an issue for a particular reoprt that his report values are not matched for R/3 values it seems... In his report selection, the selections are.
-
Pdf conversion--unknown characters
Hi All, I am trying to convert internal table to pdf fomrat. I have used RSPO_OPEN_SPOOLREQUEST , RSPO_WRITE_SPOOLREQUEST , RSPO_CLOSE_SPOOLREQUEST and finally CONVERT_ABAPSPOOLJOB_2_PDF. There is a table PDF in CONVERT_ABAPSPOOLJOB_2_PDF .But , w