Application Development 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: 

how to avoid wild characters from output

Former Member
0 Kudos

Hi frnds,

i m getting my data downloaded in the application server in my report.

i m getting few issues. i m getting "#" which in between fields.

i m getting like this.

1234 #Mr#sLoP#sp#ban l#baMgu#752002#in#6667#456-111-333# ##in#01#12 3453#indo

1234 #Mr#45mk#mu#hyd 1#hhyd2#752005#in#2222#111-111-333# ##in#01 #1 23456#indo

1234 #Mr#ramk#mu#hyd 1#hhyd2#752001#in#2222#111-111-333# ##in#01 #1 23456#indo

1234 #Mr#ramk#mu#hyd 1#hhyd2#752003#in#2222#111-111-333# ##in#01 #1 23456#indo

how to remove this frnds.

regards,

satya

5 REPLIES 5

Former Member
0 Kudos

you can do it in multiple ways....

If each line is stored as a string...

use REPLACE function...

http://help.sap.com/saphelp_nw2004s/helpdata/en/43/41341147041806e10000000a1553f6/frameset.htm

or if you are using GUI_DOWNLOAD/UPLOAD, then use the WRITE+FIELD_SEPERATOR/HAS_FIELD_seperator as "#" while calling the function module...

if you are downloading a list from SAP to excel/any other formats....then ...

go to-> control panel->regional and language options->customize->list seperator->

give "#".....

Message was edited by:

Muthurajan Ramkumar

varma_narayana
Active Contributor
0 Kudos

Hi Satya.

Check this code:

This is the Simple way you can download the ITAB with Tab delimiter:

DATA : V_REC(200).

OPEN DATASET P_FILE FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.

LOOP AT ITAB INTO WA.

Concatenate WA-FIELD1 WA-FIELD2

INTO V_REC

SEPARATED BY CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB.

TRANSFER V_REC TO P_FILE.

ENDLOOP.

CLOSE DATASET P_FILE.

Note: if there are any Numeric fields ( Type I, P, F) In your ITAB then before CONCATENATE you have to Move them to Char fields ..

<b>Reward if Helpful.</b>

0 Kudos

Hi Varma,

This is my code wht changes shuld be done.

<code>

REPORT Zdemo_APPL.

TYPES : BEGIN OF ST_VENDORS,

KTOKK TYPE RF02K-KTOKK,

ANRED TYPE LFA1-ANRED,

NAME1 TYPE LFA1-NAME1,

SORTL TYPE LFA1-SORTL,

STRAS TYPE LFA1-STRAS,

ORT01 TYPE LFA1-ORT01,

PSTLZ TYPE LFA1-PSTLZ,

LAND1 TYPE LFA1-LAND1,

KONZS TYPE LFA1-KONZS,

STCD1 TYPE LFA1-STCD1,

STKZA TYPE LFA1-STKZA,

STKZU TYPE LFA1-STKZU,

BANKS TYPE LFBK-BANKS,

BANKL TYPE LFBK-BANKL,

BANKN TYPE LFBK-BANKN,

BANKA TYPE BNKA-BANKA,

END OF ST_VENDORS.

DATA : IT_VENDORS TYPE STANDARD TABLE OF ST_VENDOrS,

WA_VENDORS LIKE LINE OF IT_VENDORS.

DATA : V_MESSAGE(20) TYPE C.

DATA : V_REC(200).

data : p_file(300) type c .

p_file = 'F:\usr\sap\ECP\SYS\global\rajesh1.txt'.

open dataset p_file for input in text mode encoding default.

IF SY-SUBRC NE 0.

WRITE : / V_MESSAGE.

ELSE.

do.

read dataset p_file into wa_vendors.

IF SY-SUBRC NE 0.

EXIT.

ELSE.

append wa_vendors to it_vendors.

endif.

enddo.

endif.

CLOSE DATASET P_FILE.

loop at it_vendors into wa_vendors.

write : / wa_vendors-ktokk,

wa_vendors-anred,

wa_vendors-name1,

wa_vendors-sortl,

wa_vendors-stras,

wa_vendors-pstlz,

wa_vendors-land1,

wa_vendors-konzs.

endloop.

</code>

0 Kudos

Make below changes and if it helps please dont forget to mark all useful answers.

REPORT Zdemo_APPL.

TYPES : BEGIN OF ST_VENDORS,

KTOKK TYPE RF02K-KTOKK,

ANRED TYPE LFA1-ANRED,

NAME1 TYPE LFA1-NAME1,

SORTL TYPE LFA1-SORTL,

STRAS TYPE LFA1-STRAS,

ORT01 TYPE LFA1-ORT01,

PSTLZ TYPE LFA1-PSTLZ,

LAND1 TYPE LFA1-LAND1,

KONZS TYPE LFA1-KONZS,

STCD1 TYPE LFA1-STCD1,

STKZA TYPE LFA1-STKZA,

STKZU TYPE LFA1-STKZU,

BANKS TYPE LFBK-BANKS,

BANKL TYPE LFBK-BANKL,

BANKN TYPE LFBK-BANKN,

BANKA TYPE BNKA-BANKA,

END OF ST_VENDORS.

DATA : IT_VENDORS TYPE STANDARD TABLE OF ST_VENDOrS,

WA_VENDORS LIKE LINE OF IT_VENDORS.

DATA : V_MESSAGE(20) TYPE C.

DATA : V_REC(200).

<i><b>DATA : G_DATA(4096) TYPE C.</b></i>

<i><b>CONSTANTS: C_HASH(1) TYPE C VALUE '#'.</b></i>

data : p_file(300) type c .

p_file = 'F:\usr\sap\ECP\SYS\global\rajesh1.txt'.

open dataset p_file for input in text mode encoding default.

IF SY-SUBRC NE 0.

WRITE : / V_MESSAGE.

ELSE.

do.

<i><b>CLEAR : G_DATA.</b></i>

<i><b>READ DATASET P_FILE INTO G_DATA.</b></i>

<i><b>* read dataset p_file into wa_vendors.</b></i> " <b>Comment this line</b>

IF SY-SUBRC NE 0.

EXIT.

ELSE.

<i><b>SPLIT G_DATA AT C_HASH INTO WA_VENDORS-KTOKK WA_VENDORS-ANRED WA_VENDORS-NAME1 WA_VENDORS-SORTL WA_VENDORS-STRAS WA_VENDORS-ORT01 WA_VENDORS-PSTLZ WA_VENDORS-LAND1 WA_VENDORS-KONZS WA_VENDORS-STCD1 WA_VENDORS-STKZA WA_VENDORS-STKZU WA_VENDORS-BANKS WA_VENDORS-BANKL WA_VENDORS-BANKN WA_VENDORS-BANKA.</b></i>

append wa_vendors to it_vendors.

endif.

enddo.

endif.

CLOSE DATASET P_FILE.

loop at it_vendors into wa_vendors.

write : / wa_vendors-ktokk,

wa_vendors-anred,

wa_vendors-name1,

wa_vendors-sortl,

wa_vendors-stras,

wa_vendors-pstlz,

wa_vendors-land1,

wa_vendors-konzs.

endloop.

Former Member
0 Kudos

TRY this....

data: str1 type string.

do.

read dataset p_file into str1.

SPLIT str1 AT '#' INTO wa_vendors-ktokk wa_vendors-anred wa_vendors-name1 wa_vendors-sortl wa_vendors-stras wa_vendors-pstlz wa_vendors-land1 wa_vendors-konzs.

IF SY-SUBRC NE 0.

EXIT.

ELSE.

append wa_vendors to it_vendors.

endif.

enddo.

endif.

CLOSE DATASET P_FILE.