Skip to Content
0
Dec 20, 2011 at 03:18 PM

Confirm Activities on Inspection

186 Views

Hi,

I am trying to confirm activities on an Inspection, and it appears to be working ok,where I can allocate time to machine field, however I can not get it to allocate costs to the order through the program. And YET, if I manually confirm the activity and subsequently run the program, its confirms the activity and allocates the cost. So Obviously the on-line transaction is doing something extra, but I cant see it. anyone got any experience with this?

attached is a sample of the code I am testing with.

  • set up the Inspection number

move gs_indata-aufnr to lv_prueflos.

CALL FUNCTION 'QPSE_LOT_READ'

EXPORTING

I_PRUEFLOS = lv_prueflos

IMPORTING

E_QALS = gs_qals

EXCEPTIONS

NO_LOT = 1

OTHERS = 2.

MOVE: gs_qals-AUFNR_co TO gs_OPERKEY-AUFNR,

gs_qals-aufpl to gv_AUFPL,

  • gs_qals-PLNFL TO gs_OPERKEY-APLFL,

gs_indata-vornr TO gs_OPERKEY-VORNR.

CALL FUNCTION 'CO_RU_CONFIRMATION_PREPARE'

EXPORTING

AKTYP_IMP = C_AKTYP_P

AUFPL_IMP = gv_AUFPL

AUTYP_IMP = C_AUTYP_QM

OPER_KEY = gs_OPERKEY

NO_DIALOG_FLAG = 'X'

SUPPRESS_SUGGESTION = C_KREUZ

NO_MSG_QM_CHAR = C_KREUZ

IMPORTING

AFRUD_EXP = gs_AFRUD "global

AFVGD_EXP = gs_AFVGD "global

AKTYP_EXP = Gv_AKTYP_S

CAUFVD_EXP = GS_CAUFVD "global

EXCEPTIONS

ORDER_ALREADY_LOCKED = 01

NEW_STATUS_NOT_POSSIBLE = 02

INTERRUPT_BY_USER = 03

OTHERS = 08.

if sy-subrc = 0.

  • gs_AFRUD-ism01 = gs_indata-xmnga.

gs_AFRUD-ism02 = gs_indata-lmnga.

call function 'CONVERSION_EXIT_CUNIT_INPUT'

EXPORTING

INPUT = gs_indata-gmein

IMPORTING

OUTPUT = gs_indata-gmein

EXCEPTIONS

UNIT_NOT_FOUND = 1

OTHERS = 2.

  • Amend AFRUD Data to include values we want.

gs_AFRUD-ile01 = gs_indata-gmein.

gs_AFRUD-ile02 = gs_indata-gmein.

gs_AFRUD-LEK02 = gs_indata-aueru.

gs_AFRUD-ISDD = gs_indata-isdd.

gs_AFRUD-isdz = gs_indata-isdz.

MOVE '7' TO gs_AFRUD-ORIND.

MOVE gs_AFRUD TO gs_AFRUD_tmp.

CALL FUNCTION 'CO_RU_CONFIRMATION_CHECK'

EXPORTING

AFRUD_IN = gs_AFRUD_tmp

AKTYP_IN = Gv_AKTYP_S

CAUFVD_IN = GS_CAUFVD

IMPORTING

AFRUD_EXP = gs_AFRUD

TABLES

NAMTAB = gt_ftab.

*

CALL FUNCTION 'CO_RU_EDIT_CONF'

EXPORTING

AFRUD_IMP = gs_AFRUD

AFVGD_IMP = gs_AFVGD

AKTYP_IMP = Gv_AKTYP_S

CAUFVD_IMP = GS_CAUFVD

  • CORUF_IMP = CORUF

IMPORTING

AFRUD_EXP = gs_AFRUD

AKTYP_EXP = Gv_AKTYP_S .

  • Rückmeldebelegtabelle lesen

CALL FUNCTION 'CO_RU_BT_AFRU_BT_GET'

TABLES

AFRU_TAB = gt_AFRUBTAB

EXCEPTIONS

NO_ENTRY = 01.

CALL FUNCTION 'CO_RU_CONFIRMATION_ADD'

EXPORTING

AFRUD_IN = gs_AFRUD

AFVGD_IN = gs_AFVGD

AKTYP_IN = 'H'

AKTYP_PIC_IN = 'V'

CAUFVD_IN = GS_CAUFVD

IMPORTING

CAUFVD_OUT = GS_CAUFVD

TABLES

AFRUD_TAB = gt_AFRUDTAB.

CALL FUNCTION 'CO_RU_CONFIRMATION_POST'

EXPORTING

cprot_flg = 'X'

ext_flg = c_kreuz

gprot_flg = space

NO_BACK_FLUSH_FLG = 'X'

NO_GOODS_RECEIPT_FLG = 'X'

TRANS_TYP = 'H'

EXCEPTIONS

POSTING_ERROR = 1.

endif.