12-06-2008 8:36 PM
Hi,
i need some Help to transfer internal table to file in JSON format (JavaScript Object Notation) .
i find this link : https://www.sdn.sap.com/irj/scn/wiki?path=/pages/viewpage.action%3fpageid=14260
but what i miss is the select he does there (i need it to follow his code) .
like :
select *
from sflight
and get the structure and then follow all the flow .
another thing is how he declare tab_struct.
if some one with experience can help me with that i appreciate it a lot!
i new to Abap
Regards
12-07-2008 6:11 AM
12-06-2008 10:06 PM
don't forget You answred to below thread just few days back:
And now you posted the thread on same?!!
12-06-2008 11:06 PM
Hi Amit,
This is way into the grey area...
Micheal did say:
>HI,
>i had the same problem
>i think u have to ask who write this code.
>
>Regards
I think it is okay to open a question of his own, unless it is searchable
Many posts don't explain or show the context of the coding which is causing the problem.
This also irritates me to no end sometimes.
I guess there is no easy way out for that in many cases.
Product feature.
Cheers,
Julius
12-07-2008 6:11 AM
12-07-2008 6:30 AM
Hi Michael
In the link mentioned by you :
Function Modules and it`s code is written.
If you talk about any specific part of the code ,then we can talk through it.
Neha
12-07-2008 7:38 AM
HI Nena,
Thank You Very Much for your replay.
if u copy paste his code you get 2 errors ,
1. tab_struct - how to declare it.
2. CASE w_struct-type. (its deriving from 1)
if u understand which Structure he use it can help to debug his code and folow.
Best Regards
12-07-2008 8:39 AM
Hi
In the Global data declaration of your function module
Declare this :
TYPES:
Begin of tab_struct,
Fieldname(15) type C,
type type C,
End of tab_struct.
lets see if it s working.
Neha
12-07-2008 9:27 AM
12-07-2008 10:05 AM
HI Nena,
what i add to the code is:
SELECT *
FROM sflight UP TO 10 ROWS
INTO table itab.
and from this point i contnue ,
what i miss is just the declaration of the types i put below
Regards
12-07-2008 10:09 AM
Hi Michael
All the code mentioned their is for Function Modules:
These tools will be in the form of Function modules and there will be two versions of each of them , one which can run in all WAS versions and the other which will run from WAS7.0 onwards (using Regular Expressions)
So in your case you have to create the function modules in SE37 in SAP.
Itab and Struct are table parameters of that function module.
zgs_0004 is a structure which was created in SE11 (I guess).
So I am trying to figure out the structure of that while looking into the code of these function modules.
Neha
12-07-2008 10:14 AM
HI Neha,
Thanks,
i build 2 fm like he mentioned ,
i see that he do recursion,
and i want to follow but the type declartin is what i miss.
Thanks in Advance .
12-07-2008 10:15 AM
12-07-2008 10:28 AM
HI Amit,
Thanks ,
this it what exactly i do ,
but some other declartion i miss like:
STRUC
zgs_0004
and what i have to put in tree and struc in export tab after i find there declaration.
Best Regards
12-07-2008 10:35 AM
12-07-2008 10:37 AM
12-07-2008 10:42 AM
Is Your Z* structure is exist in data dictionary?
It should be.And use this refrence with
Itab LIKE <Z structure>
12-07-2008 11:20 AM
Hi Amit,
Thanks for your time,
which structure i have to build in se11?
for the example i declare just
itab type SFLIGHT
p.s. maybe my question is stupid ,
i very new to Abap.
Regards
12-07-2008 11:36 AM
Hi,
itab type SFLIGHT
itab will the variable in the program and SFILGT is the Database Table .
12-07-2008 12:06 PM
Hi Avinash ,
Thanks,
i want to now how to declare :
STRUC
zgs_0004
Regards
12-07-2008 12:31 PM
HI,
Go to tcode SE11 and select the radio button and give the zgs_0004 in the corresponing input field and then press on Display button. If the structure exists it will display the Fields of the structure or displays the message structure doesn't exist.
Then this time instead of displaying click on the create button and specify the reuired fields ..the save and active the structure.
12-07-2008 12:32 PM
Hi Micheal
ZSY_0004 you have to declare in se11 and then you can refer it in your table parameter.
Neha
12-07-2008 12:49 PM
HI Avinash
Thanks,
the important things for me is how he declare STRUC
Another thing is now the type for zgs_0004,
this structure or field? it doesn't exist in my DB,
so i want to guess what the author intend .
hope u can help.
Regards
12-07-2008 12:52 PM
Hi Nena,
The important things for me is how to declare STRUC ?
about ZSY_0004 i don't now to what refer it.
AMybe it's structure or field type i don't now.
Regards
12-07-2008 1:15 PM
Hi Micheal
If you see the Function module :
FUNCTION z_json_out.
*"----------------------------------------------------------------------
*"*"Interface locale :
*" IMPORTING
*" REFERENCE(TREE) TYPE C OPTIONAL
*" REFERENCE(STRUC) OPTIONAL
STRUC is declared without any reference in the function module.
Neha
12-07-2008 2:53 PM
HI Neha,
Thanks for your help!!!
i soon open a new treat ,
i have more different question for this program ,
hope u can help.
Best Regards