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

Unicode Error for Macro Open statement

Former Member
0 Likes
919

<b><u>I have a Macro defined as below:</u></b>

-macro-for-form-definition----


DEFINE M_OPEN.

----


  • FORM F_DSOPEN_&1_&2 *

----


  • This is a macro to dynamically open unix files *

----


  • --> dsn *

  • --> type *

  • --> c *

----


FORM F_DSOPEN_&1_&2 USING

P_XPATH.

DATA MSG(80).

OPEN DATASET P_XPATH FOR &1 IN &2 MODE MESSAGE MSG.

V_SUBRC = SY-SUBRC.

IF SY-SUBRC <> 0.

CONCATENATE V_DESC29 P_XPATH INTO V_DESC.

PERFORM F_CREATE_IT_ERR USING ' ' V_DESC.

ENDIF.

ENDFORM.

END-OF-DEFINITION.

<u><b>After that I am using that Macro as below:</b></u>

M_OPEN INPUT BINARY.

M_OPEN OUTPUT TEXT.

<u><b>Showing Error as below:</b></u>

ERROR: In "TEXT MODE" the "ENCODING" addition must be specified

<u><b>Solutions tried:</b></u>

I was suspecting that error for Open Dataset and added text mode / encoding for it. Still the problem is showing up.

So I guess some change should take place for M_OPEN statements.

ANY CLUES PLEASE.

Thanks

Kiran

6 REPLIES 6
Read only

Former Member
0 Likes
851

OPEN DATASET P_XPATH FOR &1 IN &2 MODE MESSAGE MSG ENCODING DEFAULT.

Maybe you can have a try to add "ENCODING DEFAULT".

I hope it will be helpful.

Read only

0 Likes
851

I already told that I gave a try in that area.

Thanks for the reply.

Any more clues pl

Kiran

Read only

0 Likes
851

any clues please

Read only

0 Likes
851

OPEN DATASET P_XPATH FOR &1 IN &2 MODE MESSAGE MSG <b>encoding default</b>.

Thats the solution. If you tried and had no success, you made a mistake.

The encoding phrase is mandantory in unicode, you dont have that, and therefore you will get an error.

And at least: using a macro to have a form is more than strange. Forms can have parameters.

Read only

Former Member
0 Likes
851

Hi Kiran,

Please do not use Macro. Instead use a subroutine if you wish to reuse the code.

ENCODING DEFAULT is the only solution.

Simply remove macro & paste the code of open dataset along with encoding default & check.

Best regards,

Prashant

Read only

Former Member
0 Likes
851

slved on my own.

defined 2 macros.

one for text

another for binary