Include space between two variables from internal table
Hi Experts,
I have an internal table with 4 fields with values for a b c d , i have to arrange them in the specific order so that i can download all the data in a text file.
the first 3 variables are already arranged , the format is a bc, but the var d should be put in a specific positon after predefined spaces from var c.
Please refer below for the sample of of the output text file. In this example:
a = A20N
b = 7227802
c = 0300207
d = 010109
Space between c & d is determined by a POS variable in internal table
a b c d
A20N 72278020300207 010109
A20A 72278020300207 21
A20N 72278020300207 2511100
A21F 72278020300207 Van Capellen
A21G 72278020300207 Tim
A20E 72278020300207 1
A20T 72278020300207 2
A20T 72278020300207 1
A20E 72278020300207 01
A20E 72278020300207 Vilvoorde
plz help me out as i have to resolve this as soon as possible.
Hi,
Check this sample code using offsets, and modify as per ur requirement.
DATA : L1 TYPE I.
DATA : L2 TYPE I.
DATA : L3 TYPE I.
DATA : BEGIN OF ITAB OCCURS 0,
A(30) TYPE C,
B(30) TYPE C,
C(30) TYPE C,
D(30) TYPE C,
POS(2) TYPE C,
END OF ITAB.
DATA : TEXT(120) TYPE C.
START-OF-SELECTION.
BREAK-POINT.
ITAB-A = 'ABC'.
ITAB-B = 'IND'.
ITAB-C = 'CATOR'.
ITAB-D = 'FINAL'.
ITAB-POS = '3'.
APPEND ITAB.
CLEAR ITAB.
LOOP AT ITAB.
L1 = STRLEN( ITAB-A ).
L2 = STRLEN( ITAB-B ).
L3 = STRLEN( ITAB-C ).
TEXT = ITAB-A.
L1 = L1 + 1.
TEXT+L1 = ITAB-B.
L1 = L1 + L2.
TEXT+L1 = ITAB-C.
L1 = L1 + L3 + ITAB-POS.
TEXT+L1 = ITAB-D.
CLEAR L1.
CLEAR L2.
CLEAR L3.
ENDLOOP.
WRITE : TEXT.
Rgds
siva
Similar Messages
-
I need to retrieve the a set of rows in between two rows from a table.
consider employees table and primary key employee_id.
With out using EMPLOYEE_ID column in the where clause or between clause, I need to get the records between 104 and 116 or a set of records between two rows.
Can any one help me in this... i know this is simple but am just a fresher to oracle development... help me grow....
Thanks,
Arunya at last i got the out put... thank guys for thinking with me....
SELECT rownum, employee_id FROM (SELECT rownum, employee_id FROM employees ORDER BY employee_id)
WHERE ROWNUM <=8
MINUS
SELECT rownum, employee_id FROM (SELECT rownum, employee_id FROM employees ORDER BY employee_id) WHERE ROWNUM <= 4 -
How to get space between two values in a single cell of a table.
hello,
how to get space between two values in a single cell of a table.
thanks a lot.
kailash.sorry i got the answer.
-
Need to eliminate Space between two Pivot table view in OBIEE 11g
Hi,
I have a requirement to eliminate space between two pivot table views. In a single report I have two Pivot table with two different column, I placed both of them one after another, but I need to eliminate the space between two pivot table views as if it should show as a single pivot table in OBIEE 11g.
Could anyone please let me know how I can do this in OBIEE 11g?
Thanks in Advance
Anirban MitraIf I create narrative view it will be another view. And if I put that in between that two pivot view, it will show the space. I need to remove space between two pivot table within a single report so that it can appear as a single pivot view.
Thanks -
Dear Experts,
I need a solution for importing from an internal table.
Two variables I_EXP01 and I_EXP02 containing an xml stream have been exported to the database using the following syntax
and depending on the size of I_EXP01 and I_EXP02 two or more entries are created in table LTEX.
EXPORT
L_SAPRL
I_EXP01
I_EXP02
TO DATABASE LTEX(LT)
ID LS_LTEXKEY.
But now i have a few entries of table LTEX in an internal table and they need to be imported from the internal table.
What would be the syntax to import from internal table so that after importing I can de-serialise the data from XML to ABAP.
Thanks & Regards,
AshwiniTry this and let me know if it works:
IMPORT
L_SAPRL
I_EXP01
I_EXP02
To
L_SAPRL1 (same type as above)
I_EXP011 (same type as above)
I_EXP021 (same type as above)
FROM DATABASE LTEX(LT)
ID LS_LTEXKEY.
if it is not working. try using seperate statements for each internal table and see.
Thanks,
Venkatesh.
Edited by: venkatesh333 on Jul 27, 2011 6:23 AM -
Export - Import In ABAP ( for variables and internal table)
how can we pass value for the variable and internal table using Export and Import?
data: var type sy-uzeit.
var = sy-uzeit.
EXPORT var TO MEMORY ID 'TIME'.
data: var type sy-uzeit.
IMPORT var FROM MEMORY ID 'TIME'.
write:/ var,sy-subrc,sy-uzeit.
i found var value 0 while importing.
what is the right syntax for passing value of variable and internaltable.
regards,
dushyant.Hi,
There are two possible solutions.
Solution1:
Program1.Should be run before atleast once so that TIME should be filled.
data: var type sy-uzeit.
var = sy-uzeit.
EXPORT var TO MEMORY ID 'TIME'.
Program2.IF the TIME is filled,then only it will produce the result.
data: var type sy-uzeit.
clear var.
IMPORT var FROM MEMORY ID 'TIME'.
write:/ var, sy-subrc, sy-uzeit.
Solution2:
Single program:
data: var type sy-uzeit.
var = sy-uzeit.
EXPORT var TO MEMORY ID 'TIME'.
clear var.
IMPORT var FROM MEMORY ID 'TIME'.
write:/ var, sy-subrc, sy-uzeit.
Kindly reward points by clikcing the star on the left of reply,if it helps. -
Difference between line type and internal table?
Hi..
I wanted to know, what is the difference between Line type and Internal Table?Hi,
Before the 4.7 release in SAP if we want to define an internal table we have to write the defination using the occurs statement and we need to define all the fields using INCLUDE STRUCTURE or indidually all the fields ine by one.
From 4.7 release of R/3 SAP introduced the Line type concept and it's part of the ABAP OOPS concept. for internal table defination we don't need to use the occur statements. Instead INCLUDE structure we need to create a Line type for that structure in Se11 and then we can define the internal table like :
DATA : ITAB TYPE TABLE OF <LINE_TYPE>.
Only thing is this table will be a table without header. So for internal table processing we need to define a work area structure of type line of line type . EX:
DATA: WA_ITAB TYPE LINE OF <LINE_TYPE>.
Hope this helps.
Thanks,
Greetson -
Read contents of changing fields from internal table
Hi Folks,
Please help me in my query below:
Consider there is a Z-table with two fields TABNAM and FIELD having values KNA1 and NAME1 respectively.
In my report I have fetched entries for customers from KNA1. Now based on the field from Z-table I want to populate a variable suppose V_FREE_VAR with the value from KNA1 table.
Here V_FREE_VAR is of CHAR200 so that it accomodate all types of values from KNA1.
The value of Z-table FIELD can change daily i.e next day the value may be PSTLZ.
So how can I read the particular field from internal table as the field to be read is dynamic.
Note: using case is not feasible.
Thanks in advance.
Regards,
Shardul@Hartmut P
As Rob said i want to get the value of the field from internal table. the code is something like this.
I_KNA1 contains records for customers.
Suppose values of Z-table are in internal table I_TEMP_TABLE.
Entries in I_TEMP_TABLE are as follows
TABNAME FIELDNAME
KNA1 NAME1
The value of FIELNAME in Z-table can be changed
Loop at I_TEMP_TABLE into WA_TEMP_TABLE.
Read I_KNA1 into WA_KNA1 with key KUNNR = '0001002234'.
IF SY-SUBRC EQ 0.
CASE WA_TEMP_TABLE-FIELDNAME.
WHEN 'NAME1'.
V_VAR = WA_KNA1-NAME1.
WHEN 'PSTLZ'
V_VAR = WA_KNA1-PSTLZ.
ENDIF.
But using case is not appropriate as KNA1 contains 176 fields. -
Difference between work area and internal tables.
Hi I wanna know the difference between work area and internal tables.
what happend if i give with out header line in internal table.
also how to assosiate work area to internal table in that scenario.Hi Balaji..
The internal table is an ABAP runtime object which has two parts the Body and the header.
Whereas a work area cannot have a body.. It is mere a field or group of fields which can hold values at runtime..
In the SAP higher versions mySAP ERP, the use of tables with header line is made obsolete.. But there is absolutely no problem with the same..
Just think that when you define an internal table with occurs or with header line statement, the system automatically creates a workarea with this table, using which you can access the contents in the bosy of tyhe table.. You can read a record from the table body to this header or add a record in the header to the internal table body..
When you work with a table ITAB without a header line, you can not use statements like READ TABLE, APPEND, INSERT etc without giving an explicit work area..
Suppose i have an internal table like:
DATA : itab TYPE STANDARD TABLE OF t001.
This table will not have a header with it.
If you will use APPEND itab. The compilor will give error.
Here i will create a work area with same structure of the table.
DATA : e_wa TYPE t001.
Now i will write:
APPEND e_wa TO itab.
READ TABLE itab INTO e_wa WITH KEY xxxxxx
LOOP AT itab INTO e_wa... etc..
In a better approach we use Field symbols with such tables, instead of structures
FIELD-SYMBOLS: <fs_itab> TYPE t001.
So,
LOOP AT itab ASSIGNING <fs_itab>
READ TABLE itab ASSIGNING <fs_itab> etc.. However we can not use field symbols in few cases..
I hope this will help you..
Thanks and Best Regards,
Vikas Bittera.
**Points for usefull answers** -
Can not insert or update [TABLE] from internal table in method
I've faced a problem with OO abap. I've tried to insert into [ TABLE ] from internal table, but i've got error msg after i compiled.
"An explicit work area is necessary in the OO context. Use "INSERT wa INTO [TABLE] itab""
After i changed to loop in work area and INSERT INTO [TABLE] VALUES gw_data., everything is fine, can compile and run.
This is error code.
METHOD set_data_to_table.
REFRESH gi_data.
CLEAR gi_data.
IF gi_file[] IS NOT INITIAL.
* Set data for modify table
LOOP AT gi_file INTO gw_file.
MOVE-CORRESPONDING gw_file TO gw_data.
me->conversion_input( EXPORTING im_vendor = gw_data-vendor
CHANGING ch_vendor = gw_data-vendor ).
APPEND gw_data TO gi_data.
ENDLOOP.
INSERT [TABLE] FROM TABLE gi_data.
* LOOP AT gi_data INTO gw_data.
* INSERT INTO [TABLE] VALUES gw_data.
* IF sy-subrc = 0.
* COMMIT WORK.
* ELSE.
* ROLLBACK WORK.
* ENDIF.
* ENDLOOP.
ELSE.
MESSAGE 'No data found' TYPE 'I'.
ENDIF.
ENDMETHOD. "set_data_to_tableHi Matthew,
I think there is no difference in database insert between OO and non-OO.
The correct syntax according to ECC600 online documentation is
[Inserting Several Lines|http://help.sap.com/saphelp_erp2005vp/helpdata/en/fc/eb3a6d358411d1829f0000e829fbfe/content.htm]
To insert several lines into a database table, use the following:
INSERT target FROM TABLE itab \[ACCEPTING DUPLICATE KEYS].
This writes all lines of the internal table itabto the database table in one single operation. If one or more lines cannot be inserted because the database already contains a line with the same primary key, a runtime error occurs. You can prevent the runtime error occurring by using the addition ACCEPTING DUPLICATE KEYS.
Whenever you want to insert more than one line into a database table, it is more efficient to work with an internal table than to insert the lines one by one.
I think the syntax
INSERT my_dbtable FROM TABLE gi_data.
should work, your suggestion may lead to syntax error.
Regards,
Clemens -
Create XML file from internal table and vise a versa
Hi Friends,
I have requirement to create an XML string from internal table data and also read XML string data to internal table.
Can anybody tell are there any Function Modules or methods existing for this?
Thanks.
Krishna Yerram.1. Write XSLT program. T.code XSLT . e.g. XSLT name "ZTRANS".
2. Write ABAP program
Which includes declaration of internal tables
that you need "IT_DATA".
Upload XML data to an internal table "IT_XML "
use below statement to convert XML to internal table.
Call transformation ZTRANS
source XML IT_XML
result IT_DATA. -
Error-No more storage space available for extending an internal table.
Hi Experts,
i am facing problem in a program . its showing runtime error.
Short text
No more storage space available for extending an internal table.
its showing error at
IF sy-subrc NE 0.
REFRESH p_wip_tab.
ELSE.
i_wip_tab-pspnr = i_internal_and_external-pspnr_prps.
LOOP AT p_wip_tab.
MOVE-CORRESPONDING p_wip_tab TO i_wip_tab.
==> APPEND i_wip_tab.
ENDLOOP.
ENDIF.
DATA: l_billable_tab LIKE p_billable_tab OCCURS 0 WITH HEADER LINE,
p_wip_tab LIKE zpswip OCCURS 0 WITH HEADER LINE.
DATA: BEGIN OF i_wip_tab OCCURS 0,
pspnr LIKE prps-pspnr.
INCLUDE STRUCTURE zpswip.
DATA: pernr_name LIKE pa0002-vorna,
END OF i_wip_tab.
How i can resolve this problem if anybody knows it then please reply me as soon as possible.
ThanksHello.
Probably you fill the internal table with too much data and it cannot hold that much.
You can either redesign the program so that it processes the data in batches of, say 100000 records, or contact your BASIS team and ask for their help. They could possible assign more memory to the running applications.
Reward if helpful.
Regards,
George -
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. -
Fill database table from internal table
I made one table ZDISP_CHDOC_CC and want to fill that table from internal table.and i got runtime error. that duplicate entry
and two entry are like 10 200000 likhp 10
10 200000 likp 10
DESCRIBE TABLE IT_CHDOC .
LOOP AT IT_CHDOC.
INSERT ZDISP_CHDOC_CC FROM IT_CHDOC.
endloop.
IF SY-SUBRC = 0.
COMMIT WORK.
ELSE.
and when i used following then only one entry is insreted.
DESCRIBE TABLE IT_CHDOC .
LOOP AT IT_CHDOC.
INSERT ZDISP_CHDOC_CC FROM IT_CHDOC.
IF SY-SUBRC = 0.
COMMIT WORK.
endloop.
ELSE.Hi,
Replace your current code
DESCRIBE TABLE IT_CHDOC .
LOOP AT IT_CHDOC.
INSERT ZDISP_CHDOC_CC FROM IT_CHDOC.
endloop.
IF SY-SUBRC = 0.
COMMIT WORK.
ELSE.
WITH THE ONE GIVEN BELOW
DESCRIBE TABLE IT_CHDOC .
INSERT ZDISP_CHDOC_CC FROM TABLE IT_CHDOC ACCEPTING DUPLICATE KEYS.
IF SY-SUBRC = 0.
COMMIT WORK.
ELSE.
Regards,
Siddarth -
Hi,
I want to delete from internal table some regords.
I write code:
delete isrot where bldat < '01.09.2005'.
it doesn't work, what is wrong?
regards,
Joannahi,
you write the statement like....
<b>delete FROM isrot where bldat < '01.09.2005'.</b>
now it will work...
To select the lines that you want to delete using a condition, use the following:
<b>DELETE FROM <target> WHERE <cond> .</b>
All of the lines in the database table that satisfy the conditions in the WHERE clause are deleted. The FROM expression must occur between the keyword and the database table.
You should take particular care when programming the WHERE clause to ensure that you do not delete the wrong lines. For example, if you specify an empty internal table in a dynamic WHERE clause, all of the lines in the table are deleted.
If at least one line is deleted, the system sets SY-SUBRC to 0, otherwise to 4. SY-DBCNT contains the number of lines deleted.
follow this link for more information on internal table operation.
http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb3aef358411d1829f0000e829fbfe/content.htm
regards,
Ashok Reddy
Message was edited by:
Ashok Reddy
Maybe you are looking for
-
Every time I try to play a song, try to buy anything or my iPod tries to sync, iTunes crashes. My computer sends me an error message. I tried creating another iTunes account but it didn't work. Help...
-
Mpd won't resume in the middle of a track
When I stop mpd (/etc/rc.d/mpd stop) the state file (~/.mpd/mpd.state) is created/updated and the contents look to be correct. However, when I start mpd (/etc/rc.d/mpd start) mpd won't start at the same place within the track that is indicated by the
-
Iphone not recognized in itunes after upgrade to snow leopard
after upgrading to snow leopard, iPhone not recognized in iTunes & does not show up. Account OK in iTunes. Any idea how to resume normal sync ?
-
How sales order is created from inbound purchase order?
Hi experts, My doubt is how a sales order is created when a customer sends a purchase order through EDI. My doubt really starts here.. (how the Idoc is posted). Case 1 : Just the process code is checked and corresponding function module is called and
-
Multiple instances of AppleSpell running
Fast user switching enabled. I stay logged in. My daughter logs in for a while and uses nothing but Safari. She logs out completely. When I get back on, there are five instances of AppleSpell running under her name and one running under mine. What's