cancel
Showing results for 
Search instead for 
Did you mean: 

Assign question list to Audit (PLM)

ifat_bar
Participant
0 Kudos
704

Hello,

I have created an audit via BAPI_BUS20350_CREATE. My requirment is to assign question list to this audit by function or bapi,

Either in the creaion phase or when changing the audit.

Please advise a function or bapi to create the assigmnet of the question list.

Regards

Yifat Bar

Accepted Solutions (1)

Accepted Solutions (1)

ifat_bar
Participant
0 Kudos

Hi,

Thanks for your answer, but I am writing a Z code and I am looking for an option to assign the question list

to the audit , not using XML , but via BAPI or FM.

Thanks

Yifat

Former Member
0 Kudos

Hi,

Try with the belwo BAPI's :

1. PLM_AUDIT_QUEST_COPY Assignment of Question Lists to Audit . ...

2. PLM_AUDIT_ACT_LINK Audit: Linkage of Objects with the Corrective Action .

3. PLM_AUDIT_ALV_GRID ALV Functions .

4. PLM_AUDIT_APPEARANCE PLM Audit Management:

I have given list of the BAPI/FM's used for the purpose of AUDIT.

Try with the 1 st one which may be useful to you.

Hope it helps you.

Thanks.

Arbind

Former Member
0 Kudos

Hello there,

How are you?

Nice 2 meet you. :+)

former_member662213
Contributor
0 Kudos

Hi,

I am also facing the same issue. If you get any solution, please let me know also.

Thanks

SUMIT GUPTA

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi,

I am trying to create a new audit from an existing one using BAPI_BUS20350_CREATE where the Planned Start Date of the new audit will be the Next Audit Date of the existing one.

I can obtain the details of the existing audit using BAPI_BUS20350_GET_DETAIL but I do not know how to populate some of the fields in the BAPI to create the new one. For instance, what do I put in the field external_id - or do I leave this blank?

Our Audits are not linked to an Audit Plan.

Can anyone send me an example of how to do this please? I have trawled many forums for some sample code but have so far been unsuccessful.

Hoping you can help,

Jan

Former Member
0 Kudos

Not sure if this is still unresolved. Nevertheless, using a BAPI may not be the best way to go here. Maybe better off Implementing the BADI - PLM_AUDIT_ATTRIBUTES and then making use of any of the below class interface methods:

IF_EX_PLM_AUDIT_ATTRIBUTES~CHANGE_QUEST_H_ON_COPY

IF_EX_PLM_AUDIT_ATTRIBUTES~CHANGE_QUEST_I_ON_COPY

IF_EX_PLM_AUDIT_ATTRIBUTES~CHANGE_PLAN_ON_COPY

IF_EX_PLM_AUDIT_ATTRIBUTES~CHANGE_AUDIT_ON_COPY

IF_EX_PLM_AUDIT_ATTRIBUTES~CHANGE_AUDITQUEST_ON_COPY

IF_EX_PLM_AUDIT_ATTRIBUTES~CHANGE_ACTION_ON_COPY

Former Member
0 Kudos

Hi,

After exploring a lot we could not find any Badi/Function Module to assign already existing Question List while creating new Audit. But after debugging standard transaction PLMD_AUDIT, we found the solution which goes as follows:-

Use BAPI_BUS20350_CREATE to create Audit

Following method can be used to assign Question List to an Audit:-

   call method cl_plm_audit_quest_services=>assign_questionnaire_2_audit
          exporting
            ir_audit                = ir_audit
*          IV_AUDIT_GUID    =
*          IR_QUEST_H       =
            iv_quest_h_guid   = l_questlist_guid

We need to pass following info:-

1) Audit: Pass Audit Guid or Audit instance

We tried to pass Audit Guid generated by BAPI_BUS20350_CREATE into above Method but it failed.

That left us with passing Audit Instance only and obviously this means that we need to code above method somewhere during Audit creation i.e. BADI since only there we can find audit instance.

PLM_AUDIT_ATTRIBUTES is one of the BADIs which is triggered for Audit creation using BAPI_BUS20350_CREATE. Its method - CHANGE_AUDIT_AT_CREATION solved our purpose.

2) Question List: Pass Guid or Question List instance

Question List Guid can be found in table CGPL_PROJECT by passing name of question list as EXTRENAL_ID

Use method cl_plm_audit_quest_services=>assign_questionnaire_2_audit

with above two parameters in an Audit BADI and you should be able to assign the Question list to Audit.

Former Member
0 Kudos

Hello,

I am not sure if it's best practice or not. I found the solution. Yes cl_plm_audit_quest_services=>assign_questionnaire_2_audit doesn't work because it assigns the question list but it's not saved inside that method. The method is also called when you assign question list in the standard transaction. However, the assignment is really saved when you save the audit. I found this solution:

    data : lr_projects type ref to cl_cgpl_projects,

           lr_audit    type ref to cl_cgpl_project.

    call method cl_cgpl_projects=>get_instance

      exporting

        im_application_type = 'AUD'

      receiving

        re_instance         = lr_projects.

   data lv_reload type xfeld.

    call method lr_projects->get_project_with_guid

      exporting

        im_guid        = lv_audit_guid

      importing

        ex_project     = lr_audit

        ex_reload_flag = lv_reload

      exceptions

        not_found      = 1.

    cl_plm_audit_quest_services=>assign_questionnaire_2_audit(

    exporting

    ir_audit = lr_audit

    "iv_audit_guid = lv_audit_guid

    iv_quest_h_guid = ls_quest_h-guid

   exceptions

   failed = 1

   others = 2

    ).

    "Assignments are saved when you call save method of projects

   lr_projects->save(

   exceptions

   save_failed = 1

   save_prohibited = 2

   others = 3

   ).

Former Member
0 Kudos

Hi,

You can use the BAPI_BUS20350_CREATE bapi to create audit and assign question lists to audit.

Please pass the question list to the AUDITQUESTRESULTS table.

Also set TASK_LEVEL as '1' while populating the above table. Task level indicates that you are trying to create a QL under audit.

Regards

Keerthi

Former Member
0 Kudos

Hi,

You can try XML import / export option for Question list. Which is a standard functionality

Please check this sap note which will help you in getting the XML file and the steps

SAP Note 597982.

You can do the valuation setting in SPRO > Cross Application>Audit Management > Question List> valuation specification.

Here maintain as Yes/ No valutaion and say that it is coded valutation. in Codes you maintain Yes / No with Yes 100 points and No 1 (whatever based on your view)

2) The same valuation you have to give in Questionlist in Valuation Spec Tab > Valuation profile.

3) You can assign individual question or a set of questions

4) In contact person you can maintain only Bussiness partners. you cannot maintain any other ids as this has reference to CRM.you can create your own BP ids. The tcode for the same is BP.you have to create BUP003.

Try it out.

Hope it helps you.

Thanks

Arbind