Regarding passing blank characters to internal table field
Hi All,
I have small issue.
Actual issue is
I am having one internal table field as <b>oper_table-arbid</b> in the program i will actually pass first 4 characters of that field into another internal table <b>i_download_operation-arbid.</b>
Then if <b>oper_table-arbid</b> is blank i need to pass
4 blank characters into <b>i_download_operation-arbid.</b>
Can anybody tell me how can i do it.
Code is like this
IF oper_table-arbid NE space.
MOVE oper_table-arbid+0(4) TO i_download_operation-arbid.
ELSE.
I need to pass 4 blank char's to i_download_operation-arbid
ENDIF.
oper_table-arbid is of 8 char length & i_download_operation-arbid is of 4 char length.
Can any body tell me what i need to do here.
Thanks in advance.
Thanks & Regards,
Rayeez.
hi ,
shaik.
data: var(8) type c value 'abcdefgh'.
write var.
data: bar(8) type c value 'ijkl',
p1(8) .
move bar to p1.
write:/ p1 right-justified.
just execute the program and see the o/p.
if u r trying to pass character then default position is left-justfied .
so u need to explicitly say right-justified so it will take positions 5,6,7,8.
so here u need append blank spaces .
after seeing the o/p u will hav a clear picture .
vijay.
Similar Messages
-
Regarding Internal Table Field Validation [Modification]
Hi All,
I have a small issue with formatting of a field.
The Field is POTX1 - it would get the value as 'New MT-EPPE0097-COMP02',
Means i have one internal table field as i_error-POTX1 in that some times we get value as 'New MT-EPPE0097-COMP02'.
Whenever i get 'New' literal in that internal table field i have to remove that literal from that internal table field. And Left Justify the remaining part of the field.
Ex: 'New MT-EPPE0097-COMP02'
should become 'MT-EPPE0097-COMP02'.
For this first i have to find wether 'New' Literal exists in the Internal table field or not then i have to remove it.
Can anybody tell me how can i solve this issue.
Thanks in advance.
Thanks & Regards,
Rayeezuddin.Hi,
Take a look :
loop at i_error.
if i_error-potx1(3) = 'New'
w_potx1 = i_error-potx1.
i_error-potx1 = w_potx1+3(37).
MODIFY i_error.
endif.
ENDLOOP.
Regards,
Erwan.
Message was edited by: Erwan LE BRUN -
Accessing Dynamic Internal table fields
Hello All,
I have one internal table ep_tabx having 138 columns whose data is getting displayed
by using function module reuse_alv_grid_display.
Now my query is, i have created one custom button on the appl toolbar to download ep_tabx data.
IF the user changes the the layout of the output at runtime and then presses that custom button
then i have created one dynamic internal table using call method cl_alv_table_create=>create_dynamic_table suppose <dyn_table> whose struc will be that of
dynamic fieldcatalog returned by using FM REUSE_ALV_GRID_LAYOUT_INFO_GET.
And then I have put a loop on the int table ep_tabx and move corresponding to the int table
<dyn_table>. But when i download the <dyn_table> data through GUI_DOWNLOAD the
date fields data is not getting downloaded correctly. I have 4 date fields in my ep_tabx.
In the alv grid output the date is getting displayed like 08/30/2004(ie mon/date/yr) but in download
file it comes like 20040830(ie yr/mon/date and that too without /).How to access the dynamic
internal tables fields separately so asto convert them in the pgm before the download.
Kindly Help.
Thanks in advance.
MansiHi,
Search in SDN you would get loads of info on accessing dynamic itab's .
in order to convert your date format use WRITE stmt to convert the value in your itab before passing it to download FM.
Regards,
Raghavendra -
Header to internal table fields
Hi All,
How can I add header description to the internal table fields and download this internal table to desktop as EXCEL form.
I want to show heading in the first line of the excel and then 2 - 3 blank lines and then next line should be populated with DATE and Exec. Time, then 2-3 blank lines , then the data with the header description to be displayed.
My sample internal table data is as below,
John M 12 2344
Thomas M 17 8960
Lin F 10 8467
Jan M 12 4323
I need to add, description as NAME above John, Thomas, Lin etc.
as GENDER above M,M,F etc.
as CODE above 12, 17,10 etc. and
as EXTENTION above 2344, 8960,8467 etc
final execl sheet should be as below,
COMPANY DATA
DATE 28 - 08 - 2009 TIME 12:32
NAME GENDER CODE EXTENTION
John M 12 2344
Thomas M 17 8960
Lin F 10 8467
Jan M 12 4323
Please let me know, how to do this.
Thanks in advance ,
SabuHi,
Kindly go through this sample code below:
"Create T_Head internal table with the required structure for the header
*func mod to download header and contents to the given path
call function 'GUI_DOWNLOAD'
exporting
write_field_separator = 'X'
filename = v_pathname "path entered by the user
tables
data_tab = t_head. "Header Internal table
refresh t_head.
clear t_head.
call function 'GUI_DOWNLOAD'
exporting
* BIN_FILESIZE =
filename = v_pathname
filetype = 'ASC'
append = 'X' "Here by giving 'X', header will be appended in the download int table
write_field_separator = 'X'
* HEADER = '00'
* TRUNC_TRAILING_BLANKS = ' '
* WRITE_LF = 'X'
* COL_SELECT = ' '
* COL_SELECT_MASK = ' '
* DAT_MODE = ' '
* CONFIRM_OVERWRITE = ' '
* NO_AUTH_CHECK = ' '
* CODEPAGE = ' '
* IGNORE_CERR = ABAP_TRUE
* REPLACEMENT = '#'
* WRITE_BOM = ' '
* TRUNC_TRAILING_BLANKS_EOL = 'X'
* WK1_N_FORMAT = ' '
* WK1_N_SIZE = ' '
* WK1_T_FORMAT = ' '
* WK1_T_SIZE = ' '
* IMPORTING
* FILELENGTH =
tables
data_tab = itab
* FIELDNAMES =
exceptions
file_write_error = 1
no_batch = 2
gui_refuse_filetransfer = 3
invalid_type = 4
no_authority = 5
unknown_error = 6
header_not_allowed = 7
separator_not_allowed = 8
filesize_not_allowed = 9
header_too_long = 10
dp_error_create = 11
dp_error_send = 12
dp_error_write = 13
unknown_dp_error = 14
access_denied = 15
dp_out_of_memory = 16
disk_full = 17
dp_timeout = 18
file_not_found = 19
dataprovider_exception = 20
control_flush_error = 21
others = 22
if sy-subrc <> 0.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
endif.
endif.
Hope it helps
Regards
Mansi -
How can i pass calculated value to internal table
Hi
i have to pass calculated value into internal table
below field are coming from database view and i' m passing view data into iznew1
fields of iznew1
LIFNR LIKE EKKO-LIFNR,
EBELN LIKE EKKO-EBELN,
VGABE LIKE EKBE-VGABE,
EBELP LIKE EKBE-EBELP,
BELNR LIKE EKBE-BELNR,
MATNR LIKE EKPO-MATNR,
TXZ01 LIKE EKPO-TXZ01,
PS_PSP_PNR LIKE EKKN-PS_PSP_PNR,
KOSTL LIKE EKKN-KOSTL,
NAME1 LIKE LFA1-NAME1,
NAME2 LIKE LFA1-NAME2,
WERKS LIKE EKPO-WERKS,
NETWR LIKE EKPO-NETWR,
KNUMV LIKE EKKO-KNUMV,
GJAHR LIKE EKBE-GJAHR,
and now i want to pass
one field ED1 which i has calculated separatly and i want to pass this value into iznew1
but error is coming that iznew1 is a table with out header line has no component like ED1.
so how can i pass calculated value to internal table iznew1,When you declare your internal table , make an addtion occurs 0
eg . data : begin of iznew occurs 0 ,
fields ...
add the field here ed1.
end of iznew.
now when you are calculating the value of ed1,
you can pass the corresponding value of ed1 and modify table iznew.
eg
loop at iznew.
iznew-ed1 = ed1.
modify iznew.
endloop. -
Assigning value to Field - Symbol ( which is type of internal table field )
Hi All,
I am facing problem to assign the value to a field symbol. My requirement is creating a dynamic internal table and populate values into that internal table, so that i can display the values .
I am having a structure with fields like status , Plant1 name , Plant2 name.....Plant n .
So i declared an internal table it_tab with this structure.
I am having one more table which having number of records for Plant1 ,Plant 2 ,....Plant n based on some condition.
I need to count the number of records for Plant1 and i need to put in the internal table it_tab.
For this i created field-symbol .
Here, t_deployment table will have the plants 1,2,3...and
t_devobject will have some records for these plants.
LOOP AT T_DEPLOYMENT.
clear w_count.
LOOP AT T_DEVOBJECT WHERE ZDEPLOYMENT = T_DEPLOYMENT-DOMVALUE_L AND
ZADSTATUS = '10'.
w_count = w_count + 1.
ENDLOOP.
concatenate 'it_tab-' t_deployment-domvalue_l into var_bet_name.
assign var_bet_name to <bet_var_name>.
now my internal table field i.e. it_tab-plant1 came into <bet_var_name> . But i want to assign a value for it.
at last what i need is it_tab-plant1 = w_count.
whaterver the w_count has value that needs to assign to it_tab-plant1. But i don't want to assign directly it it_tab-plant1. I want to assign dynamically. Because tommorrow some more plants added to t_deployments , i don't want to make changes to my program. It should take care....w/o changing the program.
I tried the following statement.
(<bet_var_name>) = w_count. But its not working.
Please let me know how i can get this.
Thanks in Advance.
Pavan.Hi pavan,
As ur requirement is creating a dynamic internal table,
try the following way,
remember the fieldcat should be of type LVC not SLIS.
BUILD LT_LVCFIELDCAT in a way that, the value from the internal table becomes the fieldname
ex:-
loop at it_models INTO WA_MODELS.
LS_LVCFIELDCAT-FIELDNAME = WA_models-MODEL.
LS_LVCFIELDCAT-SELTEXT = WA_models-MODEL.
append ls_lvcfieldcat to lt_lvcfieldcat.
endloop.
DATA: DREF TYPE REF TO DATA,WA_REF TYPE REF TO DATA.
FIELD-SYMBOLS: <TEMP_TAB> TYPE TABLE, <TEMP_WA> TYPE ANY.
CALL METHOD CL_ALV_TABLE_CREATE=>CREATE_DYNAMIC_TABLE
EXPORTING
IT_FIELDCATALOG = LT_LVCFIELDCAT
IMPORTING
EP_TABLE = DREF.
ASSIGN dref->* TO <TEMP_TAB>.
now basing on the fieldcatalog <temp_tab> is build.
NOW FILL <TEMP_TAB>.
WHILE FILLING, ASSIGN COMPONENT IDX/NAME.....
this statement will be very usefull.
i hope this will be help full.
pls reward the points if it helps u.
regards
Hyma -
How to populate dynamic internal table fields with data??
Hi Folks,
How to assign a particular internal table field to a dynamically assigned internal table?
I have an excel sheet, and i upload the excel sheet data into an internal IT_EXLOAD table using FM ALSM_EXCEL_TO_INTERNAL_TABLE
Now i created a dynamic internal table which has the same column as in my DB table.
I have to fill the dynamically created Internal table with the IT_EXLOAD data dynamically.
Suppose in future if i add some field in DB table and for that field if i add some column in excel sheet there is no need to change in the program.
Looking for reply...
Best Regards,
Sayakhi,
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
filename = p_path
i_begin_col = '1'
i_begin_row = '2'
i_end_col = '2'
i_end_row = '1000'
TABLES
intern = intern
EXCEPTIONS
inconsistent_parameters = 1
upload_ole = 2
OTHERS = 3.
*declare intern_tmp as internal table tb_data in wich you want the data
*and declare a field symbol <fs_123>
LOOP AT intern.
ASSIGN COMPONENT intern-col OF STRUCTURE
intern_tmp TO <fs_123>.
IF NOT <fs_123> IS ASSIGNED.
CLEAR intern.
CLEAR intern_tmp.
CONTINUE.
ENDIF.
<fs_123> = intern-value.
AT END OF row.
CLEAR tb_data.
MOVE-CORRESPONDING: intern_tmp TO tb_data.
APPEND tb_data.
CLEAR intern_tmp.
ENDAT.
CLEAR intern.
ENDLOOP.
**paste this code and you can see the data in ur tables dynamically.
Thanks
Nitin Sachdeva -
Deleting blank spaces in internal table
Hi Gurus,
I want to delete the empty spaces of a particular field in internal table.I used condense and shift statements but didnt work because the work area value is already condensed.I am not sure why the internal table field is having so much of empty spaces to its left.It's a character field with length 60.
Please suggest.Hi,
This is the rellevant code
LOOP AT IT_HIER INTO WFL_HIER.
WFL_FINAL-NODEID = WFL_HIER-NID.
WFL_FINAL-IOBJNM = WFL_HIER-IOBJ.
WFL_FINAL-NODENAME = WFL_HIER-NNAME.
WFL_FINAL-PID = WFL_HIER-PID.
condense wfl_hier-desc.
WFL_FINAL-DESCRIPTION = WFL_HIER-DESC.
SHIFT WFL_FINAL-DESCRIPTION LEFT DELETING LEADING SPACE.
APPEND WFL_FINAL TO E_T_DATA.
CLEAR WFL_FINAL.
CLEAR: WFL_HIER,OUT.
ENDLOOP.
The problem is not with the work area.
Say if I have a value apple in the work area wa, (wa - 'apple').
It doesnt have any leading sapces to the left.
But when I am appending it to the internal table it gets posted at the last say like this (it - ' apple'.
It occupies the last five characters.
Not sure how to resolve this. -
Passing a value from internal table to a powerpoint slide
Hi,
Does anyone know how to pass a value from internal table to a powerpoint slide? I would also need some codes with regards to the coding to open the powerpoint and insert the value in.
Thanks.
Points will be awarded.
Hope to hear from you soon.
Lawrencegeez!! do feel sorry for you
you can fire FM WS_EXECUTE to open power point but passing a variable at run-time i'm not sure, sorry. -
How to check two internal table fields
Hi all,
I need to check two internal table fields are equal or not means which statement i can use.
Not internal table ,table contents i need to check i.e
it1-pernr = it2-pernr.
like this
if i put loop it'll check one table field for one loop.
if i put two loop means some fields reflecting 2 in it1 then it'll pring 4 times like that.i want to print whatever in internal table only .
pernr(0001) two times there in it1 means
it1-pernr = it2-pernr then
it's printing
0001
0001
0001
0001
like this but actually in it1 only two records.
Anybody know solution.tell me.
Thanks
Regards,
NandhaHi,
code for your view
data : begin of it1 occurs 0,
z_pernr like pa9012-pernr,
z_fac_c like pa9012-zz_fac_c,
end of it1.
data : it2 like Zsc1 occurs 0 with header line,
It1 data
pernr FAC C
0001 5555
0001 5555
0002 4444
0003 3333
0006 8888
It2 data
pernr FAC C
0001 5555
0001 5555
0005 6666
0003 3333
output(My code)
loop at it2 .
loop at it1 where pernr = it2-pernr.
write:/01 it1-1pernr,
10 it1-z_fac_c.
endloop.
endloop.
out put i need.
0001 5555
0001 5555
0002 4444
0003 3333
Thanks,
Nandha -
What are internal table fields?
hi sdn,
Somebody asked me what are the internal table fields?hi,
data or varaibles that u declare inside the internal table are internal table fields
eg
BEGIN OF itab_final , "OCCURS 0 ,
mtart LIKE mara-mtart ,
wwghb1 LIKE t023d-wwghb , " DIVISION DESCRIPTION
wwgha LIKE t023d-wwgha , " MAJOR CATEGORY
wwghb LIKE t023d-wwghb , " MAJOR CATEGORY DESCRIPTION
wwgpa LIKE t023d-wwgpa , " CATEGORY
matkl LIKE mara-matkl , " MERCHANDISE CATEGORY
ean11 LIKE mara-ean11 , " International Article Number (EAN/UPC)
numtp LIKE mara-numtp ,
END OF itab_final .
mtart wwghb1 wwgha wwghb wwgpa matkl ean11 numtp . these are internal table fields
Regards,
pankaj -
Internal Table field description.
Hi everybody, I need in runtime the datails of a internal table field, for example the description of the field's data type. Do you know how can I get that information? Thanks and Regards.
Use RTTI .
[http://www.liveabap.com/index.php?abapid=11|http://www.liveabap.com/index.php?abapid=11] -
An internal table field has been defined too small
Hi,
We are getting a dump when trying to get the Financial Statements.
The error in the dump is u201CAn internal table field has been defined too smallu201D.
The field with the problem is u201CYou should define the field "HSL03" larger in program "SAPLFAGL_GLT0".The maximum size allowed for fields of type P is 16 (31 digits).
Itu2019s caused by a list of documents where the exchange rate must to be u201D/699,94001u201D but it was entered without the forward slash and it caused very big numbers
The biggest number in one document is 99,401,074,527.31 USD
The sum of all them is 13,008,701,915,208.50
Any ideas to fix this?
Thanks in advance
Jorgehave you reversed those documents with fb08 and post it with the correct exchange rate???
have you searched in SMP for similar problems - I think you've to correct the DB-values- but only in agreement with your audit firm / revision
A.
Edited by: Andreas Mann on Apr 6, 2010 3:13 PM
Edited by: Andreas Mann on Apr 6, 2010 3:16 PM -
Coloring of Particular Cells in a dynamic internal table(field symbols)
Hi,
I have a requirement to introduce color into some particular cells in a dynamic internal table(Field symbol) based on some conditions.I know that color can be introduced at cell level in the case of static internal table.But, can anybody tell me whether it is possible to introduce color to particular cells in the dynamic internal table(Field Symbol) .Please suggest me on this issue.
Thanks in advance,
RajeshHi,
This is the sample coding for the colour cell report.
Kindly go through it. It will helps u.
REPORT YMS_COLOURTEST .
DATA: BEGIN OF TP OCCURS 10, ID, NR(8), TEXT(255), END OF TP.
DATA: LENGTH TYPE I VALUE 8, " Length of list
TESTSTRING(15) TYPE C VALUE '012345678901234',
WIDTH TYPE I. " Width of list
DATA: TXT_REPORT LIKE DOKHL-OBJECT.
START-OF-SELECTION.
PERFORM HEADING.
PERFORM OUTPUT_BODY.
FORM HEADING.
FORMAT INTENSIFIED OFF. " Remove any INTENSIFIED
ULINE AT (WIDTH). " Upper frame border
FORMAT COLOR COL_HEADING INTENSIFIED." Title color
WRITE: / SY-VLINE. " Left border
WRITE: 'No |Colour |intensified |intensified off|',
'inverse' NO-GAP.
WRITE: AT WIDTH SY-VLINE. " Right border
ULINE AT (WIDTH). " Line below titles
FORMAT COLOR OFF.
ENDFORM.
FORM OUTPUT_BODY.
DO LENGTH TIMES.
PERFORM WRITE_LINE USING SY-INDEX.
ENDDO.
ENDFORM.
FORM WRITE_LINE USING COUNT TYPE I.
DATA: HELP(14) TYPE C,
COUNT1 TYPE I.
COUNT1 = SY-INDEX - 1.
WRITE: / SY-VLINE NO-GAP.
WRITE: (4) COUNT1 COLOR COL_KEY INTENSIFIED NO-GAP.
WRITE: SY-VLINE NO-GAP.
CASE COUNT1.
WHEN '0'.
HELP = 'COL_BACKGROUND'.
WHEN '1'.
HELP = 'COL_HEADING'.
WHEN '2'.
HELP = 'COL_NORMAL'.
WHEN '3'.
HELP = 'COL_TOTAL'.
WHEN '4'.
HELP = 'COL_KEY'.
WHEN '5'.
HELP = 'COL_POSITIVE'.
WHEN '6'.
HELP = 'COL_NEGATIVE'.
WHEN '7'.
HELP = 'COL_GROUP'.
ENDCASE.
WRITE: HELP COLOR COL_KEY INTENSIFIED NO-GAP.
WRITE: SY-VLINE NO-GAP.
WRITE: TESTSTRING COLOR = COUNT1 INTENSIFIED NO-GAP.
WRITE: SY-VLINE NO-GAP.
WRITE: TESTSTRING COLOR = COUNT1 INTENSIFIED OFF NO-GAP.
WRITE: SY-VLINE NO-GAP.
WRITE: TESTSTRING COLOR = COUNT1 INVERSE NO-GAP.
WRITE AT WIDTH SY-VLINE NO-GAP.
ENDFORM.
Thanks,
Shankar -
How to specify for a internal table field so that number of digits = 9
In if condition how can i specify that
if country = 'US'
then the account number should be equal to 9 digits only.
<removed_by_moderator>
Edited by: Julius Bussche on Aug 6, 2008 1:41 PMYou can set the internal table field to the biggest length possible, according to your requirements, and then work on something like the following. If the condition is met and you have to shorten the account number... try something similar to this:
DATA e TYPE string VALUE 'Test string'.
* I'm using 2 as an example here.
SHIFT e BY 2 PLACES RIGHT CIRCULAR.
SHIFT e BY 2 PLACES LEFT.
WRITE :/, e.
Avraham
Maybe you are looking for
-
I'm learning Action Script. I adapted the graphics from premade Flash script from Flashkit.com. I'm trying to write the script to made the buttons active and get a URL. It uses a rotating graphic with six buttons positioned like on the spokes of a fe
-
Macbook pro: Extremely slow upload speed
Hi, I know this question has beed raised many times before me, seemingly from hundreds or thousands of users, but none of the threads I have found has lead to any solution. My new Macbook Pro (15 inch), using Lion 10.7.3, is simply unable to obtain a
-
Java Mapping to override namespace prefix (startPrefixMapping)
Does anyone have an example of using a Java Map to override the default XI namespace prefix. The method startPrefixMapping looks like it might do the job but I can't find any example of how this works.
-
How to import photos from a folder that contains hundreds of folders to Photos keeping the same folder structure?
-
This is my first Netweaver installation. Anyone knows in which CD/DVD is the SAP:J2EE-CD:630:::I386:* ? Thanks