on 03-25-2019 2:48 PM
Hi,
I use the BADI above to trigger a web service outbound to send PO data to a third party system.
I need to send Work Order No for Item Lines in the WSDL and I have added this code in the above method in order to read the accounting data for item lines:
LOOP AT im_item->get_accountings( ) ASSIGNING FIELD-SYMBOL(<fs_accounting>).
IF sy-subrc = 0.
IF NOT <fs_accounting>-accounting->get_data( )-aufnr IS INITIAL.
** Do checks needed..
ENDIF.
ENDIF.
ENDLOOP.
However, I need the field AUFNR to be used in a method in the web service because I to write it to the WSDL. I read the data in PROCESS_ITEM but I need the data in another method.
How can this data be available to my method?
By "method in the web service" you mean the generated operation in proxy, or just another object that actually builds and send the request payload?
I think a good approach for such cases is a use of a singleton class. In POST method of your badi, generate an instance (if needed) of your singleton, and set the data that you want in that instance.
Then in your followed method retrieve that instance with the respective attributes to use them as you like.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Are you consuming the web service when the PO is saved to database and not everytime user press enter when changing an item?
In this case, shouldn't your code be triggered from POST method, there you have the final data, and from received im_header parameter you can get list of items with get_items method and then list of orders in accounting block from get_accountings method.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks Nick,
I created a singleton class with one attribute and I can now read the AUFNR field where I need it.
Regards,Peter
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks, but still; how will the data in the field symbol be available in my method in the web service which is outside the BADI?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yes, the consuming happens when the user presses SAVE. But placing the code in POST sounds more correct as you write, but I need the data for validation in the method of the web service that actually generates the XML?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
91 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.