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

report

Former Member
0 Likes
592

hi

here my requirement is to create 2nd line item in the presentation server(dsktop).for that i developed a logic but i couldn't create 2nd line item with my ligic.

plse help me how to do. many thanks for your reply.

Data: begin of i_kna1 occurs 10,

kunnr like kna1-kunnr,

land1 like kna1-land1,

ort01 like kna1-ort01,

pstlz like kna1-pstlz,

stras like kna1-stras,

regio like kna1-regio,

name1 like kna1-name1,

name2 like kna1-name2,

end of i_kna1.

  • BLOCK B1 FOR LOGICAL CUSTOMER NUMBER

SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE text-002.

SELECT-OPTIONs: s_kunnr for kna1-kunnr.

SELECTION-SCREEN END OF BLOCK B1.

*BLOCK B2 FOR LOGICAL FILENAME, DESKTOP FILENAME

SELECTION-SCREEN BEGIN OF BLOCK B2 WITH FRAME TITLE text-002.

PARAMETERS: g_fname TYPE filename-fileintern.

SELECTION-SCREEN END OF BLOCK B2.

select single kunnr

from kna1

into corresponding fields of i_kna1

where kunnr in s_kunnr.

  • if sy-subrc ne 0.

  • message2 = 'kna1-kunnr'.

  • concatenate message1 message2 into message.

  • endif.

select single land1

from kna1

into corresponding fields of i_kna1

where kunnr in s_kunnr.

select single ort01

from kna1

into corresponding fields of i_kna1

where land1 = i_kna1-land1.

select single pstlz

from kna1

into corresponding fields of i_kna1

where ort01 = i_kna1-ort01.

select single stras

from kna1

into corresponding fields of i_kna1

where ort01 = i_kna1-stras.

select single regio

from kna1

into corresponding fields of i_kna1

where kunnr in s_kunnr.

select single name1

from kna1

into corresponding fields of i_kna1

where kunnr in s_kunnr.

select single name2

from kna1

into corresponding fields of i_kna1

where kunnr in s_kunnr.

loop at i_kna1.

end loop.

CALL FUNCTION 'WS_DOWNLOAD'

EXPORTING

FILENAME = g_fname

FILETYPE = 'ASC'

TABLES

data_tab = i_kna1

EXCEPTIONS

FILE_OPEN_ERROR = 1

FILE_WRITE_ERROR = 2

INVALID_FILESIZE = 3

INVALID_TYPE = 4

NO_BATCH = 5

UNKNOWN_ERROR = 6

INVALID_TABLE_WIDTH = 7

GUI_REFUSE_FILETRANSFER = 8

CUSTOMER_ERROR = 9

OTHERS = 10

.

IF sy-subrc <> 0.

write:'file can not be created'.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

7 REPLIES 7
Read only

Former Member
0 Likes
557

Hello,

Use

Select *

instead select single.

Reward points if useful...

Regards,

Vasanth

Read only

Former Member
0 Likes
557

Use the select as below

Select KUNNR LAND1 ORT01 PSTLZ STRAS REGIO NAME1 NAME2

from kna1

into corresponding fields of i_kna1

where kunnr in s_kunnr.

-Kiran

*Please reward useful answers

Read only

Former Member
0 Likes
557

Hi serma,

1. the definition for file name should be

2.

PARAMETERS: g_fname TYPE <b>RLGRAP-FILENAME.</b>

regards,

amit m.

Read only

Laxmana_Appana_
Active Contributor
0 Likes
557

Hi,

All mentioned select statements are from one table only ,

instead of these many select statements , select fld1 fld2.... from kan1 to internal table , if you want multiple records from kna1 , remove single from select statement.

Regards

Laxman

Read only

Former Member
0 Likes
557

Hai Serma Rao

Go through the following Code will work properly

<b>

tables : kna1.

Data: begin of i_kna1 occurs 10,

kunnr like kna1-kunnr,

land1 like kna1-land1,

ort01 like kna1-ort01,

pstlz like kna1-pstlz,

stras like kna1-stras,

regio like kna1-regio,

name1 like kna1-name1,

name2 like kna1-name2,

end of i_kna1.

  • BLOCK B1 FOR LOGICAL CUSTOMER NUMBER

SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE text-002.

SELECT-OPTIONs: s_kunnr for kna1-kunnr.

SELECTION-SCREEN END OF BLOCK B1.

*BLOCK B2 FOR LOGICAL FILENAME, DESKTOP FILENAME

SELECTION-SCREEN BEGIN OF BLOCK B2 WITH FRAME TITLE text-002.

PARAMETERS: g_fname TYPE RLGRAP-FILENAME.

SELECTION-SCREEN END OF BLOCK B2.

select KUNNR

LAND1

ORT01

PSTLZ

STRAS

REGIO

NAME1

NAME2

from kna1

into table i_kna1

where kunnr in s_kunnr.

if sy-subrc = 0.

CALL FUNCTION 'WS_DOWNLOAD'

EXPORTING

FILENAME = g_fname

FILETYPE = 'ASC'

TABLES

data_tab = i_kna1

EXCEPTIONS

FILE_OPEN_ERROR = 1

FILE_WRITE_ERROR = 2

INVALID_FILESIZE = 3

INVALID_TYPE = 4

NO_BATCH = 5

UNKNOWN_ERROR = 6

INVALID_TABLE_WIDTH = 7

GUI_REFUSE_FILETRANSFER = 8

CUSTOMER_ERROR = 9

OTHERS = 10

.

IF sy-subrc <> 0.

write:'file can not be created'.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

endif.

</b>

Thanks & regards

Sreenivasulu P

Read only

0 Likes
557

hi srinivasilu

many thanks for ur kind reply.

with my logic i can create only one line item in the presentation server but i want to create multiple line item plse help me.

with regards

serma rao

Read only

Former Member
0 Likes
557

Check this code...

Data: begin of i_kna1 occurs 0,
kunnr like kna1-kunnr,
land1 like kna1-land1,
ort01 like kna1-ort01,
pstlz like kna1-pstlz,
stras like kna1-stras,
regio like kna1-regio,
name1 like kna1-name1,
name2 like kna1-name2,
end of i_kna1.
* BLOCK B1 FOR LOGICAL CUSTOMER NUMBER
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE text-002.
SELECT-OPTIONs: s_kunnr for kna1-kunnr.
SELECTION-SCREEN END OF BLOCK B1.

*BLOCK B2 FOR LOGICAL FILENAME, DESKTOP FILENAME
SELECTION-SCREEN BEGIN OF BLOCK B2 WITH FRAME TITLE text-002.
PARAMETERS: g_fname TYPE filename-fileintern.
SELECTION-SCREEN END OF BLOCK B2.
select *
from kna1
into corresponding fields of i_kna1
where kunnr in s_kunnr.
if sy-subrc = 0.
sort i_kna1.
endif.

loop at i_kna1.
end loop.
CALL FUNCTION 'WS_DOWNLOAD'
EXPORTING
FILENAME = g_fname
FILETYPE = 'ASC'
TABLES
data_tab = i_kna1
EXCEPTIONS
FILE_OPEN_ERROR = 1
FILE_WRITE_ERROR = 2
INVALID_FILESIZE = 3
INVALID_TYPE = 4
NO_BATCH = 5
UNKNOWN_ERROR = 6
INVALID_TABLE_WIDTH = 7
GUI_REFUSE_FILETRANSFER = 8
CUSTOMER_ERROR = 9
OTHERS = 10
.
IF sy-subrc <> 0.
write:'file can not be created'.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.

Regards

vijay