on 04-02-2007 2:02 PM
Hi Experts,
I have made some changes in the BBP_DOC_CHECK_BADI for the BUS2201 object implementation whereby I had implemented the changes for checking the attachment details in the Purchase Order. Now here I used the Function Module BBP_PD_PO_GETDETAIL to get the PO details by giving the GUID as iv_doc_guid.
The sample code is below :
CALL FUNCTION 'BBP_PD_PO_GETDETAIL'
EXPORTING
I_GUID = iv_doc_guid
I_WITH_ITEMDATA = 'X'
IMPORTING
ET_ATTACH = gt_attach
TABLES
E_ITEM = gt_item
I have taken the details of attachments which get populated in the structure ET_ATTACH and checked for various conditions in attachments.
I find that if the PO has a change version wherein the previous version did not have any attachments - everything works normally.
But if the previous version of PO had faulty attachments - and the user deletes the attachments in the change version - I find that the function module still takes the active version GUID as input to the PO as a result of which it checks for the faulty attachments and throws error.
Now there are no attachments in the change version of the PO. Can any one tell me whether it is possible to pass the guid -- such that it checks if the same attachments in the active document have been modified in the change version , so that if the faulty attachments in the active version are changed to the correct ones it should not throw an error!!!
Looking forward for your expert comments.
With Regards,
Rajesh R
The solution for the problem was found myself, with some valuable inputs from the experts. I have given suitable reward points.
Message was edited by:
Rajesh Rajendran
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi All,
I have got the solution for the problem.
I actually got the GUID for the change version from the E_VERSION structure and then used that GUID to check for the conditions which then worked perfect.
If the attachment had been deleted in the change version then there were no errors being thrown from the active version .
Thanks a lot for all your valuable inputs..
With Reagards,
Rajesh
Message was edited by:
Rajesh Rajendran
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
What you need to do is to check if there is an active changeversion. Just enhance your code with :
retrieve attachment data for the order
CALL FUNCTION 'BBP_PD_PO_GETDETAIL'
EXPORTING
I_GUID = iv_doc_guid
TABLES
E_ATTACH = lt_attach
E_VERSION = lt_version.
Then loop over lt_version and check if there is an active change version. Use the guid of that change version to retrieve the correct attachments (again using FM BBP_PD_PO_GETDETAIL).
Edit:
or you might try FM BBP_PO_MEMORY_GET.
Message was edited by:
Robin Janke
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Robin,
My requirement is to check if an attachment which existed in the active version has been changed in any of the changed version ( i.e if it is deleted ) then there should be no error thrown for that attachment as it has been deleted.Now I am getting 2 errors for the same attachment one from the active version and the other from the change version.
when the change version attachment is deleted, one of the error goes but not the one coming frm active version as the attachment is still there and the changes have not been approved so it is not closed.
I have also analysed the comparison of versions as menationed by you.
Can you help me with sample code as to finding the latest change version -- and then comparing the version where the attachment is changed ( mostly the active ) as the other cases my code works fine.
Thanks in advance.
With Regards,
Rajesh
Hi
Which SRM version are you using ?
I guess there is problem in the code. Please send you detailed requirements.
Here is some sample code.
data lt_attach TYPE bbpt_pds_att_t.
CALL FUNCTION 'BBP_PD_PO_GETDETAIL'
EXPORTING
i_guid = iv_guid
i_attach_with_doc = 'X'
i_with_itemdata = ''
IMPORTING
et_attach = lt_attach.
loop at lt_attach into ls_attach where del_ind = space. " Documents which rae not deleted
* DEL_IND -> Deletion Indicator SRM Purchasing Document
*--- other relevant fields
* GUID Globally Unique identifier
* DOC_ID Business Document Service: Document ID
* DOC_VER_NO Business Document Service: Document version number
endloop.
<b>Other related links.</b>
<u>http://help.sap.com/saphelp_srm50/helpdata/en/49/b32640632cea01e10000000a155106/frameset.htm
http://help.sap.com/saphelp_srm50/helpdata/en/c1/ab3d41d4cc4c0de10000000a1550b0/frameset.htm
http://help.sap.com/saphelp_srm50/helpdata/en/ea/59bc392ceddf3ce10000000a114084/frameset.htm</u>;
Regards
- Atul
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Atul,
Thanks for your reply . I have found that this case occurs for Shopping Carts which had the invalid attachments previously and the purchase orders generated with the same attachments. I mean when the demand had not moved to production. So when this changes have been moved, I find that the error comes in the PO 2 times. ( i,e one for the change version and other for the active version ).
when the attachment in the PO line item is deleted, i find that the one of the error of the attachment is removed. but the error coming from the active version for the same attachment is still there.
Now, I need to check that if the attachment which was there in the active version of the PO was deleted in the change version then this error should not pop up.
I have made the declarations as mentioned in your reply but I guess I would need to compare the versions and the attachments included in the latest change and the active document and then decide whether the error should be thrown for the attachment.
Kindly guide in ths regard.
With Regards,
Rajesh
Hi
Read this ...
As I told you in my earlier reply ...
<u>ET_ATTACH table uses structure - BBP_PDS_ATT_T . This structure has following fields -></u>
GUID Globally Unique identifier
P_GUID Parent GUID
LOGICAL_SYSTEM Business Document Service: ID of Logical System
CLASSNAME Business Document Service: Class name
CLASSTYPE Business Document Service: Class type
OBJKEY Business Document Service: Object key
DOC_ID Business Document Service: Document ID
DOC_VER_NO Business Document Service: Document version number
DOC_VAR_ID Business Document Service: Document variant ID
DESCRIPTION Attachment Description
URL URL Case-Sensitive
TYPE Procurement Document Attachment Type
INTERNAL_IND Indicator Showing if Attachment is only for Internal Use
DEL_IND Deletion Indicator SRM Purchasing Document
<u>We can use either the DOC_ID / DOC_VER_NO fields to determine the active versions. You need to see in debugging, which all fields get poupulated with values in case of versions in this structure, to code your logic accordingly.</u>
<u>Anyways, please find some sample code for dealing with Active versions.</u>
append lines of et_attach to lt_attachment_versions.
* Due to the fact, that the currently active version is in the
* received phio list and that it is possible, that there are
* several phios with the same version number (check_in) the
* output table has to be additionally prepared.
SORT lt_attachment_versions BY
guid ASCENDING
p_guid ASCENDING
loio_class ASCENDING
phio_version_no ASCENDING
changetime DESCENDING.
lv_version_no = 1.
WHILE lv_version_no < is_attach-phio_version_no.
READ TABLE lt_attachment_versions
INTO ls_attachment_version WITH KEY
guid = is_attach-guid
p_guid = is_attach-p_guid
phio_version_no = lv_version_no
del_ind = space.
IF sy-subrc EQ 0.
APPEND ls_attachment_version TO et_attach_versions.
ENDIF.
lv_version_no = lv_version_no + 1.
ENDWHILE.
DELETE et_attach_versions WHERE NOT del_ind IS INITIAL.
<u>Other links which might help.</u>
<b>http://help.sap.com/saphelp_srm50/helpdata/en/46/882fdd8bfc1743bd5ef8b532f94402/frameset.htm
http://help.sap.com/saphelp_srm50/helpdata/en/a7/81b463611c124d8c9d2c5bd8d17b34/content.htm</b>;
Hope this will help.
Regards
- Atul
Hi Atul,
Thanks for your sample code. But here I find that after running the function module BBP_PD_PO_GETDETAIL and passing the active as well as change guids :
The version number i,e ET_ATTACH- DOC_VER_NO & ET_ATTACH-DOC_VAR_ID
remains zero for both active and change version.
But I find that within the function module a table E_VERSION is being used which keeps a record of the versions. Now as per my requirement, i need to pass the guid of the change version in which attachments have been modified correctly and then check. This attachment would be there is active version and I dont want the function module to pick up that guid.
I hope you have understood my requirement. Kindly guide.
With Regards,
Rajesh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.