‎2007 Feb 28 5:36 AM
Hi all,
I have a structure called MBEW, for which I have created a work area called WA_MBEW. This structure has numeric as well as character type fields. Now I want to initialise all <b>character type</b> fields with '/'. So I have a variable called NODATA TYPE c VALUE '/'.
Is there any way I can initialise only char fields with NODATA?
I tried CLEAR WA_MBEW WITH NODATA, but this doesnt work bcoz of the numeric fields. Plz help
‎2007 Feb 28 5:40 AM
Welcome to SDN!!!
CLEAR wa_mbew.
wa_mbew = '/'.Reward if this helps. else revrt back with queries.
‎2007 Feb 28 5:40 AM
Welcome to SDN!!!
CLEAR wa_mbew.
wa_mbew = '/'.Reward if this helps. else revrt back with queries.
‎2007 Feb 28 5:54 AM
‎2007 Feb 28 6:06 AM
Hi,
I tried to write out a few CHAR fields, but they're still blank, not '/'... any suggestions?
‎2007 Feb 28 6:08 AM
Can u give me the part of the code with declarations.
<b>DATA: wa(10) TYPE c value 'Test'.
clear wa.
wa = '/'.
Write:/ wa.</b>
This works fine for me.
‎2007 Feb 28 6:15 AM
can u post ur code?
or else, assign each char field with a /
wa_mbew-char1 = nodata.
wa_mbew-char2 = nodata.
wa_mbew-char3 = nodata.
wa_mbew-char4 = nodata.
‎2007 Feb 28 6:16 AM
DATA : WA_MBEW LIKE MBEW.
*MBEW is a structure with abt 100 fields, with types char, numc, curr etc etc
DATA : NODATA TYPE C VALUE '/' "Defined in an include
IF WA_MBEW IS INITIAL.
CLEAR WA_MBEW WITH NODATA. "Throws error
ENDIF.
‎2007 Feb 28 9:26 AM
Hi,
Try this its workign fine
DATA: wa LIKE MBEW.
if wa is initial.
clear wa WITH '/'.
endif.
Write:/ wa.Reward if this helps.
‎2007 Feb 28 9:45 AM
Judith, ur code is throwin this syntax error:
"WA" must be a character type data object (C,N,D,T,String).
I'm guessing this is a Unicode compatibility error, right?
Is there any function module which will return the name and type of fields in a DDIC structure? That way, I might be able to use an internal table and then loop around it, initialising only for CHAR type fields.
‎2007 Feb 28 9:48 AM
I dont know y this problem, I am workign in 4.6c and its running without any syntax error.
‎2007 Feb 28 9:50 AM
Try using the FM: GET_COMPONENT_LIST to get the types of the internal table fields.
Regards,
Ravi
‎2007 Feb 28 9:52 AM
just chk whether u had selected the checkbox "Unicode checks active" when u created ur test report
‎2007 Feb 28 5:46 AM
<b>DATA: TEXT(1) VALUE '/',
BEGIN OF PLAYER,
NAME(10) VALUE 'John',
TEL(8) TYPE N VALUE '08154711',
MONEY TYPE P VALUE 30000,
END OF PLAYER.
CLEAR: NUMBER, PLAYER-name with text.
.</b>
or
<b>ABOVE Code is BEST one .</b>
Regards
Prabhu
‎2007 Feb 28 5:47 AM
‎2007 Feb 28 6:16 AM
‎2007 Feb 28 9:21 AM
Hi,
yesit will post error because your structure WA_MBEW contains not only character field but also different data types.
so only option is u have to explicitly assign the character fields to nodata.
DATA : WA_MBEW LIKE MBEW.
*MBEW is a structure with abt 100 fields, with types char, numc, curr
*etc etc
DATA : NODATA TYPE C VALUE '/'. "Defined in an include
IF WA_MBEW IS INITIAL.
WA_MBEW-VPRSV = nodata.
ENDIF.
in the same way assign all char fieds to nodata.
Regards,
Sruthi