2008 Oct 29 6:57 AM
I have to initialise the structure BBSEG with / value
please advise of these 2 method which is more performance
method 1 -->(Using the FM NAMETAB)
REFRESH nametab.
CALL FUNCTION 'NAMETAB_GET'
EXPORTING
langu = sy-langu
tabname = tabname
TABLES
nametab = nametab
EXCEPTIONS
no_texts_found = 1.
IF sy-subrc NE 0.
MESSAGE e000 WITH 'DDIC Structure ' tabname ' not found'.
ENDIF.
LOOP AT nametab.
CLEAR char.
CONCATENATE 'I_' nametab-tabname '-' nametab-fieldname INTO char.
ASSIGN (char) TO <f1>.
<f1> = i_nodata.
ENDLOOP.
-
Methos 2 -->
data : wa_bbseg type bbseg.
field-symbols : <fs> type any.
do.
assign component sy-index of structure wa_bbseg to <fs>.
if sy-subrc = 0.
<fs> = '/'.
else.
exit.
endif.
enddo.
2008 Oct 29 8:11 AM
Hi,
Second one is better.......Field Symbols are always used for the Better performance as they eliminates the need of any workarea/Headerline/Strucutre for any Value transfer, and hence less memory and processing is required.
2008 Oct 29 7:10 AM
2nd one is definetly faster, from programing technical point of view also better.
2008 Oct 29 7:49 AM
Hi,
Performance wise second method id faster as it takes less execution time and run time analysis is efficient in second method.
Regards,
Rahul
2008 Oct 29 8:11 AM
Hi,
Second one is better.......Field Symbols are always used for the Better performance as they eliminates the need of any workarea/Headerline/Strucutre for any Value transfer, and hence less memory and processing is required.
2008 Oct 29 9:14 AM
Methos 2 -->
data : wa_bbseg type bbseg.
field-symbols : <fs> type any.
do.
assign component sy-index of structure wa_bbseg to <fs>.
if sy-subrc = 0.
<fs> = '/'.
else.
exit.
endif.
enddo.
Concerning the second method i the <fs> type any
2008 Oct 29 9:43 AM
>
Concerning the second method i the <fs> type any
you should not have any concern about it...
2008 Oct 29 9:46 AM
Sorry i didn't complete the question i wanted to ask what if i want to put a TYPE with the FS
<FS> type BBSEG
a dump occur in the line code assign
2008 Oct 29 9:52 AM
Hi,
You have to change code as:
tables:
bbseg.
field-symbols:
<FS> type BBSEG.
Assign bbseg to <FS>.
Thanks & Regards,
Navneeth K.
2008 Oct 29 9:53 AM
<fs> TYPE bbseg => here the field symbols will be like a work area
<fs> TYPE ANY => here the field symbol can be anything
in your example you assign the fields of the work area (one by one) to the field symbols, so the <fs> TYPE bbseg will result in a dump.
2008 Oct 29 9:53 AM
mention tables statement inorder to avoid dump or else create a workarea:
data:
wa type bbseg.
field-symbols:
<FS> type BBSEG.
Assign wa to <FS>.
2008 Oct 29 10:00 AM
>
> Hi,
>
> You have to change code as:
>
>
tables: > bbseg. > > field-symbols: > <FS> type BBSEG. > > Assign bbseg to <FS>.
>
> Thanks & Regards,
> Navneeth K.
and how will you put a slash into each field (the original requirement here) ?
2008 Oct 29 10:13 AM
With the <FS> type any it work fine
it's only with the <FS> type BBSEG that it dump. i am not too familiar with field symbol could you please explain me the reason
2008 Oct 29 10:31 AM
I already gave explanation in my previous reply, to add some more: in the DO ... ENDDO you assign each single field to the field symbol (in "normal" ABAP would look like: field1 = variable). if the field symbol is TYPE bbseg, that would be like field1 = work area ==> error!
2008 Oct 29 10:51 AM
>
> With the <FS> type any it work fine
>
> it's only with the <FS> type BBSEG that it dump. i am not too familiar with field symbol could you please explain me the reason
Why if it works fine with TYPE ANY would you want to try and type it on something else? Especially to type it on BBSEG which is totally wrong for what it is being used for (as explained above). Just making extra work for yourself.
There is nothing wrong with using TYPE ANY; it facilitates the main advantage of using field symbols ie that you can use them to point to any field you want whatever the type.
2008 Nov 21 12:42 PM
>
>
> There is nothing wrong with using TYPE ANY; it facilitates the main advantage of using field symbols ie that you can use them to point to any field you want whatever the type.
That advantage is the main reason why you should not use type any. See my blog about[ type safety.|https://www.sdn.sap.com/irj/sdn/weblogs?blog=/pub/wlg/11938] [original link is broken] [original link is broken] [original link is broken];
matt
2008 Nov 21 2:43 PM
Academic discussion. Use standard SAP functionality to do this:
PERFORM INIT_BBSEG(RFBIBLI0) USING BBSEG.
Rob