‎2006 Jun 09 1:19 AM
Hi all,
I am using as follows
data : num1(60) type c value 'what'.
data: num2(10) type c value 'who'.
in the o/p i will be getting num2 after 61 column..correct...how to get num2 after num1 just seperated by tab..how to remove empty columns..i want o/p as:::
what who (seperated by tab space)
‎2006 Jun 09 8:14 PM
Hi all,
this is my exact code......
my 3rd row is not displaying anything....
just copy it and execute it is not working???????
tables : ekko.
*1st Record
data : record_identifier(3) type c value '100',
sp_id(3) type c value '100',
sp_name(60) type c value 'USA',
creation_date(8) type c,
creation_time(6) type c,
file_format(3) type c value 'MATCH',
file_version(3) type c value '1.1'.
*2nd Record
data : record_identifier1(3) type c value '110',
org_id(4) type c value '1744',
org_name(60) type c value 'score'.
*3rd Record
data : begin of itab occurs 0,
record_identifier2(3) type c value '120',
ebeln like ekko-ebeln,
lifnr like ekko-lifnr,
name1 like lfa1-name1,
org_id1(4) type c value '1744',
end of itab.
*4th Record
data : record_identifier3(3) type c value '130',
org_id2(4) type c value '1744',
org_name1(60) type c value 'UK',
detail_record_count(2) type c.
*5th Record
data : record_identifier4(3) type c value '140',
extract_record_count(2) type c,
file_record_count(2) type c.
select-options : so_lifnr for ekko-lifnr.
*output string
data : output_string1 type string,
output_string2 type string,
output_string3 type string,
output_string4 type string,
output_string5 type string.
*for tab delimiter
CONSTANTS: tab TYPE x VALUE '09'.
*for date and time format
creation_date = sy-datum.
creation_time = sy-uzeit.
*concatenate for 1st Record
concatenate record_identifier
sp_name
creation_date
creation_time
file_format
file_version
into output_string1
separated by tab.
*concatenate 2nd Record
concatenate record_identifier1
org_id
org_name
into output_string2
separated by tab.
*selection of fields
select aebeln alifnr b~name1
into table itab
from ekko as a inner join lfa1 as b
on alifnr = blifnr
where a~lifnr = so_lifnr.
*concatenate for 3rd Record
loop at itab.
concatenate itab-record_identifier2
itab-org_id1
itab-ebeln
itab-lifnr
itab-name1
into output_string3
separated by tab.
endloop.
*concatenate for 4th Record
concatenate record_identifier3
org_id2
org_name1
detail_record_count
into output_string4
separated by tab.
*concatenate for 5th Record
concatenate record_identifier4
extract_record_count
file_record_count
into output_string5
separated by tab.
*output strings
write 😕 output_string1.
write 😕 output_string2.
write 😕 output_string3.
write 😕 output_string4.
write 😕 output_string5.
o/p should be::::
100 1 USA 20060518 162814 MATCH 1.1
110 1744 SCORE
120 1744 .......
120 1744.........
120 1744 ....
120 ..........
130 1744 UK 10
140 12 14
‎2006 Jun 09 8:18 PM
hi u are not appending the 3 record into internal table after concatenating.you should append it to another internal table after concatenating...
Cheers,
Abdul Hakim
Message was edited by: Abdul Hakim
‎2006 Jun 09 8:20 PM
You cannot do that because you are not writing in the loop even though you are concatenating. You have to write it out there itself. I will change your code as follows
concatenate record_identifier
sp_name
creation_date
creation_time
file_format
file_version
into output_string1
separated by tab.
<b>write 😕 output_string1.</b>
*concatenate 2nd Record
concatenate record_identifier1
org_id
org_name
into output_string2
separated by tab.
<b>write 😕 output_string2</b>.
*selection of fields
select aebeln alifnr b~name1
into table itab
from ekko as a inner join lfa1 as b
on alifnr = blifnr
where a~lifnr = so_lifnr.
*concatenate for 3rd Record
loop at itab.
concatenate itab-record_identifier2
itab-org_id1
itab-ebeln
itab-lifnr
itab-name1
into output_string3
separated by tab.
<b>write 😕 output_string3.</b>
endloop.
*concatenate for 4th Record
concatenate record_identifier3
org_id2
org_name1
detail_record_count
into output_string4
separated by tab.
<b>write 😕 output_string4.</b>
*concatenate for 5th Record
concatenate record_identifier4
extract_record_count
file_record_count
into output_string5
separated by tab.
write 😕 output_string5.
In fact, you don't even need that many output_string* just have one and clear it after you write it.
‎2006 Jun 09 8:24 PM
Ok, this should work for ya now. You need to write the 3rd row inside the loop. But that's not the only reason nothing was coming, you need to use the IN operator when working with select-options.
report zrich_0001 .
tables : ekko.
*1st Record
data : record_identifier(3) type c value '100',
sp_id(3) type c value '100',
sp_name(60) type c value 'USA',
creation_date(8) type c,
creation_time(6) type c,
file_format(3) type c value 'MATCH',
file_version(3) type c value '1.1'.
*2nd Record
data : record_identifier1(3) type c value '110',
org_id(4) type c value '1744',
org_name(60) type c value 'score'.
*3rd Record
data : begin of itab occurs 0,
record_identifier2(3) type c value '120',
ebeln like ekko-ebeln,
lifnr like ekko-lifnr,
name1 like lfa1-name1,
org_id1(4) type c value '1744',
end of itab.
*4th Record
data : record_identifier3(3) type c value '130',
org_id2(4) type c value '1744',
org_name1(60) type c value 'UK',
detail_record_count(2) type c.
*5th Record
data : record_identifier4(3) type c value '140',
extract_record_count(2) type c,
file_record_count(2) type c.
select-options : so_lifnr for ekko-lifnr.
*output string
data : output_string1 type string,
output_string2 type string,
output_string3 type string,
output_string4 type string,
output_string5 type string.
*for tab delimiter
constants: tab type x value '09'.
*for date and time format
creation_date = sy-datum.
creation_time = sy-uzeit.
*concatenate for 1st Record
concatenate record_identifier
sp_name
creation_date
creation_time
file_format
file_version
into output_string1
separated by tab.
write :/ output_string1.
*concatenate 2nd Record
concatenate record_identifier1
org_id
org_name
into output_string2
separated by tab.
write :/ output_string2.
*selection of fields
select a~ebeln a~lifnr b~name1
into table itab
from ekko as a inner join lfa1 as b
on a~lifnr = b~lifnr
<b>where a~lifnr in so_lifnr.</b> <b><--- USE IN, NOT =</b>
*concatenate for 3rd Record
loop at itab.
<b> clear output_string3.</b>
concatenate itab-record_identifier2
itab-org_id1
itab-ebeln
itab-lifnr
itab-name1
into output_string3
separated by tab.
<b> write :/ output_string3.</b>
endloop.
*concatenate for 4th Record
concatenate record_identifier3
org_id2
org_name1
detail_record_count
into output_string4
separated by tab.
write :/ output_string4.
*concatenate for 5th Record
concatenate record_identifier4
extract_record_count
file_record_count
into output_string5
separated by tab.
write :/ output_string5.
Regards,
Rich Heilman
‎2006 Jun 09 9:00 PM
Hi rich...
Thanku very much..
one more thing regarding tab..how it works can u explain me...
CONSTANTS: tab TYPE x VALUE '09'.?????
‎2006 Jun 09 10:17 PM
‎2006 Jun 10 12:00 AM
Hi abdul,
My program is going to short dump ......why??????
please help me...
AND one more thing i want the whole output to be placed in single string???
EXACT CODE *****
tables : ekko.
*1st Record
data : record_identifier(3) type c value '100',
sp_id(3) type c value '100',
sp_name(60) type c value 'US',
creation_date(8) type c,
creation_time(6) type c,
file_format(3) type c value 'MATCH',
file_version(3) type c value '1.1'.
*2nd Record
data : record_identifier1(3) type c value '110',
org_id(4) type c value '1744',
org_name(60) type c value 'score'.
*3 rd Record
data : begin of itab occurs 0,
record_identifier2(3) type c,
org_id1(4) type c,
ebeln like ekko-ebeln,
bedat like ekko-bedat,
bsart like ekko-bsart,
zsrm_pcnum like ekko-zsrm_pcnum,
end of itab.
*4th Record
data : record_identifier3(3) type c value '130',
org_id2(4) type c value '1744',
org_name1(60) type c value 'UK',
detail_record_count(5) type c.
*5th Record
data : record_identifier4(3) type c value '140',
extract_record_count(5) type c,
file_record_count(5) type c.
*for counting of records
data : record_count type i.
*for selection based on creation date and document type
select-options : so_bedat for ekko-bedat,
so_bsart for ekko-bsart.
*output string
data : output_string1 type string,
output_string2 type string,
output_string3 type string,
output_string4 type string,
output_string5 type string.
*for tab delimiter
CONSTANTS: tab TYPE x VALUE '09'.
*for date and time format
creation_date = sy-datum.
creation_time = sy-uzeit.
*concatenate for 1st Record
concatenate record_identifier
sp_id
sp_name
creation_date
creation_time
file_format
file_version
into output_string1
separated by tab.
write 😕 output_string1.
*concatenate 2nd Record
concatenate record_identifier1
org_id
org_name
into output_string2
separated by tab.
write 😕 output_string2.
*selection of fields
select ebeln
bedat
bsart
zsrm_pcnum
from ekko
into table itab
where bedat in so_bedat
and bsart in so_bsart.
*concatenate for 3rd Record
IF NOT itab-zsrm_pcnum IS INITIAL.
loop at itab.
clear output_string3.
itab-record_identifier2 = '120'.
itab-org_id1 = '1744'.
concatenate itab-record_identifier2
itab-org_id1
itab-ebeln
itab-bedat
itab-bsart
into output_string3
separated by tab.
write 😕 output_string3.
endloop.
endif.
*concatenate for 4th Record
concatenate record_identifier3
org_id2
org_name1
detail_record_count
into output_string4
separated by tab.
write 😕 output_string4.
*concatenate for 5th Record
concatenate record_identifier4
extract_record_count
file_record_count
into output_string5
separated by tab.
write 😕 output_string5.
‎2006 Jun 10 1:30 AM
Hi Vj,
When using SELECT into table, the fields in itab must match what you select. Pl change your SELECT as follows.. this should avoid the short dump.
select ebeln
bedat
bsart
zsrm_pcnum
from ekko
into corresponding fields of table itab
where bedat in so_bedat
and bsart in so_bsart.
Regards,
Suresh Datti
‎2006 Jun 10 2:02 AM
Hi,
But in the o/p the describe statement i used is not working???
in the o/p there are no records to be displayed..but the describe statement is showing some value of 1432 ???
how it is possible??
‎2006 Jun 10 2:13 AM
PL paste the complete code.. I dont see any DESCRIBE statment in ur code.. has the short-dump been fixed?
Suresh
‎2006 Jun 10 2:24 AM
hi
what is the short dump saying.
plz paste here and also i m not seeing any DESCRIBE statement in your code.paste ur complete code here so that we can solve ur problem..
Cheers,
Abdul Hakim
Mark all useful answers..