‎2008 Feb 07 5:37 PM
Hello.
i am new with ABAP proxy and only have some theoretical knowledge about ABAP object oriented programmering so:
i have been told to inplement code in a method of a generated proxy class to deal with material data sent to SAP from an external agent. i know what i have to do with the data, i mean, i am gonna update material master using a BAPI and i know that the data is in the INPUT parameter of the method, i can see the method where i have to write code, and i can see the structure of that INPUT and identify the fields i need, but, how can i reference the parameter in the method, its fields, how do i read that data?? surely is a very stupid cuestion once one knows about proxy and methods and so but by know...
Thanks a lot for any help.
Edited by: Javier Casillas on Feb 7, 2008 6:38 PM
‎2008 Feb 08 10:54 AM
The input and output parameters are structures
you can refer it just like a workarea
Data: vl_matnr type mara-matnr.
*Reading
vl_matnr = input-matnr.
*Writing
output-matnr = vl_matnr.
if your mapping on XI have a deep structure, the workarea of input and output parameters will have the same deep
vl_matnr = input-material-matnr.
input-material-matnr = vl_matnr
Darley
‎2008 Feb 08 7:56 AM
If an input parameter is call i_data and has structure struc, then i_data is available in your method as a variable with structure struc.
It's there. You use it. It's defined for you.
Or does the difficulty lie elsewhere?
matt
‎2008 Feb 08 10:54 AM
The input and output parameters are structures
you can refer it just like a workarea
Data: vl_matnr type mara-matnr.
*Reading
vl_matnr = input-matnr.
*Writing
output-matnr = vl_matnr.
if your mapping on XI have a deep structure, the workarea of input and output parameters will have the same deep
vl_matnr = input-material-matnr.
input-material-matnr = vl_matnr
Darley
‎2008 Feb 08 12:23 PM
First of all, thank you Matthew and Darley.
what i was asking is what Darley explains. I understand that the question was actualy too silly or obvious maybe, but it is clear that i havent understand yet how this classes work. So now i have an idea of how to "see" a field of the input structure. but i am not still able to "loop" at data, the materials, and take out the information. i receive this collection of materials from XI:
<ARTICLE_INFO VERSION="1.0">
- <DEF_ARTICLE ID="1002423" ACTION="SYNC">
<MCLASS>533000</MCLASS>
<MSORT>473760</MSORT>
<REGLANG>SWE</REGLANG>
<NAME LANG="SWE">KUGGKRANS</NAME>
<STD_MANUF_FLAG>M</STD_MANUF_FLAG>
<MANUF>KUPPLUNGSTECHNIK</MANUF>
<REF LANG="SWE">ROTEX 42-55</REF>
<SUPPLEMENT LANG="SWE">92 SHORE GUL</SUPPLEMENT>
</DEF_ARTICLE>
- <DEF_ARTICLE ID="1002818" ACTION="SYNC">
<MCLASS>641000</MCLASS>
<MSORT>230416</MSORT>
<REGLANG>SWE</REGLANG>
<NAME LANG="SWE">TONERKASSETT</NAME>
<STD_MANUF_FLAG>M</STD_MANUF_FLAG>
<MANUF>HEWLETT-PACKARD</MANUF>
<REF LANG="SWE">Q6470A</REF>
<SUPPLEMENT LANG="SWE">SVART CLJ 3600/3800</SUPPLEMENT>
And this is the same structure i see in the INPUT parameter of the method. So imagine that i want to pick every material number i receive and take some data from then. to loop through the materials i thought i could do something like:
loop at input-article_info-def_article.
w_matnr = input-article_info-def_article-ID.
w_spras = input-article_info-name-lang.
w_matkx = input-article_info-name.
endloop.
But first, in OO i have to do de loop with a "INTO" or "ASSING" addition. i tried to do:
data: wa_def_article like ZMI_SKC_ARTICLES_DEF_ARTICLE.
(this is the line type of the proxy type for def_article)
and then: LOOP AT input-article_info-def_article INTO wa_def_article.
but it doesnt work becouse the right side of the input must be a "flat structure". what does it mean?
and then, i am not sure either if the way i am assigning the material number or the language, for example, are correct.
i guess i am doing it much more confussing that it really is because my ignorance of ABAP classes and proxy.
but thank you for your time and help!
Javier
Edited by: Javier Casillas on Feb 8, 2008 1:29 PM
‎2008 Feb 08 1:24 PM
I'd guess that you've not actually defined wa_def_article. It's difficult to tell without knowing the definition of ZMI_SKC_ARTICLES_DEF_ARTICLE.
Try:
DATA: wa_def_article LIKE LINE OF input-article_info-def_article.
LOOP AT input-article_info-def_article INTO wa_def_article.matt