How to move "write statements" to a internal table...
hi experts.
i did "write statement" as follows
| a | b | c | d |
and then i want to insert to internal table after the screen contents as above.
the internal table exist only one field as follows.
data: begin of gt_itab,
line type char255,
end of gt_itab.
can i do this one?
i wish your answer.
thanks.
Regards
FM.
Edited by: yuntae kim on Jun 4, 2009 3:07 PM
Hi, you can try to export the list to memory. Like the code below:
DATA: tg_str TYPE TABLE OF listzeile,
tl_mem TYPE TABLE OF abaplist,
ilist TYPE TABLE OF abaplist WITH HEADER LINE.
EXPORT LIST TO MEMORY
CALL FUNCTION 'LIST_TO_MEMORY'
EXPORTING
list_index = 0
TABLES
listobject = ilist
EXCEPTIONS
empty_list = 1.
READ THE LIST
CALL FUNCTION 'LIST_FROM_MEMORY'
TABLES
listobject = tl_mem
EXCEPTIONS
not_found = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno.
EXIT.
ENDIF.
CHANGE LIST TO ASCII
CALL FUNCTION 'LIST_TO_ASCI'
TABLES
listasci = tg_str
listobject = tl_mem
EXCEPTIONS
empty_list = 1
list_index_invalid = 2
OTHERS = 3.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno.
EXIT.
ENDIF.
On table tg_str you gonna have the:
a
b
c
d
I hope it helps.
Similar Messages
-
Move Field symbol data to Internal table
Dear All,
Please suggest how to move field symbol data to internal table. The requirement is I have dynamic data in Field symbol which to move to table parameter of a function module.
Thanks in Advance
Rams.Dear All,
In need to pass tabular data i.e. multiple entries from field symbol to the table parameter of the custom function module.
Field symbol is declared as below:
FIELD-SYMBOLS: <FS_EXCEL_TAB> TYPE STANDARD TABLE,
<FS_TABLE_HEADER> .
DATA WA_PD LIKE PRICE_DOWNLOAD.
APPEND <FS_TABLE_HEADER> TO <FS_EXCEL_TAB>.
CLEAR <FS_TABLE_HEADER>.
WA_PD-VKORG = <FS_EXCEL_TAB>-VKORG.u201D Problem while using this statement
APPEND WA_PD TO PRICE_DOWNLOAD.
CLEAR WA_PD.
Field symbol <FS_EXCEL_TAB> is populated like this.
VKORG | KUNNR_SH | KUNNR_SP |
0015 | 102105 | 102105 |
Now I need to move this data to table in tables parameter of custom fucntion module.
Thanks in advance,
Rams -
How to assign select-option values to internal table
hi all,
how to assign select-option values to internal table
thanks in advance.Hi,
You just need to loop at your select-option field and take the values from low and high fields.
for. e.g
loop at s_werks .
move:s_werks-low to <your itab>
if not s_werks-high is initial .
move: s_werks-high to <youritab>
endif .
append <your itab>
endloop .
OR use select statement.
regards,
Omkar.
Message was edited by:
Omkaram Yanamala
Message was edited by:
Omkaram Yanamala -
How to submit a report ,Passing the internal tables from parent report
How to submit a report ,Passing the internal tables from the parent report ?
The SUBMIT statement executes a report from within a report. i.e. you could have a drill-down which
calls another report. Can only execute reports of type '1'.
*Code used to execute a report
SUBMIT Zreport.
*Code used to populate 'select-options' & execute report
DATA: seltab type table of rsparams,
seltab_wa like line of seltab.
seltab_wa-selname = 'PNPPERNR'.
seltab_wa-sign = 'I'.
seltab_wa-option = 'EQ'.
load each personnel number accessed from the structure into
parameters to be used in the report
loop at pnppernr.
seltab_wa-low = pnppernr-low.
append seltab_wa to seltab.
endloop.
SUBMIT zreport with selection-table seltab
via selection-screen.
*Code used to populate 'parameters' & execute report
SUBMIT zreport with p_param1 = 'value'
with p_param2 = 'value'.
Other additions for SUBMIT
*Submit report and return to current program afterwards
SUBMIT zreport AND RETURN.
*Submit report via its own selection screen
SUBMIT zreport VIA SELECTION-SCREEN.
*Submit report using selection screen variant
SUBMIT zreport USING SELECTION-SET 'VARIANT1'.
*Submit report but export resultant list to memory, rather than
*it being displayed on screen
SUBMIT zreport EXPORTING LIST TO MEMORY.
Once report has finished and control has returned to calling
program, use function modules LIST_FROM_MEMORY, WRITE_LIST and
DISPLAY_LIST to retrieve and display report.
*Example Code (Retrieving list from memory)
DATA BEGIN OF itab_list OCCURS 0.
INCLUDE STRUCTURE abaplist.
DATA END OF itab_list.
DATA: BEGIN OF vlist OCCURS 0,
filler1(01) TYPE c,
field1(06) TYPE c,
filler(08) TYPE c,
field2(10) TYPE c,
filler3(01) TYPE c,
field3(10) TYPE c,
filler4(01) TYPE c,
field4(3) TYPE c,
filler5(02) TYPE c,
field5(15) TYPE c,
filler6(02) TYPE c,
field6(30) TYPE c,
filler7(43) TYPE c,
field7(10) TYPE c,
END OF vlist.
SUBMIT zreport EXPORTING LIST TO MEMORY.
CALL FUNCTION 'LIST_FROM_MEMORY'
TABLES
listobject = itab_list
EXCEPTIONS
not_found = 4
OTHERS = 8.
CALL FUNCTION 'LIST_TO_ASCI'
EXPORTING
list_index = -1
TABLES
listasci = vlist
listobject = itab_list
EXCEPTIONS
empty_list = 1
list_index_invalid = 2
OTHERS = 3.
IF sy-subrc NE '0'.
WRITE:/ 'LIST_TO_ASCI error !! ', sy-subrc.
ENDIF.
Submit report as job
*Submit report as job(i.e. in background)
data: jobname like tbtcjob-jobname value
' TRANSFER TRANSLATION'.
data: jobcount like tbtcjob-jobcount,
host like msxxlist-host.
data: begin of starttime.
include structure tbtcstrt.
data: end of starttime.
data: starttimeimmediate like btch0000-char1.
Job open
call function 'JOB_OPEN'
exporting
delanfrep = ' '
jobgroup = ' '
jobname = jobname
sdlstrtdt = sy-datum
sdlstrttm = sy-uzeit
importing
jobcount = jobcount
exceptions
cant_create_job = 01
invalid_job_data = 02
jobname_missing = 03.
if sy-subrc ne 0.
"error processing
endif.
Insert process into job
SUBMIT zreport and return
with p_param1 = 'value'
with p_param2 = 'value'
user sy-uname
via job jobname
number jobcount.
if sy-subrc > 0.
"error processing
endif.
Close job
starttime-sdlstrtdt = sy-datum + 1.
starttime-sdlstrttm = '220000'.
call function 'JOB_CLOSE'
exporting
event_id = starttime-eventid
event_param = starttime-eventparm
event_periodic = starttime-periodic
jobcount = jobcount
jobname = jobname
laststrtdt = starttime-laststrtdt
laststrttm = starttime-laststrttm
prddays = 1
prdhours = 0
prdmins = 0
prdmonths = 0
prdweeks = 0
sdlstrtdt = starttime-sdlstrtdt
sdlstrttm = starttime-sdlstrttm
strtimmed = starttimeimmediate
targetsystem = host
exceptions
cant_start_immediate = 01
invalid_startdate = 02
jobname_missing = 03
job_close_failed = 04
job_nosteps = 05
job_notex = 06
lock_failed = 07
others = 99.
if sy-subrc eq 0.
"error processing
endif. -
How to collect similar record from the internal table
I need to collect exact matched records from 1 internal table to another internal table by searching 5 fields. I need to have records which are exactly matched for 5 fields. i have written a code wich is mention below it gave me only similar records but not 100% matched record.. would you like to help me. any correction, suggetion,. Will be great help to me.
To get exact match of 5 records, do as follows.
Check whether internal table gives only one record or not after READ statement.If internal table gives more than one entry for READ then the results will be improper.
I think there is no need of READ statement on same internal table within LOOP. I commented the same in code.
sort i_bp_p by title initials name_last idnumber idtype f50code rbcode. "acc_num.
loop at i_bp_p into wa_i_bp_p.
*lv_tabix = sy-tabix.
*read table i_bp_p index lv_tabix into wa_i_bp_p.read table i_but0id into wa_but0id with key idnumber = wa_i_bp_p-idnumber
idtype = wa_i_bp_p-idtype binary search.
if sy-subrc = 0.
read table i_but000 into wa_but000 with key title = wa_i_bp_p-title
initials = wa_i_bp_p-initials
name_last = wa_i_bp_p-name_last binary search.
if sy-subrc = 0.
read table i_but0is into wa_but0is with key f50code = wa_i_bp_p-f50code
rbcode = wa_i_bp_p-rbcode binary search.
if sy-subrc = 0.
move-corresponding wa_i_bp_p to i_bp_p100.
append i_bp_p100.
endif.
endif.
endif.
endloop.
sort i_bp_p100 by partner.
loop at i_bp_p100.
write : /10 i_bp_p100-partner,
20 i_bp_p100-title,
30 i_bp_p100-initials,
40 i_bp_p100-name_last,
53 i_bp_p100-idnumber,
70 i_bp_p100-idtype,
85 i_bp_p100-rbcode,
95 i_bp_p100-f50code.
endloop.
sort i_bp_p by title initials name_last idnumber idtype f50code rbcode. "acc_num.
loop at i_bp_p into wa_i_bp_p.
lv_tabix = sy-tabix.
read table i_bp_p index lv_tabix into wa_i_bp_p.
if sy-subrc = 0.
read table i_but0id into wa_but0id with key idnumber = wa_i_bp_p-idnumber
idtype = wa_i_bp_p-idtype binary search.
if sy-subrc = 0.
read table i_but000 into wa_but000 with key title = wa_i_bp_p-title
initials = wa_i_bp_p-initials
name_last = wa_i_bp_p-name_last binary search.
if sy-subrc = 0.
read table i_but0is into wa_but0is with key f50code = wa_i_bp_p-f50code
rbcode = wa_i_bp_p-rbcode binary search.
if sy-subrc = 0.
move-corresponding wa_i_bp_p to i_bp_p100.
append i_bp_p100.
endif.
endif.
endif.
endif.
endloop. -
How to code header and items in internal table
Hi all,
Iam new to abap.
I have to write a report in internal table , for 1 header item related child items must exist,suppose if header is org then the child like branches in diff cities must be printed under that org and other org ther related branches etc.
can u tell me how i have to approach this with code.
Thanx.Hi MJN,
U can either declare one internal table to hold the header & item data or u can declare two separate interal tables for each one of it.
Suppose i take only one internal table.
First declare a structure with all the relevant fields of the ORG & Branches then create an internal table for it.
Code:
TYPES:
Begin of t_struct,
org_field1 type <datatype> or <dataobj>,
org_field2 type <datatype> or <dataobj>,
branch_field1 type <datatype> or <dataobj>,
branch_field2 type <datatype> or <dataobj>,
END of t_struct.
Data:
t_data like table of t_struct with header line.
select <fields declared in struct> from ORG Inner Join Branch ON <org_field> = <branch_field>
where <some condition> into table t_data.
if sy-subrc <> 0.
message 'No Records Found:" type 'E'.
endif.
endselect.
Loop at t_data into t_data.
at new <org_field1>
write: org_field.
endat.
write: branch_field1, branch_field2.
endloop.
This shall solve the issue.
Thanks
Ravi -
How to insert select columns from one internal table to another
Hi,
How to insert select columns from one internal table to another based on condition as we do from a standart table to internal table.
regards,
SriramHi,
If your question is for copying data from 1 int table to other ;
we can use
APPEND LINES OF it_1 TO it_2.
or if they have different columns then:
loop at it_1 into wa_it1.
move wa_it1-data to wa_it2-d1.
apped wa_it2 to it_2.
clear wa_it2.
endloop.
thnxz -
Read statement into an internal table
Hi Experts,
In my report i have several read statements, now my requirement is i want to put all the read statements into an internal table, how do i achieve it???
Thank you!Hello Maya,
i want to know how many number of times the read statement is used .
Two ways:
1. use a counter after each read statement in your program and increase it by 1 everytime there is read statement and display the final value of the counter in the report that you want.
2. If you just want to know press (CNTRL + F) enter "READ" , select the radio button "In Main program" and then you will get all the read statement and can count it manually.
Hope I have not answered your question wrong. But if I have, please be more specific about your requirement so that many an help you.
Thanks,
Jayant Sahu. -
How to add new field into dynamic internal table
Hello Expert.
how to add new field into dynamic internal table.
PARAMETERS: P_TABLE(30). "table name
DATA: I_TAB TYPE REF TO DATA.
FIELD-SYMBOLS: <TAB> TYPE standard TABLE.
*Create dynamic FS
create DATA I_TAB TYPE TABLE OF (p_table).
ASSIGN I_TAB->* TO <TAB>.
SELECT * FROM (p_table) INTO TABLE <TAB>.
here i want to add one more field into <TAB> at LAST position and my
Field name = field_stype and
Field type = 'LVC_T_STYL'
could you please helpme out .Hi,
Please find the code below.You can add the field acc to your requirement.
Creating Dynamic internal table
TYPE-POOLS: slis.
FIELD-SYMBOLS: <t_dyntable> TYPE STANDARD TABLE, u201C Dynamic internal table name
<fs_dyntable>, u201C Field symbol to create work area
<fs_fldval> type any. u201C Field symbol to assign values
PARAMETERS: p_cols(5) TYPE c. u201C Input number of columns
DATA: t_newtable TYPE REF TO data,
t_newline TYPE REF TO data,
t_fldcat TYPE slis_t_fldcat_alv,
t_fldcat TYPE lvc_t_fcat,
wa_it_fldcat TYPE lvc_s_fcat,
wa_colno(2) TYPE n,
wa_flname(5) TYPE c.
Create fields .
DO p_cols TIMES.
CLEAR wa_it_fldcat.
move sy-index to wa_colno.
concatenate 'COL'
wa_colno
into wa_flname.
wa_it_fldcat-fieldname = wa_flname.
wa_it_fldcat-datatype = 'CHAR'.
wa_it_fldcat-intlen = 10.
APPEND wa_it_fldcat TO t_fldcat.
ENDDO.
Create dynamic internal table and assign to FS
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
it_fieldcatalog = t_fldcat
IMPORTING
ep_table = t_newtable.
ASSIGN t_newtable->* TO <t_dyntable>.
Create dynamic work area and assign to FS
CREATE DATA t_newline LIKE LINE OF <t_dyntable>.
ASSIGN t_newline->* TO <fs_dyntable>.
Populating Dynamic internal table
DATA: fieldname(20) TYPE c.
DATA: fieldvalue(10) TYPE c.
DATA: index(3) TYPE c.
DO p_cols TIMES.
index = sy-index.
MOVE sy-index TO wa_colno.
CONCATENATE 'COL'
wa_colno
INTO wa_flname.
Set up fieldvalue
CONCATENATE 'VALUE' index INTO
fieldvalue.
CONDENSE fieldvalue NO-GAPS.
ASSIGN COMPONENT wa_flname
OF STRUCTURE <fs_dyntable> TO <fs_fldval>.
<fs_fldval> = fieldvalue.
ENDDO.
Append to the dynamic internal table
APPEND <fs_dyntable> TO <t_dyntable>.
Displaying dynamic internal table using Grid.
DATA: wa_cat LIKE LINE OF fs_fldcat.
DO p_cols TIMES.
CLEAR wa_cat.
MOVE sy-index TO wa_colno.
CONCATENATE 'COL'
wa_colno
INTO wa_flname.
wa_cat-fieldname = wa_flname.
wa_cat-seltext_s = wa_flname.
wa_cat-outputlen = '10'.
APPEND wa_cat TO fs_fldcat.
ENDDO.
Call ABAP List Viewer (ALV)
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
it_fieldcat = fs_fldcat
TABLES
t_outtab = <t_dyntable>. -
How to change co-ordinates of an internal table in page 1 & 2 using offline adobe forms?
Hello All,
How to change co-ordinates of an internal table(main window data) from page 2 onwards in offline adobe forms. For e.g., I need to print my internal table around 3-4 lines along with header&footer(only 1st page)in page 1. From 2nd page onwards Internal table should print header and use remaining page til end.
Thanks in advance for your help.
Thank you,
Janakiram.Issue resolved...need to use content area option to achieve the same.
Thanks,
Janakiram. -
How to do parallel processing with dynamic internal table
Hi All,
I need to implement parallel processing that involves dynamically created internal tables. I tried doing so using RFC function modules (using starting new task and other such methods) but didn't get success this requires RFC enabled function modules and at the same time RFC enabled function modules do not allow generic data type (STANDARD TABLE) which is needed for passing dynamic internal tables. My exact requirement is as follows:
1. I've large chunk of data in two internal tables, one of them is formed dynamically and hence it's structure is not known at the time of coding.
2. This data has to be processed together to generate another internal table, whose structure is pre-defined. But this data processing is taking very long time as the number of records are close to a million.
3. I need to divide the dynamic internal table into (say) 1000 records each and pass to a function module and submit it to run in another task. Many such tasks will be executed in parallel.
4. The function module running in parallel can insert the processed data into a database table and the main program can access it from there.
Unfortunately, due to the limitation of not allowing generic data types in RFC, I'm unable to do this. Does anyone has any idea how to implement parallel processing using dynamic internal tables in these type of conditions.
Any help will be highly appreciated.
Thanks and regards,
Ashintry the below code...
DATA: w_subrc TYPE sy-subrc.
DATA: w_infty(5) TYPE c.
data: w_string type string.
FIELD-SYMBOLS: <f1> TYPE table.
FIELD-SYMBOLS: <f1_wa> TYPE ANY.
DATA: ref_tab TYPE REF TO data.
CONCATENATE 'P' infty INTO w_infty.
CREATE DATA ref_tab TYPE STANDARD TABLE OF (w_infty).
ASSIGN ref_tab->* TO <f1>.
* Create dynamic work area
CREATE DATA ref_tab TYPE (w_infty).
ASSIGN ref_tab->* TO <f1_wa>.
IF begda IS INITIAL.
begda = '18000101'.
ENDIF.
IF endda IS INITIAL.
endda = '99991231'.
ENDIF.
CALL FUNCTION 'HR_READ_INFOTYPE'
EXPORTING
pernr = pernr
infty = infty
begda = '18000101'
endda = '99991231'
IMPORTING
subrc = w_subrc
TABLES
infty_tab = <f1>
EXCEPTIONS
infty_not_found = 1
OTHERS = 2.
IF sy-subrc <> 0.
subrc = w_subrc.
ELSE.
ENDIF. -
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. -
How to store output of SQ01 into internal table.
Hello Experts
How to store output of SQ01 into internal table.
Thanks,
UmeshYou can't store the sq01 output into internal table.
Once you create the query it will generate the abap program, in that program you can see the contents.
Regards
Sasi -
How to pass the contents of an internal table to the IDoc FIDCC2?
Hi,
I have an internal table. Using its contents, I have to create an Idoc and do GL posting.
I have to use FIDCC2 Idoc and the function module IDOC_INPUT_FIDCC2.
Can u please let me know how to pass the contents of the internal table into the idoc FIDCC2 and do the GL posting?
Regards,
Balaji. RHi balaji,
use function IDOC_INBOUND_FROM_FILE. This will do half the process.
Documentation is missing, but program RSEINB00 explains something,
also some links
[http://help.sap.com/saphelp_nw70/helpdata/EN/dc/6b7f1543d711d1893e0000e8323c4f/frameset.htm]
[RSEINB00 does not work in background]
[RSEINB00 flat file to idoc uploading in XI]
[Loading flat idoc via report RSEINB00 into integration server fails]
Hope it helps.
Regards,
Clemens -
Read statement on dynamic internal tables
Hello All,
I have a dynamic internal table <G_T_ITAB> with fields F1, F2, F3 & F4 .
I want to read the internal table <G_T_ITAB>. So im using the below code.
LOOP AT G_T_DATA.
READ TABLE <G_T_ITAB> INTO <G_R_ITAB> WITH KEY F1 = G_T_DATA-F1.
IF SY-SUBRC <> 0.
ELSE.
ENDIF.
ENDLOOP.
But this is giving syntax error that F1 is not the field of <G_T_ITAB>. But the field is there in <G_T_ITAB>.
Can you suggest me to solve this issue. Or is there any other approach to use READ statement on dynamic internal tables.
Thanks in advance.
Best Regards,
Sasidhar Reddy Matli.Hi ,
Read this way....
FIELD-SYMBOLS:
<fs_str> type any,
<fs_lf_fval> type any,
<fs_lt_result_rate> type any table,
<fs_ls_result_rate> type any.
DATA:
lv_fname type string.
lv_fname = 'MATNR'.
assign component 'matnr' of structure <fs_str> to <fs_lf_fval>.
READ TABLE <fs_lt_result_rate> INTO <fs_ls_result_rate>
WITH KEY (lv_fname) = <fs_lf_fval>.
Thanks,
Shailaja Ainala.
Maybe you are looking for
-
March's TechNet Wiki Windows Server Guru Winners announced!!
The results for March'sTechNet Guru competition have been posted! http://blogs.technet.com/b/wikininjas/archive/2014/04/17/the-microsoft-technet-guru-awards-march-2014.aspx <- results page! Congratulations to all our new Gurus for March! We will be i
-
Hi Experts, I am trying to install Mobiliser platform 5.1 SP03 on redhat Linux system of AWS cloud. I have installed httpd 2.2 server on mob-web-1 server and it is running fine. But when I include Include /opt/sybase/httpd/conf/mobiliser_httpd_ssl.c
-
Transport acknowledgements for HTTP adapter
Hi, We have a scenarios ABAP Proxy --- BPM --- HTTP Receiver. In our send step when we use transport acknoledgemetn, I am getting a message saying Acknoledgment not possible. Does HTTP adapter support transport acknoledgements? Thanks, vinay.
-
In sapscript Address shoud display in local language
In the customer statement, the customer address details need to be displayed in local language of customer. How can we achieve this? Does the master data for the customer in KNA1 table need to be maintained in local language? Or else even though the
-
IPhone firmware update 3.1.3
+"Apple today released iPhone OS 3.1.3 for all iPhone and iPod touch models, addressing several specific bugs as well as offering fixes for a handful of security issues.+ +This update for the iPhone and iPod touch contains bug fixes and improvements,