Regarding the modifying an internal table
hi,
i am having an internal table,i have to modify one field and the remaining fields should remain same in the internal table while displaying the internal table.
can any body send the solution for this issue.
thanks in advance
hi,
you can see the following logic regarding modify statement with in loop or without loop.
DATA : BEGIN OF itab OCCURS 0,
no(10) TYPE n,
name(10) TYPE c,
city(20) TYPE c,
END OF itab.
itab-no = 001.
itab-name = 'vijay'.
itab-city = 'dharmavaram'.
APPEND itab.
itab-no = 002.
itab-name = 'krishna'.
itab-city = 'dharmavaram'.
APPEND itab.
itab-no = 003.
itab-name = 'vijay'.
itab-city = 'dharmavaram'.
APPEND itab.
itab-name = 'ram1'.
MODIFY itab INDEX 3 TRANSPORTING name.
LOOP AT itab.
IF sy-tabix = 2.
itab-no = '0012'.
itab-name = 'krishna.v'.
MODIFY itab INDEX 2 TRANSPORTING no name.
CLEAR itab.
ENDIF.
ENDLOOP.
LOOP AT itab.
WRITE :/ itab-no,itab-name,itab-city.
ENDLOOP.
Hope this example will be usage for you.
Reward with points if it is useful.
Regards,
Vijay
Similar Messages
-
Regarding the modify of internal table
do 40 times varying lga from p0008-lga01 next p0008-lga02
varying bet from p0008-bet01 next p0008-bet02.
*data: bet01 type p decimals 2.
if lga is initial.
exit.
endif.
INDEX = SY-INDEX.
amt1 = bet .
*bet01 = 20 / 100.
bet = ( bet * 50 ) / 100 .
CONCATENATE ch INDEX INTO BETXX.
assign betxx to <F2>.
assign (betxx) to <F1>.
<F2> = bet.
<u>modify p0008 index INDEX transporting F1</u>
write:/ <F2>.
enddo.
*endif.
ENDCASE.
endform.
can sombody tell me how to modify the p0008 table at the place vr im having the bet01 bet02 and so on fields.
vn im using this modify statement im getting an error as
Unable to interpret "INDEX". Possible causes of error: IncorrectHi Madhvi,
When you are posting a thread, please make sure others do not find it difficult to understand. Please don't use abbreviations like "vr" and "vn".
If you need prompt responses, please ensure you describe your requirements in
a proper manner.
You are getting error because of using wrong syntax. the correct syntax is -
MODIFY <itab> FROM <wa> [INDEX <idx>] [TRANSPORTING <f1> <f 2> ... ].
The work area <wa> specified in the FROM addition replaces the existing line in <itab>. The work area must be convertible into the line type of the internal table.
If you use the INDEX option, the contents of the work area overwrites the contents of the line with index <idx>. If the operation is successful, SY-SUBRC is set to 0. If the internal table contains fewer lines than <idx>, no line is changed and SY-SUBRC is set to 4.
Without the INDEX addition, you can only use the above statement within a LOOP. In this case, you change the current loop line <idx> is implicitly set to SY-TABIX.
When you change lines in sorted tables, remember that you must not change the contents of key fields, and that a runtime error occurs if you try to replace the contents of a key field with another value. However, you can assign the same value.
The TRANSPORTING addition allows you to specify the fields that you want to change explicitly in a list.
Regards
Indrajit. -
Fetch the values from internal table inside an internal table (urgent!!)
data : BEGIN OF PITB2_ZLINFO occurs 0,
BEGDA LIKE SY-DATUM,
ENDDA LIKE SY-DATUM,
PABRJ(4) TYPE N, "Payroll Year
PABRP(2) TYPE N, "Pay. Period
ZL LIKE PC2BF OCCURS 0,
END OF PITB2_ZLINFO.
I have a internal table like this,
How to Fetch the values from internal table inside an internal table.
Kindly Help me on this..
Regards,
Ram.Hi,
Try this....
Loop at PITB2_ZLINF0.
Loop at PITB2_ZLINF0-ZL.
endloop.
Endloop.
Thanks...
Preetham S -
Problem in uploading the file of internal table into appliaction server
i want to send the data of internal table to application server through selection screen and in selection screen and in selection screen parameter it should show the path of application server and through that path internal table data should go to application server , if possible give the code
Hi,
form download_file_appl_server.
open dataset p_dlf2 for output
in text mode encoding default .
if sy-subrc ne 0.
message:i005 with text-415 text-407.
endif.
loop at i_final into wa_final.
transfer wa_final to p_dlf2.
endloop.
close dataset p_dlf2.
endform. " OPENDATA_CLOSE
where p_dlf2 is the seelction screen parameter which give the application server file path
You can use this code for ur purpose.
Reward if useful.
Regards
Shibin -
Hi I want to know the difference between the type of internal tables.
I know the types of internal table but i dont know the difference between them can any one explain me in simple sentence.
Hi,
<b>Standard Internal Tables</b>
Standard tables have a linear index. You can access them using either the index or the key. If you use the key, the response time is in linear relationship to the number of table entries. The key of a standard table is always non-unique, and you may not include any specification for the uniqueness in the table definition.
This table type is particularly appropriate if you want to address individual table entries using the index. This is the quickest way to access table entries. To fill a standard table, append lines using the (APPEND) statement. You should read, modify and delete lines by referring to the index (INDEX option with the relevant ABAP command). The response time for accessing a standard table is in linear relation to the number of table entries. If you need to use key access, standard tables are appropriate if you can fill and process the table in separate steps. For example, you can fill a standard table by appending records and then sort it. If you then use key access with the binary search option (BINARY), the response time is in logarithmic relation to
the number of table entries.
<b>Sorted Internal Tables</b>
Sorted tables are always saved correctly sorted by key. They also have a linear key, and, like standard tables, you can access them using either the table index or the key. When you use the key, the response time is in logarithmic relationship to the number of table entries, since the system uses a binary search. The key of a sorted table can be either unique, or non-unique, and you must specify either UNIQUE or NON-UNIQUE in the table definition. Standard tables and sorted tables both belong to the generic group index tables.
This table type is particularly suitable if you want the table to be sorted while you are still adding entries to it. You fill the table using the (INSERT) statement, according to the sort sequence defined in the table key. Table entries that do not fit are recognised before they are inserted. The response time for access using the key is in logarithmic relation to the number of
table entries, since the system automatically uses a binary search. Sorted tables are appropriate for partially sequential processing in a LOOP, as long as the WHERE condition contains the beginning of the table key.
<b>Hashed Internal Tables</b>
Hashes tables have no internal linear index. You can only access hashed tables by specifying the key. The response time is constant, regardless of the number of table entries, since the search uses a hash algorithm. The key of a hashed table must be unique, and you must specify UNIQUE in the table definition.
This table type is particularly suitable if you want mainly to use key access for table entries. You cannot access hashed tables using the index. When you use key access, the response time remains constant, regardless of the number of table entries. As with database tables, the key of a hashed table is always unique. Hashed tables are therefore a useful way of constructing and
using internal tables that are similar to database tables. -
Gui_download for transferring the data from internal table to excel sheet.
hi all,
i am using gui_download for transferring the data from internal table to excel sheet.
I have a internal table with 3 columns col1,col2,col3 and I am getting the file at the specified path,but my problem is that,in the excel sheet(path specified) all the 3 columns values are printed in one column.Please help me.
Thanks in advance.Hi Venkata,
plz use FM 'SAP_CONVERT_TO_XLS_FORMAT' :
call function 'SAP_CONVERT_TO_XLS_FORMAT'
exporting
* I_FIELD_SEPERATOR =
* I_LINE_HEADER =
i_filename = p_file
* I_APPL_KEEP = ' '
tables
i_tab_sap_data = t_mbew
* CHANGING
* I_TAB_CONVERTED_DATA =
* 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.
Hope this helps,
Erwan -
How to increase the length of internal table dynamically
How to increase the length of internal table dynamically depending on the number of fields fetched into the internal table ?
The requirement code :
types: begin of t_data,
form like zscr_data_hdr-form,
werks like zscr_data_hdr-werks,
matnr like zscr_data_hdr-matnr,
verid like zscr_data_hdr-verid,
lot like zscr_data_hdr-lot,
lot_qty like zscr_data_hdr-lot_qty,
udate like zscr_data_hdr-udate,
utime like zscr_data_hdr-utime,
zuser like zscr_data_hdr-zuser,
processed like zscr_data_hdr-processed,
defect like zscr_defect_data-defect,
vornr like zscr_route_data-vornr,
fld1 like zscr_defect_data-defect_val,
fld2 like zscr_defect_data-defect_val,
fld3 like zscr_defect_data-defect_val,
fld4 like zscr_defect_data-defect_val,
fld5 like zscr_defect_data-defect_val,
fld6 like zscr_defect_data-defect_val,
fld7 like zscr_defect_data-defect_val,
fld8 like zscr_defect_data-defect_val,
fld9 like zscr_defect_data-defect_val,
fld10 like zscr_defect_data-defect_val,
fld11 like zscr_defect_data-defect_val,
fld12 like zscr_defect_data-defect_val,
fld13 like zscr_defect_data-defect_val,
fld14 like zscr_defect_data-defect_val,
fld15 like zscr_defect_data-defect_val,
fld16 like zscr_defect_data-defect_val,
fld17 like zscr_defect_data-defect_val,
fld18 like zscr_defect_data-defect_val,
fld19 like zscr_defect_data-defect_val,
fld20 like zscr_defect_data-defect_val,
fld21 like zscr_defect_data-defect_val,
fld22 like zscr_defect_data-defect_val,
fld23 like zscr_defect_data-defect_val,
fld24 like zscr_defect_data-defect_val,
fld25 like zscr_defect_data-defect_val,
fld26 like zscr_defect_data-defect_val,
fld27 like zscr_defect_data-defect_val,
fld28 like zscr_defect_data-defect_val,
fld29 like zscr_defect_data-defect_val,
fld30 like zscr_defect_data-defect_val,
fld31 like zscr_defect_data-defect_val,
fld32 like zscr_defect_data-defect_val,
fld33 like zscr_defect_data-defect_val,
fld34 like zscr_defect_data-defect_val,
fld35 like zscr_defect_data-defect_val,
fld36 like zscr_defect_data-defect_val,
fld37 like zscr_defect_data-defect_val,
fld38 like zscr_defect_data-defect_val,
fld39 like zscr_defect_data-defect_val,
fld40 like zscr_defect_data-defect_val,
fld41 like zscr_defect_data-defect_val,
fld42 like zscr_defect_data-defect_val,
fld43 like zscr_defect_data-defect_val,
fld44 like zscr_defect_data-defect_val,
fld45 like zscr_defect_data-defect_val,
fld46 like zscr_defect_data-defect_val,
fld47 like zscr_defect_data-defect_val,
fld48 like zscr_defect_data-defect_val,
fld49 like zscr_defect_data-defect_val,
fld50 like zscr_defect_data-defect_val,
fld51 like zscr_defect_data-defect_val,
fld52 like zscr_defect_data-defect_val,
fld53 like zscr_defect_data-defect_val,
fld54 like zscr_defect_data-defect_val,
fld55 like zscr_defect_data-defect_val,
fld56 like zscr_defect_data-defect_val,
fld57 like zscr_defect_data-defect_val,
fld58 like zscr_defect_data-defect_val,
fld59 like zscr_defect_data-defect_val,
fld60 like zscr_defect_data-defect_val,
fld61 like zscr_defect_data-defect_val,
fld62 like zscr_defect_data-defect_val,
fld63 like zscr_defect_data-defect_val,
fld64 like zscr_defect_data-defect_val,
fld65 like zscr_defect_data-defect_val,
fld66 like zscr_defect_data-defect_val,
fld67 like zscr_defect_data-defect_val,
fld68 like zscr_defect_data-defect_val,
fld69 like zscr_defect_data-defect_val,
fld70 like zscr_defect_data-defect_val,
fld71 like zscr_defect_data-defect_val,
fld72 like zscr_defect_data-defect_val,
fld73 like zscr_defect_data-defect_val,
fld74 like zscr_defect_data-defect_val,
fld75 like zscr_defect_data-defect_val,
fld76 like zscr_defect_data-defect_val,
fld77 like zscr_defect_data-defect_val,
fld78 like zscr_defect_data-defect_val,
fld79 like zscr_defect_data-defect_val,
fld80 like zscr_defect_data-defect_val,
fld81 like zscr_defect_data-defect_val,
fld82 like zscr_defect_data-defect_val,
fld83 like zscr_defect_data-defect_val,
fld84 like zscr_defect_data-defect_val,
fld85 like zscr_defect_data-defect_val,
fld86 like zscr_defect_data-defect_val,
fld87 like zscr_defect_data-defect_val,
fld88 like zscr_defect_data-defect_val,
fld89 like zscr_defect_data-defect_val,
fld90 like zscr_defect_data-defect_val,
fld91 like zscr_defect_data-defect_val,
fld92 like zscr_defect_data-defect_val,
fld93 like zscr_defect_data-defect_val,
fld94 like zscr_defect_data-defect_val,
fld95 like zscr_defect_data-defect_val,
fld96 like zscr_defect_data-defect_val,
fld97 like zscr_defect_data-defect_val,
fld98 like zscr_defect_data-defect_val,
fld99 like zscr_defect_data-defect_val,
fld100 like zscr_defect_data-defect_val,
fld101 like zscr_defect_data-defect_val,
fld102 like zscr_defect_data-defect_val,
fld103 like zscr_defect_data-defect_val,
fld104 like zscr_defect_data-defect_val,
fld105 like zscr_defect_data-defect_val,
fld106 like zscr_defect_data-defect_val,
fld107 like zscr_defect_data-defect_val,
fld108 like zscr_defect_data-defect_val,
fld109 like zscr_defect_data-defect_val,
fld110 like zscr_defect_data-defect_val,
fld111 like zscr_defect_data-defect_val,
fld112 like zscr_defect_data-defect_val,
fld113 like zscr_defect_data-defect_val,
fld114 like zscr_defect_data-defect_val,
fld115 like zscr_defect_data-defect_val,
fld116 like zscr_defect_data-defect_val,
fld117 like zscr_defect_data-defect_val,
fld118 like zscr_defect_data-defect_val,
fld119 like zscr_defect_data-defect_val,
fld120 like zscr_defect_data-defect_val,
fld121 like zscr_defect_data-defect_val,
fld122 like zscr_defect_data-defect_val,
fld123 like zscr_defect_data-defect_val,
fld124 like zscr_defect_data-defect_val,
fld125 like zscr_defect_data-defect_val,
fld126 like zscr_defect_data-defect_val,
fld127 like zscr_defect_data-defect_val,
fld128 like zscr_defect_data-defect_val,
fld129 like zscr_defect_data-defect_val,
fld130 like zscr_defect_data-defect_val,
fld131 like zscr_defect_data-defect_val,
fld132 like zscr_defect_data-defect_val,
fld133 like zscr_defect_data-defect_val,
fld134 like zscr_defect_data-defect_val,
fld135 like zscr_defect_data-defect_val,
dayst like zscr_data_hdr-dayst,
end of t_data.
In this fld1 to fld135 are defined in internal table.
But if the number of fields are more than 135 then the program is going to short dump.
Some times fld1 to fid170 or more fields will be there in my internal table.
Please suggest me how to make my requirement dynamic and display this data fetched into this internal table onto a .XLS file in the presentation server ?Hi
You can try to use the type string:
form like zscr_data_hdr-form,
werks like zscr_data_hdr-werks,
matnr like zscr_data_hdr-matnr,
verid like zscr_data_hdr-verid,
lot like zscr_data_hdr-lot,
lot_qty like zscr_data_hdr-lot_qty,
udate like zscr_data_hdr-udate,
utime like zscr_data_hdr-utime,
zuser like zscr_data_hdr-zuser,
processed like zscr_data_hdr-processed,
defect like zscr_defect_data-defect,
vornr like zscr_route_data-vornr,
fieldxx type string,
dayst like zscr_data_hdr-dayst,
end of t_data.
So you can save you informations of every fld<n> concatenating their values into fieldxx.
Max -
Regarding how to delete the record in internal table
Hi experts ,
how to delete the record in intarnal table after validating the data,
if record contains invalid fields?
i am giving my code see this and give me the answer?
loop at it_data into wa_data .
Validate Cost Center
READ TABLE it_kostl INTO wa_kostl WITH KEY kostl = wa_data-kostl BINARY SEARCH.
IF sy-subrc NE 0.
PERFORM update_error_log USING wa_data
text-004.
ENDIF.
Validate source file material ( material number )
loop at it_mara into wa_mara .
read table it_ausp into wa_ausp with key atwrt = wa_data-i_matnr .
if sy-subrc NE 0 .
PERFORM update_error_log USING wa_data
text-002.
delete it_data-objek .
else.
read table it_mara into wa_mara with key matnr = wa_ausp-objek .
if sy-subrc EQ 0 .
wa_data-objek = wa_mara-matnr.
wa_data-matkl = wa_mara-matkl.
ENDIF.
Modify it_data from wa_data .
endif.
*endloop.
Validate unit of measure (unit)
READ TABLE it_t006 INTO wa_t006 WITH KEY msehi = wa_data-unit .
IF sy-subrc NE 0.
PERFORM update_error_log USING wa_data
text-003.
endif.
Validate delivery location ( storage location )
READ TABLE it_lgort INTO wa_lgort WITH KEY del_loc = wa_data-del_loc.
IF sy-subrc NE 0.
PERFORM update_error_log USING wa_data
text-001.
if wa_data-flag ='x' .
delete it_data from wa_data .
endif.
ENDIF.
endloop.Hi Naren,
First get the index number of the IT_data table and store it in one variable whose declaration like this.
data: tabix type sy-tabix.
while reading the internal table it_data set the tabix variable.
tabix = sy-tabix.
Instead of the above use below one.
Delete it_data-objek
Use the Below statement it will delete the row from the internal table.
Delete it_data-objek index tabix
Thanks,
Chidanand -
Modify the structure of internal table which created dynamically!!!
HI All,
I am creating internal table dynamically using the below syntax. Now I need to remove few of the fields from the internal table structure. Could you please help me how to go ahead in these cases?
* Create table dynamically for local data
CREATE DATA gv_table_l TYPE TABLE OF (<fs_tabname>).
CREATE DATA gv_wa_l TYPE (<fs_tabname>).
ASSIGN gv_table_l->* TO <fs_local_tab>.
ASSIGN gv_wa_l->* TO <fs_local_wa
>.
Please let me know if you have any thoughts.
Thanks,
Raghu.Hi ,
check this wiki
[Internal Table|http://wiki.sdn.sap.com/wiki/display/Snippets/Howtocreateinternaltable+dynamically]
in your case ...
1.Get filed list based on the type ...make use of "cl_abap_datadescr=>describe_by_type('MARA'), check for syntax or sample programs...
2.Delete fields which you dont want to be in your internal table....
3.Create internal table using method " CL_ALV_TABLE_CREATE=>CREATE_DYNAMIC_TABLE" ref attached link for sample code by Pinaki...
regards
Prabhu -
Modify dynamic internal table from dynamic work area using index...
ASSIGN w_text TO <fs>.
ASSIGN w_temp TO <fs1>.
lint_tab_iw49[] = <tab>.
lint_tab_iw49_t[] = <tab>.
DELETE ADJACENT DUPLICATES FROM lint_tab_iw49 COMPARING aufnr.
LOOP AT lint_tab_iw49 INTO lws_tab_iw49.
READ TABLE lint_object_tab1 INTO lws_object_tab1
WITH KEY aufnr = lws_tab_iw49-aufnr.
IF sy-subrc EQ 0.
Collect operations in rows of an internal table.
w_idx = 1.
WHILE w_idx < 51.
w_nn = w_idx.
CONCATENATE 'lws_object_tab1-ZZOPERN' w_nn INTO w_xx.
ASSIGN (w_xx) TO <fs>.
CONCATENATE w_text <fs> INTO w_text SEPARATED BY ','.
w_idx = w_idx + 1.
ENDWHILE.
Split operations into an internal table to get operations in rows.
SPLIT w_text AT ',' INTO TABLE lint_vornr.
DELETE lint_vornr WHERE vornr = ' '.
DESCRIBE TABLE lint_vornr LINES w_lines.
Collect costs in rows of an internal table
CLEAR: w_idx, w_nn, w_xx, w_text.
w_idx = 1.
WHILE w_idx < 51.
w_nn = w_idx.
CONCATENATE 'lws_object_tab1-ZZCOST' w_nn INTO w_xx.
ASSIGN (w_xx) TO <fs>.
<fs1> = <fs>.
CONCATENATE w_text <fs1> INTO w_text SEPARATED BY ','.
w_idx = w_idx + 1.
ENDWHILE.
Split costs into an internal table to get costs in rows.
SPLIT w_text AT ',' INTO TABLE lint_escost.
DELETE lint_escost WHERE cost = ' '.
DESCRIBE TABLE lint_escost LINES w_lines_cost.
Append lines of lint_escost from 1 to w_lines to lint_escost1.
Collect currencies in rows of an internal table
CLEAR: w_idx, w_nn, w_xx, w_text.
w_idx = 1.
WHILE w_idx < 51.
w_nn = w_idx.
CONCATENATE 'lws_object_tab1-ZZCURR' w_nn INTO w_xx.
ASSIGN (w_xx) TO <fs>.
<fs1> = <fs>.
CONCATENATE w_text <fs1> INTO w_text SEPARATED BY ','.
w_idx = w_idx + 1.
ENDWHILE.
Split costs into an internal table to get costs in rows.
SPLIT w_text AT ',' INTO TABLE lint_curr.
DELETE lint_curr WHERE curr = ' '.
DESCRIBE TABLE lint_curr LINES w_lines_curr.
Append lines of lint_curr from 1 to w_lines to lint_curr1.
ENDIF.
PERFORM update_object_tab_for_iw49n.
ENDLOOP.
ENDIF.
ENDFORM. " modify_object_tab
*& Form update_object_tab_for_IW49N
text
--> p1 text
<-- p2 text
FORM update_object_tab_for_iw49n .
DATA: lws_temp TYPE string VALUE 'where aufnr = lws_tab_iw49-aufnr',
lw_index TYPE sy-index.
READ TABLE <tab> TRANSPORTING NO FIELDS WITH KEY ('AUFNR') =
lws_tab_iw49-aufnr.
IF sy-subrc EQ 0.
lw_index = sy-tabix.
LOOP AT <tab> INTO <wa1> FROM lw_index.
IF <wa1>-aufnr NE lws_tab_iw49-aufnr.
EXIT.
ELSE.
CLEAR lw_index.
lw_index = sy-tabix.
lw_index = 1.
WHILE lw_index LE w_lines.
READ TABLE lint_escost INTO lws_escost INDEX lw_index.
IF sy-subrc EQ 0.
lw_index = lw_index + 1.
<wa1>-zzcost1 = lws_escost-cost.
ENDIF.
READ TABLE lint_curr1 INTO lws_curr INDEX lw_index.
IF sy-subrc EQ 0.
<wa1>-zzcurr1 = lws_curr-curr.
ENDIF.
MODIFY <tab> FROM <wa1> "TRANSPORTING ('ZZCOST1') ('ZZCURR1')
INDEX sy-tabix.
IF sy-subrc EQ 0.
ENDIF.
lw_index = lw_index + 1.
ENDWHILE.
ENDIF.
ENDLOOP.
ENDIF.
ENDFORM. " update_object
Hi,
With referene to the code snippet above I want to modify <tab> from <wa1> on specific indices or with specific where condition.
Is it achievable... How?
Many thanks in advance.
Thanks & Regards,
ShreyaYou might have to split the code in to two parts to keep the formatting intact.
-
Regarding Exporting and Importing internal table
Hello Experts,
I have two programs:
1) Main program: It create batch jobs through open_job,submit and close job.Giving sub program as SUBMIT.
I am using Export IT to memory id 'MID' to export internal table data to sap memory in the subprogram.
The data will be processed in the subprogram and exporting data to sap memory.I need this data in the main program(And using import to get the data,but it is not working).
Importing IT1 from memory id 'MID' to import the table data in the main program after completing the job(SUBMIT SUBPROGRAM AND RETURN).
Importing is not getting data to internal table.
Can you please suggest something to solve this issue.
Thank you.
Regards,
Anand.Hi,
This is the code i am using.
DO g_f_packets TIMES.
* Start Immediately
IF NOT p_imm IS INITIAL .
g_flg_start = 'X'.
ENDIF.
g_f_jobname = 'KZDO_INHERIT'.
g_f_jobno = g_f_jobno + '001'.
CONCATENATE g_f_jobname g_f_strtdate g_f_jobno INTO g_f_jobname
SEPARATED BY '_'.
CONDENSE g_f_jobname NO-GAPS.
p_psize1 = p_psize1 + p_psize.
p_psize2 = p_psize1 - p_psize + 1.
IF p_psize2 IS INITIAL.
p_psize2 = 1.
ENDIF.
g_f_spname = 'MID'.
g_f_spid = g_f_spid + '001'.
CONDENSE g_f_spid NO-GAPS.
CONCATENATE g_f_spname g_f_spid INTO g_f_spname.
CONDENSE g_f_spname NO-GAPS.
* ... (1) Job creating...
CALL FUNCTION 'JOB_OPEN'
EXPORTING
jobname = g_f_jobname
IMPORTING
jobcount = g_f_jobcount
EXCEPTIONS
cant_create_job = 1
invalid_job_data = 2
jobname_missing = 3
OTHERS = 4.
IF sy-subrc <> 0.
MESSAGE e469(9j) WITH g_f_jobname.
ENDIF.
* (2)Report start under job name
SUBMIT (g_c_prog_kzdo)
WITH p_lgreg EQ p_lgreg
WITH s_grvsy IN s_grvsy
WITH s_prvsy IN s_prvsy
WITH s_prdat IN s_prdat
WITH s_datab IN s_datab
WITH p1 EQ p1
WITH p3 EQ p3
WITH p4 EQ p4
WITH p_mailid EQ g_f_mailid
WITH p_psize EQ p_psize
WITH p_psize1 EQ p_psize1
WITH p_psize2 EQ p_psize2
WITH spid EQ g_f_spid
TO SAP-SPOOL WITHOUT SPOOL DYNPRO
VIA JOB g_f_jobname NUMBER g_f_jobcount AND RETURN.
*(3)Job closed when starts Immediately
IF NOT p_imm IS INITIAL.
IF sy-index LE g_f_nojob.
CALL FUNCTION 'JOB_CLOSE'
EXPORTING
jobcount = g_f_jobcount
jobname = g_f_jobname
strtimmed = g_flg_start
EXCEPTIONS
cant_start_immediate = 1
invalid_startdate = 2
jobname_missing = 3
job_close_failed = 4
job_nosteps = 5
job_notex = 6
lock_failed = 7
OTHERS = 8.
gs_jobsts-jobcount = g_f_jobcount.
gs_jobsts-jobname = g_f_jobname.
gs_jobsts-spname = g_f_spname.
APPEND gs_jobsts to gt_jobsts.
ELSEIF sy-index GT g_f_nojob.
CLEAR g_f_flg.
DO. " Wiating untill any job completion
LOOP AT gt_jobsts into gs_jobsts.
CLEAR g_f_status.
CALL FUNCTION 'BP_JOB_STATUS_GET'
EXPORTING
JOBCOUNT = gs_jobsts-jobcount
JOBNAME = gs_jobsts-jobname
IMPORTING
STATUS = g_f_status
* HAS_CHILD =
* EXCEPTIONS
* JOB_DOESNT_EXIST = 1
* UNKNOWN_ERROR = 2
* PARENT_CHILD_INCONSISTENCY = 3
* OTHERS = 4
g_f_mid = gs_jobsts-spname.
IF g_f_status = 'F'.
IMPORT gt_final FROM MEMORY ID g_f_mid .
FREE MEMORY ID gs_jobsts-spname.
APPEND LINES OF gt_final to gt_final1.
REFRESH gt_prlist.
CALL FUNCTION 'JOB_CLOSE'
EXPORTING
jobcount = g_f_jobcount
jobname = g_f_jobname
strtimmed = g_flg_start
EXCEPTIONS
cant_start_immediate = 1
invalid_startdate = 2
jobname_missing = 3
job_close_failed = 4
job_nosteps = 5
job_notex = 6
lock_failed = 7
OTHERS = 8.
IF sy-subrc = 0.
g_f_flg = 'X'.
gs_jobsts1-jobcount = g_f_jobcount.
gs_jobsts1-jobname = g_f_jobname.
gs_jobsts1-spname = g_f_spname.
APPEND gs_jobsts1 TO gt_jobsts.
DELETE TABLE gt_jobsts FROM gs_jobsts.
EXIT.
ENDIF.
ENDIF.
ENDLOOP.
IF g_f_flg = 'X'.
CLEAR g_f_flg.
EXIT.
ENDIF.
ENDDO.
ENDIF.
ENDIF.
IF sy-subrc <> 0.
MESSAGE e539(scpr) WITH g_f_jobname.
ENDIF.
COMMIT WORK .
ENDDO. -
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. -
Problem to upload the data into internal table record length more than 6000
Hi all
I stuck with this problem from past 3 days. I have to upload the data from excel sheet. iam making it tab delimited and trying to upload from gui_upload. but in the structure of file, we have, one field of 4000 characters, and other fields of 255 characters.
how can i upload this into internal table . From excel sheet or from tab delimeted or any other format? or any special function module is there? while iam doing this its truncating the datat 255 characters and not uploading the other fields also...
can any one of you help me out. ASAP
thnks in advancefrom one of the forum iam just pasting code which it is used in lsmw, try the same logic in ur code hope it can work.
you have to create multiple lines with do...enddo loop., like this:
(assuming excel_long_text-text is 924 characters long, 7 lines X 132 char)
__GLOBAL_DATA__
data: offset type i,
text_132(132) type c.
__BEGIN_OF_RECORD__ Before Using Conversion Rules
Rule : Default Settings Modified
Code: /sapdmc/ltxtl = init_/sapdmc/ltxtl.
CLEAR offset.
DO 7 TIMES.
text_132 = excel_long_text-text+offset(132).
offset = offset + 132.
__END_OF_RECORD__ After Using Conversion Rules
Rule : Default Settings Modified
Code: transfer_record.
ENDDO.
also check this
COMMIT_TEXT
To load long text into SAP
READ_TEXT
To load long text into SAP -
What are the advantages using internal tables without headerline.
hi,
i have a doubt,please clarify.
data:itab like <databse table> occurs 0 with header line.
or
data:itab like <databse table>occurs 0,
wa like line type of itab.
in above two cases , in my view no difference.
in first case there will be one workarea will be created with same name itab,
in second case we are explicitly creating work area.
ok.
here my doubt is in what cases it is madatory to create internal table with explicitly work area?
thank in advance.
venuHi,
It is a good practice to define a structure for your internal table. Then declare an internal table with the defined structure. Using a workarea to access to the internal table.
TYPES : BEGIN OF struc_tab,
rec1(10) TYPE c,
END OF struc_tab.
DATA : itab TYPE TABLE OF struc_tab,
wa_itab LIKE LINE OF itab.
There is no differences, just that we're avoiding declaring using 'With Occurs 0' or 'With Header Line' and in some cases in oo programming, headerline are not allowed.
Regards,
Loo -
Need to put flag in one of the column of internal table
TYPES : BEGIN OF ty_bseg.
INCLUDE STRUCTURE bseg.
TYPES : flag(1) TYPE c.
TYPES : END OF ty_bseg.
DATA : gt_bseg TYPE TABLE OF ty_bseg.
SELECT * FROM bseg
INTO TABLE <b>gt_bseg</b>
FOR ALL ENTRIES IN gt_bsak
WHERE bukrs = gt_bsak-bukrs
AND belnr = gt_bsak-belnr
AND gjahr = gt_bsak-gjahr.
Now I have to fill 'X' in the internal table gt_bseg.
how can I fill all the records of itab gt_bseg with flag 'X'.
For better performance... is there any command like modify or...?Hi Sam,
Use the following code.
*Code start
loop at gt_bseg.
gt_bseg-flag = 'X'.
modify table gt_bseg transporting flag.
endloop.
*Code ends
Cheers,
Vikram
Pls reward for helpful replies!!
Maybe you are looking for
-
Is the iPad 2 charger the same as the charger for the original iPhone?
My understanding is that the charger that comes with the iPad 2 is more powerful and will charge the iPad 2 more quickly than will the charger that comes with the iPhone 4. However, the iPad 2 charger is the same shape as the charger that came with t
-
Destinations from an HTML file not working with Acrobat XI
When the link is executed in Acrobat X it opens to the correct destination. When opened with Acrobat XI it doesn't. In fact, when I open the PDF (created with Acrobat Pro X) with Acrobat Pro XI I don't see any destinations... I don't see where to vie
-
My IPOD was corrupted during updating ITUNES.
My IPOD was corrupted during updating ITUNES. Now all I get on the screen is USB up arrow ITUNES. What can I do?
-
Hey all my awesome homies! I have a quick question. Now let's say that I sync'ed my software updates on Patch Tuesday and I deployed them on that day, and then, let's say that on Thursday or Friday, just a couple or few days later after Patch Tuesda
-
Hi All - I have a table which has 6 columns create table main_tbl (p_id integer, p_lname varchar2(20), p_fname varchar2(20), p_dept varchar2(15), p_office varchar2(15), p_ind char(1) And I have a corresponding audit/history table create table main_tb