Junk values in an internal table field
Hi,
I have an internal table with a field matnr and matxt.
Now both the fields have a junk value '#'.
matnr has '#' at the end and matxt has '#' in between the description.
How do I get rid of them.
Michael
if in description "#' occurs many times.
then split the description into one internal table
like
data: begin of it occurs 0,
fld(50),
end of it.
data : text(100).
data : ch(50).
ch = 'teygvwsjsf#wewew#wqdhfd#jdhgfd'.
split ch at '#' into table it.
loop at it.
concatenate it-ch into text sperated by space.
endloop.
u will get the string in variable text after the loop.
guru
Similar Messages
-
Maximum value of a Internal table field
Hi ,
I have been struck in 1 place.
I am getting Payment term from Zterm from VBRK table .
Now I have to fo to table T052 and according to ZTerm - I get the 3 different value - ZTAG1 , ZTAG2 ,ZTAG3.
Out of these i need to fetch the maximum calue out of ZTAG1, ZTAG2 ,ZTAG3.
i DONT WANT TO CASE STATEMENT.
pLS HELPIf you're lucky and on a new version (I think you'd need at least 7.0.2) you could use the predefined ABAP function [nmax|http://help.sap.com/abapdocu_70/en/ABENNMAX_NMIN_FUNCTIONS.htm]:
max_tag = nmax( value1 = t052-ztag1 value2 = t052-ztag2 value3 = t052-ztag3 ).
On lower releases you're out of luck and you have to code it yourself. Should be obvious how to code it, but let me be explicit:
max_tag = t052-ztag1.
if t052-ztag3 is not initial.
max_tag = t052-ztag3.
elseif t052-ztag2 is not initial.
max_tag = t052-ztag2.
endif.
Now, why did I post such a trivial solution? Because the previous poster gave one, but as you can see one can make it shorter and more legible. My solution is based on the fact that the number of days from baseline date must be in ascending order, i.e. ztag1 < ztag2 < ztag3 or a value can be 0 and then all following values have to be zero (if you try it in customizing you'll see that other combinations are not possible).
Obviously neither my nor the previous solution works in general to determine the maximum value of three numbers (though of course that's also trivial to implement and I think the disadvantage of the previously posted solution is that it's not necessarily immediately obvious).
Cheers, harald -
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 -
Hi All,
I have written BDC, in which when i pass value for second screen "Description type field" it's passing '*************************' instead of internal table value.
It's picking correct value for first internal table value. Could anyone please give an idea why it's happening?
Please find the code:
LOOP AT it_record.
header data for BDC
AT NEW CLASS.
IF sy-tabix <> 1.
perform bdc_dynpro using 'SAPLCLMO' '7777'.
perform bdc_field using 'BDC_OKCODE'
'=SAVE'.
CALL TRANSACTION 'CLWM' USING bdcdata
MODE p_mode
UPDATE 'S'
MESSAGES INTO messtab.
clear : bdcdata[],bdcdata.
ENDIF.
perform bdc_dynpro using 'SAPLCLMO' '0200'.
perform bdc_field using 'BDC_CURSOR'
'RMCLM-CLASS'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'RMCLM-CLASS'
it_record-class.
perform bdc_dynpro using 'SAPLCLMO' '7777'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'BDC_CURSOR'
'RMCLM-KLBEZ'.
perform bdc_field using 'RMCLM-KLBEZ'
it_record-klbez.
perform bdc_field using 'RMCLM-STATU'
'1'.
perform bdc_dynpro using 'SAPLCLMO' '7777'.
perform bdc_field using 'BDC_OKCODE'
'=MERK'.
perform bdc_field using 'BDC_CURSOR'
'RMCLM-KLBEZ'.
perform bdc_field using 'RMCLM-KLBEZ'
it_record-klbez.
perform bdc_field using 'RMCLM-STATU'
'1'.
MOVE 1 TO IDX.
ENDAT.
line item data for BDC
perform bdc_dynpro using 'SAPLCLMO' '7777'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'BDC_CURSOR'
'RMCLM-RELEV(02)'.
CONCATENATE 'RMCLM-MERKMA(' IDX ')' INTO FNAM.
perform bdc_field using FNAM
it_record-merkma.
CONCATENATE 'RMCLM-RELEV(' IDX ')' INTO FNAM.
perform bdc_field using FNAM
it_record-relev.
IDX = IDX + 1.
ENDLOOP.
Thanks,
UjjwalHi Ujjwal
The reason behind this is that you are using AT NEW.... ENDAT block in your coding.
When you use AT NEW field statements, the fields in the work area after the field get converted into ********.
Check values in your work area I_RECORD in debugging inside AT NEW statement and you will understand what I am saying.
In your case all the fields from header line of I_RECORDS which come after field CLASS are getting converted into *******,
hence the error.
Try using a temporary work area, say w_record. Pass value of I_record to w_record before AT NEW statement.
And use w_record-fields instead of I_record-fields. And your program should work. -
How to check a field value within an Internal table
Hi Friends,
My requirement is:
I have a line item of PO records, in that each line item of Plant field should not diffe with other line items. If it differs or say the records have different plant values line items, then I have to throw an error message.
Below example for better understanding.
lineitem Plant
010 ABC
020 ABC
030 XYZ
040 LKG
So, my report will throw an error like "All line items must be identical'.
How to do proceed it.Please advise.
Thanks & Regards
Sankar.Hi Sankar
first you need to fetch all the values in one internal table from your PO.
After that create an internal table with only plant field and move all the plan values in this table.
let assume ITAB is a table with all the values. and ITAB1 with plant only.
wa_itab is the work area for ITAB and wa_itab1 is WA for ITAB1.
ITAB has all the values and ITAB1 has all the values only for plant.
delete adjacent duplicate from itab1 compairing plant.
loop at itab1 into wa_itab1. " this will fetch all the plant values in workarea.
read table itab into wa_itab where wa_itab-plant = wa_itab1-plant. " this will fetch only the values matching to the table itab1
if su-subrc <> 0.
message 'plants are not similar' TYPE 'E'.
elseif sy-subrc = 0.
write your code*.
endif.
endloop.
hope this will help you.
Thanks
Lalit Gupta -
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 -
How to populate internal table field with text data?
Hello Experts,
I was able to load text file to a internal table but data is not populating each field. Can someone help me how to populate each field of internal table from text file?
Here is the text file:
io_name, io_type, io_txsht, io_txlng, io_datatype, io_length
ZEA_IO1, CHA, IO Test, IO Test 1, CHAR, 20
ZEA_IO2, CHA, IO Test, IO Test 2, CHAR, 20
Here is the Code:
*& Report ZAS_BAPI_TEST *
*& InfoObject Creation through BAPI.
*& Read the Text file, call a BAPI to create InfoObjects. *
*& Text file will hold the Info Object Structure. Text file will be *
*& located either work station or local PC.
*& Step 1. Create internal table to hold InfoObject structure *
*& Step 2. Retrieve/Load text file into Internal Table structure *
*& Step 3. Call BAPI Function to Create IO *
*& Step 4. Call BAPI Function to Activate IO *
REPORT ZAS_BAPI_TEST .
Make data separator a comma
CONSTANTS: gc_tab TYPE c VALUE ','.
Declaring Internal table for creating InfoObject
DATA: p_file TYPE string.
DATA: BEGIN OF itab-bapi OCCURS 0,
io_name like BAPI6108-infoobject,
io_type like BAPI6108-type,
io_txsht like BAPI6108-textshort,
io_txlng like BAPI6108-textlong,
io_datatype like BAPI6108-datatp,
io_length like BAPI6108-intlen,
END OF itab-bapi.
DATA ibapi LIKE STANDARD TABLE OF itab-bapi.
PARAMETERS: sel_file(1500) TYPE c default ' ' OBLIGATORY LOWER CASE.
PUT THE TEXT FILE PATH TO P_FILE
p_file = sel_file.
Copy the file from the workstation to the server ****
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = p_file
FILETYPE = 'ASC'
HAS_FIELD_SEPARATOR = SPACE
HEADER_LENGTH = 0
DAT_MODE = SPACE
CODEPAGE = SPACE
IGNORE_CERR = ABAP_TRUE
REPLACEMENT = '#'
READ_BY_LINE = 'X'
IMPORTING
FILELENGTH =
HEADER =
TABLES
data_tab = itab-bapi[]
EXCEPTIONS
file_open_error = 1
file_read_error = 2
no_batch = 3
gui_refuse_filetransfer = 4
invalid_type = 5
no_authority = 6
unknown_error = 7
bad_data_format = 8
header_not_allowed = 9
separator_not_allowed = 10
header_too_long = 11
unknown_dp_error = 12
access_denied = 13
dp_out_of_memory = 14
disk_full = 15
dp_timeout = 16
not_supported_by_gui = 17
error_no_gui = 18
OTHERS = 19.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
MESSAGE e012(zea_spms) WITH 'Method' 'GUI_UPLOAD' sy-subrc.
&1 &2 issued return code &3
ELSE.
pit_data[] = lit_data[].
ENDIF.
ENDIF.
loop at itab-bapi.
write: /5 itab-bapi-io_name,
20 itab-bapi-io_type,
30 itab-bapi-io_txsht,
50 itab-bapi-io_txlng,
75 itab-bapi-io_datatype,
85 itab-bapi-io_length.
endloop.
SELECT THE LOCATION FOR TEXT FILE
AT SELECTION-SCREEN ON VALUE-REQUEST FOR sel_file.
CALL FUNCTION 'WS_FILENAME_GET'
EXPORTING
def_filename = ''
def_path = 'C:\'
mask = ',Documentos de texto (*.txt), *.txt.'
mode = ''
IMPORTING
filename = p_file
EXCEPTIONS
inv_winsys = 1
no_batch = 2
selection_cancel = 3
selection_error = 4
OTHERS = 5.
find '.txt' IN p_file.
if sy-subrc <> 0.
concatenate p_file '.txt' into sel_file.
else.
sel_file = p_file.
endif.
Create InfoObject through BAPI Function
*CALL FUNCTION 'BAPI_IOBJ_CREATE'.
*IMPORTING
VALUE(DETAILS) LIKE BAPI6108 STRUCTURE BAPI6108
*EXPORTING
VALUE(INFOOBJECT) LIKE BAPI6108-INFOOBJECT
VALUE(RETURN) LIKE BAPIRET2 STRUCTURE BAPIRET2
TABLES
COMPOUNDS STRUCTURE BAPI6108CM OPTIONAL
ATTRIBUTES STRUCTURE BAPI6108AT OPTIONAL
NAVIGATIONATTRIBUTES STRUCTURE BAPI6108AN OPTIONAL
ATRNAVINFOPROVIDER STRUCTURE BAPI6108NP OPTIONAL
HIERARCHYCHARACTERISTICS STRUCTURE BAPI6108HC OPTIONAL
ELIMINATION STRUCTURE BAPI6108IE OPTIONAL
RETURNTABLE STRUCTURE BAPIRET2 OPTIONAL
Activate InfoObject through BAPI Function
CALL FUNCTION 'BAPI_IOBJ_ACTIVATE_MULTIPLE'
*ENDFORM. " RETRIEVE_DATASET
I appreciate your help.
Regards,
MauI have used tab delimited file.
Here are file contents
io_name io_type io_txsht io_txlng io_datatype io_length
ZEA_IO1 CHA IO Test IO Test 1 CHAR 20
ZEA_IO2 CHA IO Test IO Test 2 CHAR 20
And here is program used
*& Report ZAS_BAPI_TEST *
*& InfoObject Creation through BAPI.
*& Read the Text file, call a BAPI to create InfoObjects. *
*& Text file will hold the Info Object Structure. Text file will be *
*& located either work station or local PC.
*& Step 1. Create internal table to hold InfoObject structure *
*& Step 2. Retrieve/Load text file into Internal Table structure *
*& Step 3. Call BAPI Function to Create IO *
*& Step 4. Call BAPI Function to Activate IO *
REPORT ZAS_BAPI_TEST .
Make data separator a comma
CONSTANTS: gc_tab TYPE c VALUE ','.
Declaring Internal table for creating InfoObject
DATA: p_file TYPE string.
DATA: BEGIN OF itab-bapi OCCURS 0,
io_name like BAPI6108-infoobject,
io_type like BAPI6108-type,
io_txsht like BAPI6108-textshort,
io_txlng like BAPI6108-textlong,
io_datatype like BAPI6108-datatp,
io_length like BAPI6108-intlen,
END OF itab-bapi.
DATA ibapi LIKE STANDARD TABLE OF itab-bapi.
PARAMETERS: sel_file(1500) TYPE c default ' ' OBLIGATORY LOWER CASE.
PUT THE TEXT FILE PATH TO P_FILE
p_file = sel_file.
Copy the file from the workstation to the server ****
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = p_file
<b>FILETYPE = 'ASC'
HAS_FIELD_SEPARATOR = 'X'</b>
TABLES
data_tab = itab-bapi[]
EXCEPTIONS
file_open_error = 1
file_read_error = 2
no_batch = 3
gui_refuse_filetransfer = 4
invalid_type = 5
no_authority = 6
unknown_error = 7
bad_data_format = 8
header_not_allowed = 9
separator_not_allowed = 10
header_too_long = 11
unknown_dp_error = 12
access_denied = 13
dp_out_of_memory = 14
disk_full = 15
dp_timeout = 16
not_supported_by_gui = 17
error_no_gui = 18
OTHERS = 19.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
MESSAGE e012(zea_spms) WITH 'Method' 'GUI_UPLOAD' sy-subrc.
&1 &2 issued return code &3
ELSE.
pit_data[] = lit_data[].
ENDIF.
ENDIF.
loop at itab-bapi.
write: /5 itab-bapi-io_name,
20 itab-bapi-io_type,
30 itab-bapi-io_txsht,
50 itab-bapi-io_txlng,
75 itab-bapi-io_datatype,
85 itab-bapi-io_length.
endloop.
SELECT THE LOCATION FOR TEXT FILE
AT SELECTION-SCREEN ON VALUE-REQUEST FOR sel_file.
CALL FUNCTION 'WS_FILENAME_GET'
EXPORTING
def_filename = ''
def_path = 'C:\'
mask = ',Documentos de texto (*.txt), *.txt.'
mode = ''
IMPORTING
filename = p_file
EXCEPTIONS
inv_winsys = 1
no_batch = 2
selection_cancel = 3
selection_error = 4
OTHERS = 5.
find '.txt' IN p_file.
if sy-subrc <> 0.
concatenate p_file '.txt' into sel_file.
else.
sel_file = p_file.
endif.
Create InfoObject through BAPI Function
*CALL FUNCTION 'BAPI_IOBJ_CREATE'.
*IMPORTING
VALUE(DETAILS) LIKE BAPI6108 STRUCTURE BAPI6108
*EXPORTING
VALUE(INFOOBJECT) LIKE BAPI6108-INFOOBJECT
VALUE(RETURN) LIKE BAPIRET2 STRUCTURE BAPIRET2
TABLES
COMPOUNDS STRUCTURE BAPI6108CM OPTIONAL
ATTRIBUTES STRUCTURE BAPI6108AT OPTIONAL
NAVIGATIONATTRIBUTES STRUCTURE BAPI6108AN OPTIONAL
ATRNAVINFOPROVIDER STRUCTURE BAPI6108NP OPTIONAL
HIERARCHYCHARACTERISTICS STRUCTURE BAPI6108HC OPTIONAL
ELIMINATION STRUCTURE BAPI6108IE OPTIONAL
RETURNTABLE STRUCTURE BAPIRET2 OPTIONAL
Activate InfoObject through BAPI Function
CALL FUNCTION 'BAPI_IOBJ_ACTIVATE_MULTIPLE'
*ENDFORM. " RETRIEVE_DATASET
This program is working fine. You can test it.
Only problem is as the column headings are big for some columns, they are getting truncated which you can always change by changing the column width in declaration
Please let me know if this helps.
ashish -
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 -
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 -
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 -
Conversion of a string output and store them into the internal table fields
Hi,
I'm writing a program in which I'm populating the values generated in TCODE- 'AL11' I'm able to retrieve the data in string format but I've to break the string and put the values in an internal table. The internal table has fields of various lengths and no specific position where I can use a delimiter and use the Split command.
Kindly provide me suggestions how I can break the string and assign the values in the fields of the internal table.
Regards,
Sreedhar.Hi,
Take the screen fields length and create an internal table.
loop the internal table and first split the string at delimeter( use cl_abap_char_utilities)
CONSTANTS:
c_delimiter TYPE c VALUE
cl_abap_char_utilities=>horizontal_tab,
c_delimiter_enter TYPE c VALUE
cl_abap_char_utilities=>cr_lf.
loop at itab into fs.
SPLIT w_str AT c_delimiter_enter INTO w_str w_dummy .
" SPLITTING AT 'ENTER KEY'
SPLIT w_str AT c_delimiter INTO
" SPLITTING AT 'TAB'
fs-f1,
fs-f2.
append fs to itab.
clear fs.
endloop. -
Initializing values in an internal table
hi
how to initialize values in a internal table
according to my requirement i need to initialize (both character and currency) values present in the internal table based on certain conditions
vamsihi
As i understood you want to clear only selected fileds not the complet record..
create a Field symobl the loop at the table.. inside the loop check the condtion the just clear the filed.
example: you have itab type mara.
then
FIELD-SYMOBOLS <FS_WA_ITAB> TYPE MARA.
LOOP AT ITAB ASSIGNING <FS_WA_ITAB>.
IF X = XXX (YOUR CONDITION)
CLEAR: <FS_WA_ITAB>-FIELD2,
<FS_WA_ITAB>-FIELD3. (If u want to clear only filed2 and field3)
clear <FS_WA_ITAB>. (if you want to cleatr the complete record)
ENDIF.
ENDLOOP.
Why iam suggestin the filed-symobol is.. it is direcltly work on internal table body so u no need to update the table agian
Please Close this thread.. when u r problem is solved
Reward if Helpful
Regards
Naresh Reddy K -
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 -
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. -
Transferring checkbox values on ALV to value in the internal table?
Hi,
I'm using an ALV grid (CL_GUI_ALV_GRID) to display an internal table. I want users to be able to select one or many rows and those checked lines to be marked as X in my internal table. I have a field, check(1), in my internal table displayed on the ALV, but when I tick one line on the ALV and debug, I don't see an X in the check field on that line in my internal table.
I've successfully written code to select and deselect all lines and those values copy back to my internal table so why don't the single lines?
CASE sy-ucomm.
WHEN 'SELECT_ALL'.
* select all lines
LOOP AT tbl_data INTO wa_data.
MOVE 'X' TO wa_data-check.
MODIFY tbl_data FROM wa_data.
ENDLOOP.
WHEN 'DESELECT'.
* deselect all lines
LOOP AT tbl_data INTO wa_data.
CLEAR wa_data-check.
MODIFY tbl_data FROM wa_data.
ENDLOOP.
ENDCASE.
Do I have to add some code in the PAI to transfer the values?
Any suggestions welcome,
GillYes, I have.
The checkbox is appearing on the screen and is populated/cleared when I click the select/deselect buttons (this transfers the values in my internal table to the screen). But when I just tick one line and then debug that line isn't showing as having X in the check field in my internal table.
Somehow I need to transfer the tick values on screen to my internal table.
Maybe you are looking for
-
So I'm trying to help a friend with her game progress and I'm on her icloud, gamecenter, and appstore accounts on my phone, but her data won't show up! I've even redownloaded the game multiple times. Please help!!
-
HT203987 My Apple iPad won't shut off or close down. How do I get it to shut off'
I Have an Apple IPad tablet.it is a 32 gb. IOS 8.1.3 when I try to shut it down I know there use to be a bar that you slide to close it.but now I can't find it . I held the button down for 10 to 20 seconds but it still won't shut off. If I let it go
-
I was running run in test on my laptop but it failed giving me this massage: Failure ID: UBQ78X-0007N8-MFKT0J-C0A603 Product ID: A6F43EA#BH5.. What does this mean?
-
How to download and re-install Adobe Creative Suite Design & Web Premium CS6 Win
How do I download and re-install Adobe Creative Suite Design & Web Premium CS6 Win?
-
Hi, I want to Query records which are created between 2 dates. I can use trunc(creation_date) this will give all the records for that day. I have to run a program every 15-20 minutes. following is an example example sysdate = 1/19/03 1:03:42 PM recor