SAP for Engineering, Construction, and Operations Discussions
Share your knowledge on SAP for Engineering, Construction, and Operations, connect with community members, and join discussions.
cancel
Showing results for 
Search instead for 
Did you mean: 

Need BP's stuck in CR

0 Kudos

Hello,

I need to find BP number which are stuck in CR and exclude them for further processing, using the API to find CR status but while running the code found that no value coming to et_crequest. Can anyone please help. Below is the code.

SELECT-OPTIONS: s_bp FOR but000-partner.
TYPES: BEGIN OF ity_bp,
partner TYPE bu_partner,
END OF ity_bp.
DATA: it_bp TYPE STANDARD TABLE OF ity_bp,
wa_bp TYPE ity_bp.
DATA:lv_bp TYPE usmd_value,
ev_status TYPE abap_bool,
lt_crequest TYPE usmd_ts_crequest.

START-OF-SELECTION.
SELECT partner FROM but000 INTO TABLE it_bp WHERE partner IN s_bp.
IF sy-subrc = 0.
LOOP AT it_bp INTO wa_bp.
lv_bp = s_bp.
CALL METHOD cl_usmd_crequest_api=>if_usmd_crequest_api~retrieve_crequest
EXPORTING
iv_entity = 'BP_HEADER'
it_entity_key = VALUE #( ( fieldname = 'BP_HEADER' value = lv_bp ) )
iv_model = 'BP'
IMPORTING
et_crequest = lt_crequest.

DELETE lt_crequest WHERE usmd_creq_status EQ '05'.
DELETE lt_crequest WHERE usmd_creq_status EQ '06'.
IF NOT lt_crequest[] IS INITIAL.
ev_status = abap_true. "Open CR is availale

DATA(lv_cr) = lt_crequest[ 1 ]-usmd_crequest.
WRITE:/ lv_cr.

ENDIF.


WRITE:/ 'done'.
ENDLOOP.
ENDIF.

1 REPLY 1

former_member27
Community Manager
Community Manager
0 Kudos

Welcome to the SAP Community. Thank you for visiting us to get answers to your questions.

Since you're asking a question here for the first time, I'd like to offer some friendly advice on how to get the most out of your community membership and experience.

First, please see https://community.sap.com/resources/questions-and-answers, as this resource page provides tips for preparing questions that draw responses from our members. Second, feel free to take our Q&A tutorial at https://developers.sap.com/tutorials/community-qa.html, as that will help you when submitting questions to the community.

I also recommend that you include a profile picture. By personalizing your profile, you encourage readers to respond: https://developers.sap.com/tutorials/community-profile.html.

Now for some specific suggestions on how you might improve your question:

* Share screenshots of what you've seen/done (if possible), as images always helps our members better understand your problem.

* Make sure you've applied the appropriate tags -- because if you don't apply the correct tags, the right experts won't see your question to answer it.

* Use the "insert code" feature when sharing your code, so members have an easier time reading.

Should you wish, you can revise your question by selecting Actions, then Edit.

The more details you provide (in questions tagged correctly), the more likely it is that members will be able to respond. As it stands, I don't know if there is enough information here for members to understand your issue. So please consider revising your question because I'd really like to see you get a solution to your problem!

I hope you find this advice useful, and we're happy to have you as part of SAP Community!

Regards,

Dedi

Regards,
Dedi Metser