‎2007 Aug 07 10:56 AM
Hello,
I have in a table-field (Tab-Text for example) any Text like 'BSEG-BELNR'.
With the command "WRITE TABLE-FIELD.", the displayed result is 'BESG-BELNR'.
It is possible to see as result instead the text 'BESG-BELNR', the content from BESG-BELNR with a write command?
Thank You for your answer.
Marc
‎2007 Aug 07 3:09 PM
so, i test your solution, and it's work in one combination: here is my code.
==============================================
DATA table_field TYPE string.
FIELD-SYMBOLS <fs> TYPE ANY.
SELECT SINGLE text FROM dbtab INTO table_field
WHERE key EQ '123'.
ASSIGN (table_field) TO <fs>.
WRITE <fs>.
==============================================
if in text, i have 'BSEG-BELNR', it works fine.
but if in text, i habe 'BESG-BELNR BSEG-BUKRS' or 'BSEG-BELNR, BSEG-BUKRS', the programm dump and say that the field-symbol isn't assign.
the reason from this question is that we have actually in an programm this instruction:
CONCATENATE BSEG-BELNR BSEG-BUKRS into table_field SEPARATED BY space.
CALL FUNTION 'FUNCTION'
EXPORTING
param = table_field.
In the future, we wan't have the table_field dynamik, and then define it as text in dbtab.
Do you think it's possible?
‎2007 Aug 07 11:07 AM
Use this code:
DATA table_field value 'BSEG-BELNR'.
FIELD-SYMBOLS: <fs> TYPE ANY
ASSIGN (table_field) TO <fs>.
WRITE : <fs>.Please mark points if the solution was useful.
Regards,
Manoj
‎2007 Aug 07 11:08 AM
I think you should use a field symbol.
Documentation here : http://help.sap.com/saphelp_nw70/helpdata/en/fc/eb3860358411d1829f0000e829fbfe/frameset.htm
Some (untested) example code
FIELD-SYMBOLS: <fs> TYPE ANY.
ASSIGN (TABLE-FIELD) TO <fs>.
‎2007 Aug 07 11:10 AM
just check this link:
http://www.sap-basis-abap.com/abap/difference-between-select-single-and-up-to-1-row.htm
reward if useful
anju
‎2007 Aug 07 2:11 PM
‎2007 Aug 07 3:09 PM
so, i test your solution, and it's work in one combination: here is my code.
==============================================
DATA table_field TYPE string.
FIELD-SYMBOLS <fs> TYPE ANY.
SELECT SINGLE text FROM dbtab INTO table_field
WHERE key EQ '123'.
ASSIGN (table_field) TO <fs>.
WRITE <fs>.
==============================================
if in text, i have 'BSEG-BELNR', it works fine.
but if in text, i habe 'BESG-BELNR BSEG-BUKRS' or 'BSEG-BELNR, BSEG-BUKRS', the programm dump and say that the field-symbol isn't assign.
the reason from this question is that we have actually in an programm this instruction:
CONCATENATE BSEG-BELNR BSEG-BUKRS into table_field SEPARATED BY space.
CALL FUNTION 'FUNCTION'
EXPORTING
param = table_field.
In the future, we wan't have the table_field dynamik, and then define it as text in dbtab.
Do you think it's possible?
‎2007 Aug 07 3:15 PM
Isn't that kind of logical?
if you read the link I posted in my original reply : http://help.sap.com/saphelp_nw70/helpdata/en/fc/eb3860358411d1829f0000e829fbfe/frameset.htm
you would have noticed that a field symbol is a symbol pointing to <b>a field</b>.
If you want to use space separated field names, you can use the split statement to get all the different field names out of your string and then assign each one of them to a field symbol.
Untested example code
data : itab type table of string, wa type string.
SPLIT table_field AT space INTO TABLE itab.
loop at itab into wa.
ASSIGN (wa) TO <fs>.
endloop.
Message was edited by:
Dries Horions
removed unfriendly stuff from reply
‎2007 Aug 07 3:29 PM
Hello Dries,
Yes, i have, in the meantime tested a simular solution to yours and it's works fine.
The link was very helpful and your message confirm that i have the correct solution.
Thank you very much.
‎2007 Aug 07 3:25 PM
Hi,
Try this way
data : v_field like dd03;-fieldname.
v_field = 'BSEG-BELNR'.
condense : v_field.
write : (v_field) to v_result no-zero
aRs
‎2007 Aug 07 3:51 PM
Hello aRs,
Does your solution only works with numerics fields?
Marc
‎2007 Aug 07 3:58 PM
Hi,
No it will work with character /Numeric field also.
data : v_field like dd03;-fieldname.
v_field = 'BSEG-BELNR'.
condense : v_field.
write : (v_field) to v_result "<< You can write without No zero also
aRs
‎2007 Aug 07 6:11 PM
Hello aRs,
yes, i understand your solution. It's another way to resolve my problem.
Thanks to the community for your help.
Marc