on 12-19-2008 2:53 PM
Hi,
I have a object in my container which is of type BUS2081.
I need to read its key values(InvoiceDocNumber, FiscalYear) in my task method for further processings.
I have found these macros swc_get_object_type, swc_get_object_key. But not getting how could i use these for my scenario.
Could anybody explain how can i achieve this ?
Regards,
Anbarasan K
Hi Anbarasan,
1.Declaring the variable Object as an object reference with type SWC_OBJECT
Call: DATA <Object> TYPE SWC_OBJECT.
The variable <Object> declared holds the object reference in the form of an "object handle", that is, in a runtime structure that only exists within a program context.
But containers passed via a function module interface always contain persistent object references. Before you read an object reference from a container and store it in the variable <Object> , you must make all object references in the container into handles. The macro SWC_CONTAINER_TO_RUNTIME does this for you.
This note only applies to you if:
o You read a role parameter container for role resolution.
o You read an event parameter container within a check function module or a receiver type function module.
If you are within the object type program, the container does not have to be converted.
2.Reading an object reference from a container
Call: SWC_GET_ELEMENT <Container> <Element> <Object>.
Container describes a container instance created with the macro instruction SWC_CONTAINER .
Element is the ID of the container element, under which the object reference was stored.
Object is the object reference declared with TYPE SWC_OBJECT .
3.Separating the object type-specific key from the object reference:
Call: SWC_GET_OBJECT_KEY <Object> <ObjectKey>.
4.Separating the ID of the object type from the object reference:
Call: SWC_GET_OBJECT_TYPE <Object> <ObjectType>.
Object type is the ID of the object type and is declared with
DATA <Object type> LIKE SWOTOBJID-OBJTYPE.
By
Pari
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks Pari & Pavan.
I got it with the following code.
DATA: l_bus2081 TYPE swc_object,
l_bus2081key TYPE swotobjid-objkey.
swc_get_element container 'InvDocObject' l_bus2081.
swc_get_object_key l_bus2081 l_bus2081key.
L_BELNR = l_bus2081key+0(10). "InvoiceDocNumber
L_GJAHR = l_bus2081key+10. "FiscalYear
Thank you.
Regards,
Anbarasan K
Hi Anbarasan,
In order to retrieve the Key Values (Invoice Doc # and Fiscal Year), you need to use the below fields in your code:
"object-key-invoicedocnumber" for Invoice Doc #
"object-key-fiscalyear" for Fiscal Year.
e.g., if you want to concatenate the Invoice Doc # and Fiscal year into one variable, you will write the following piece of code:
concatenate object-key-invoicedocnumber object-key-fiscalyear into varialbe1.
Hope this helps.
Regards,
anwar.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
No, the macros right one you have to use is
SWC_SET_ELEMENT conatiner <name> <value>
SWC_SET_TABLE conatiner <Name> <value>.
In your case you have to use SWC_SET_ELEMENT this will pass the values from BO--to task container
make sure that you make the task conatiner elements as Import Export Enabled.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
75 | |
9 | |
7 | |
6 | |
6 | |
6 | |
6 | |
6 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.