Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

integer doubt??

Former Member
0 Likes
3,493

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)

50 REPLIES 50
Read only

0 Likes
3,169

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

Read only

0 Likes
3,169

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

Read only

0 Likes
3,169

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.

Read only

0 Likes
3,169

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

Read only

0 Likes
3,169

Hi rich...

Thanku very much..

one more thing regarding tab..how it works can u explain me...

CONSTANTS: tab TYPE x VALUE '09'.?????

Read only

0 Likes
3,169

Hi

it will insert a tab delimiter.

Cheers,

Abdul Hakim

Read only

0 Likes
3,169

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.

Read only

0 Likes
3,169

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

Read only

0 Likes
3,169

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??

Read only

0 Likes
3,169

PL paste the complete code.. I dont see any DESCRIBE statment in ur code.. has the short-dump been fixed?

Suresh

Read only

0 Likes
3,169

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..