Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

BAPI for transaction QS21.

Aisurya
Participant
0 Likes
2,223

Hi experts,

I want to insert data from a custom class alike in T code : QS21 (Creating MIC), so am wondering for any BAPI .

Am a newbie to QM.

Can any one suggest me some procedure.

Thanks

Aisurya

10 REPLIES 10
Read only

Former Member
0 Likes
1,614

Hi,

Can you please check this BAPI,

BAPI_QPMK_SAVE_REPLICA

Regards,

Guna

Read only

0 Likes
1,614

Hi Guna,

How to pass the control data in to that..

Help me...

Thanks

Read only

kesavadas_thekkillath
Active Contributor
0 Likes
1,614

CTUT_FEATURE_DATA - pass your existing characteristics name here to get the values

CTUT_CHARACT_GET_TEXTS-to get texts

CLSE_SELECT_CABNT - to get values

Then use BAPI_QPMK_SAVEREPLICA to create one.

You can check the solution here to populate control data

Read only

0 Likes
1,614

HI ,

I followed the link , but how to pass " structure QMKST " in "MSTCHA-IND_CONTROL" field.

Shall i append the values and pass the structure in that field as a string, i guess no.

Pls help me in this.

Thanks

Aisurya.

Read only

0 Likes
1,614

Hi,


data:lwa_control type QMKST..
data:lwa_bapi type BAPIQPMK_QPMK.

lwa_control-SYNCRO = 'X'.
lwa_control-FORMELMK = 'X'.

call method cl_abap_container_utilities=>fill_container_c
exporting
im_value = lwa_control
importing
ex_container = lwa_bapi-IND_CONTROL "Your Bapi field
exceptions
illegal_parameter_type = 1
others = 2. 

Read only

0 Likes
1,614

Hi Keshab ,

It is helpfull , thanks but am stuck in some other places . I am very new to QM.

Below is my code :

data:lwa_control type QMKST.
data:lwa_bapi type TABLE OF BAPIQPMK_QPMK,
      wa_bapi like line of lwa_bapi .

lwa_control-SYNCRO = 'X'.
lwa_control-FORMELMK = 'X'.
lwa_control-QUANTITAT = 'X'.

call method cl_abap_container_utilities=>fill_container_c
exporting
im_value = lwa_control
importing
ex_container = wa_bapi-IND_CONTROL "Your Bapi field
exceptions
illegal_parameter_type = 1
others = 2.

data : lv_MSTCHA_INSP_METH  type TABLE OF BAPIQPMK_QPMZ,
lt_MSTCHA_TEXT  type TABLE OF BAPIQPMK_QPMT,
wa_MSTCHA_TEXT  like line of  lt_MSTCHA_TEXT,
lv_MSTCHA_LONGTEXT  type  BAPIQPMK_LONGTEXT,
lv_MSTCHA_SMPL_LTXT type  BAPIQPMK_SMPL_LTXT,
lv_return type table of bapiret2.

wa_bapi-PLANT_QPMK = 'QM'.
append wa_bapi to lwa_bapi.

wa_MSTCHA_TEXT-LANGU = 'EN'.
wa_MSTCHA_TEXT-CHAR_DESCR = 'Testing using a bapi'.
append wa_MSTCHA_TEXT to lt_MSTCHA_TEXT.
  CALL FUNCTION 'BAPI_QPMK_SAVEREPLICA'
    TABLES
      MSTCHA                 = lwa_bapi
*     MSTCHA_INSP_METH       =
      MSTCHA_TEXT            = lt_MSTCHA_TEXT
*     MSTCHA_LONGTEXT        =
*     MSTCHA_SMPL_LTXT       =
      RETURN                 = lv_return
*     EXTENSION1             =
            .

and get some error in return i.e

row, type, ID, Number, Message

1, E, QP, 661 , The key for the master insp. characteristic was not completely entered

2, E, QS 375 , Create insp. method/master insp. characteristic : Details not complete

3, W, Q0 202 , Dependent control indicators will be canceled

4, W, Q0 205 , Calculated characteristic will be reset

5, S, QP 504 , Non-relevant fields will be initialized

6, E, QP 504 , Non-relevant fields will be initialized

7, E, QS 376 , Complete the short text data

Thanks

Aisurya.

Read only

0 Likes
1,614

Read the Bapi documentation in SE37 by clicking the parameters in it.

kesav

Read only

0 Likes
1,614

Hi kesav,

I am passing all the mandatory parameters into the BAPI, but still i get some error,warning in the Return.


1	E	QP	661	The key for the master insp. characteristic  was not completely entered
2	E	QS	375	Create insp. method/master insp. characteristic : Details not complete
3	W	Q0	202	Dependent control indicators will be canceled
4	W	Q0	205	Calculated characteristic will be reset
5	S	QP	504	Non-relevant fields will be initialized
6	E	QP	504	Non-relevant fields will be initialized
7	E	QS	376	Complete the short text data

Please help me in this.

Thanks

Aisurya

Read only

0 Likes
1,614

hi needy,

You can solve this problem by following code...

Note : Preset Indicators has to be used for setting control indicators as shown.

SELECT SINGLE * FROM  TQ27 into i_TQ27 where STEUERKZ eq itab-IND_CONTROL.

   CONCATENATE   i_TQ27-QUANTITAT  
                 i_TQ27-MESSWERTE
                 i_TQ27-PRUEFKAT
                 i_TQ27-TOLEROBEN
                 i_TQ27-TOLERUNTEN
                 i_TQ27-SOLLPRUEF
                 i_TQ27-PUMFKZ
                 i_TQ27-LZEITKZ
                 i_TQ27-ESTUKZ
                 i_TQ27-DOKUKZ
                 i_TQ27-RZWANG
                 i_TQ27-SYNCRO
                 i_TQ27-ADDPRO
                 i_TQ27-ZERSTPRF
                 i_TQ27-FORMELMK
                 i_TQ27-STICHPR
                 i_TQ27-AUSSLOS
                 i_TQ27-FIXIERT
                 i_TQ27-BEWFHLZHL
                 i_TQ27-LSTKZ
                 i_TQ27-VORGAEND
                 i_TQ27-PMMZWANG
                 i_TQ27-FEHLREC
                 i_TQ27-AENDBELEG
                 i_TQ27-QSPCMK
                 i_TQ27-KEINDRUCK
                 i_TQ27-PARA   INTO  I_MSTCHA-IND_CONTROL RESPECTING BLANKS.

"concatenate above fields into
IND_CONTROL field. and give it to

BAPI_QPMK_SAVEREPLICA

...and its working fine

Read only

0 Likes
1,614

Gr8 Sirjii Cheers