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

[HELP] - BAPI_PRODORDCONF_CREATE_TT doesn't return an error

2,478

Hi,

I am facing the next situation and I would like to explain in 2 process. The first one is related to TCODE CO11N and the last one to REPORT Z using this BAPI.

a) When I execute the process using the TCODE CO11N, the result is a message error. This message has been changed form Warning to Error using TCODE OPJB and the result with ERROR RU(452) is OK. BUT

b) When the customer uses the REPORT Z which executes the BAPI PRODORDCONF_CREATE_TT, this doesn't return the RU(452) error message in IMPORTING return parameter or TABLES detail_return.

    ls_timetickets-orderid   = gv_aufnr.
    ls_timetickets-operation = '0010'.
    APPEND ls_timetickets TO lt_timetickets.

    ls_propose-quantity      = 'X'.
    ls_propose-activity      = 'X'.
    ls_propose-date_and_time = 'X'.
    ls_propose-goodsmovement = 'X'.

    CALL FUNCTION 'BAPI_PRODORDCONF_GET_TT_PROP'
      EXPORTING
        propose            = ls_propose
      IMPORTING
        return             = ls_returnpd
      TABLES
        timetickets        = lt_timetickets
        goodsmovements     = lt_goodsmovements
        link_conf_goodsmov = lt_link_conf_goodsmov.

*    Completar datos..
    READ TABLE lt_timetickets INTO ls_timetickets INDEX 1.

    IF sy-subrc IS INITIAL.

      ls_timetickets-orderid         = gv_aufnr.
      ls_timetickets-operation       = '0010'.
      ls_timetickets-yield           = gv_lmnga.
      ls_timetickets-conf_activity1  = gv_ism01.
      ls_timetickets-conf_acti_unit1 = gv_ile01.
      ls_timetickets-no_remn_acti1   = gv_lek01.
      ls_timetickets-conf_activity2  = gv_ism02.
      ls_timetickets-conf_acti_unit2 = gv_ile02.
      ls_timetickets-no_remn_acti2   = gv_lek02.
      ls_timetickets-conf_activity3  = gv_ism03.
      ls_timetickets-conf_acti_unit3 = gv_ile03.
      ls_timetickets-no_remn_acti3   = gv_lek03.
      ls_timetickets-conf_activity4  = gv_ism04.
      ls_timetickets-conf_acti_unit4 = gv_ile04.
      ls_timetickets-no_remn_acti4   = gv_lek04.
      ls_timetickets-conf_activity5  = gv_ism05.
      ls_timetickets-conf_acti_unit5 = gv_ile05.
      ls_timetickets-no_remn_acti5   = gv_lek05.
      ls_timetickets-conf_activity6  = gv_ism06.
      ls_timetickets-conf_acti_unit6 = gv_ile06.
      ls_timetickets-no_remn_acti6   = gv_lek06.
      ls_timetickets-plant           = gv_dwerk.
      ls_timetickets-work_cntr       = gv_zzarbpl.
      ls_timetickets-conf_quan_unit  = gv_amein.
      ls_timetickets-postg_date      = sy-datum.
      IF gv_pernr NE space.
        ls_timetickets-pers_no       = gv_pernr.
      ENDIF.

      CASE gv_turno.
        WHEN 1.
          ls_timetickets-conf_text = 'TA'.
        WHEN 2.
          ls_timetickets-conf_text = 'TB'.
        WHEN 3.
          ls_timetickets-conf_text = 'TC'.
        WHEN OTHERS.
      ENDCASE.

      MODIFY lt_timetickets FROM ls_timetickets INDEX 1.

*      Movimientos..
      REFRESH lt_link_conf_goodsmov.
      lv_cantidad_mat = '1'.

      READ TABLE lt_goodsmovements INTO ls_goodsmovements101
      WITH KEY move_type = '101'.

      READ TABLE lt_goodsmovements INTO ls_goodsmovements261
      WITH KEY move_type = '261'.

      REFRESH lt_goodsmovements.

      SELECT SINGLE mhdhb
        INTO lv_mhdhb
        FROM mara
       WHERE matnr = gv_plnbez.

      ls_goodsmovements101-material        = gv_plnbez.
      ls_goodsmovements101-plant           = gv_dwerk.
      ls_goodsmovements101-move_type       = '101'.
      ls_goodsmovements101-stck_type       = 'F'.
      ls_goodsmovements101-entry_qnt       = gv_lmnga.
      ls_goodsmovements101-entry_uom       = gv_amein.
      ls_goodsmovements101-orderid         = gv_aufnr.
      ls_goodsmovements101-expirydate      = gv_isdd + lv_mhdhb.
      ls_goodsmovements101-prod_date       = sy-datum.
      ls_link_conf_goodsmov-index_goodsmov  = lv_cantidad_mat.
      ls_link_conf_goodsmov-index_confirm   = '1'.

      APPEND ls_link_conf_goodsmov TO lt_link_conf_goodsmov.
      APPEND ls_goodsmovements101 TO lt_goodsmovements.

      LOOP AT gt_resb ASSIGNING <fs_resb>.

        CLEAR: ls_goodsmovements261.

        ls_goodsmovements261-material  = <fs_resb>-matnr.
        ls_goodsmovements261-plant     = <fs_resb>-werks.
        ls_goodsmovements261-stge_loc  = <fs_resb>-lgort.
        ls_goodsmovements261-batch     = <fs_resb>-charg.
        ls_goodsmovements261-move_type = '261'.
        ls_goodsmovements261-entry_qnt = <fs_resb>-bdmng.
        ls_goodsmovements261-entry_uom = <fs_resb>-meins.
        ls_goodsmovements261-item_text = <fs_resb>-potx1.
        ls_goodsmovements261-orderid   = gv_aufnr.
        lv_cantidad_mat = lv_cantidad_mat + 1.
        ls_link_conf_goodsmov-index_goodsmov  = lv_cantidad_mat.
        ls_link_conf_goodsmov-index_confirm   = '1'.

        APPEND ls_link_conf_goodsmov TO lt_link_conf_goodsmov.
        APPEND ls_goodsmovements261 TO lt_goodsmovements.

      ENDLOOP.

    ENDIF.

    LOOP AT gt_caract ASSIGNING <fs_caract> WHERE valor <> ''.

      CLEAR: ls_char, ls_char_link.

      ls_char-char_name = <fs_caract>-atnam.

      IF <fs_caract>-atwrt IS INITIAL.
        ls_char-char_value = <fs_caract>-valor.
      ELSE.
        ls_char-char_value = <fs_caract>-atwrt.
      ENDIF.
      APPEND ls_char TO lt_char.

      lv_cantidad_caract = lv_cantidad_caract + 1.
      ls_char_link-index_goodsmvt   = '1'.
      ls_char_link-index_char_batch = lv_cantidad_caract.
      APPEND ls_char_link TO lt_char_link.

    ENDLOOP.


    " ===========> HERE <===============
    CALL FUNCTION 'BAPI_PRODORDCONF_CREATE_TT'
      IMPORTING
        return                = ls_return
      TABLES
        timetickets           = lt_timetickets
        goodsmovements        = lt_goodsmovements
        link_conf_goodsmov    = lt_link_conf_goodsmov
        characteristics_batch = lt_char
        link_gm_char_batch    = lt_char_link
        detail_return         = lt_detail_return.


    "LS_retunr-types is empty and lt_detail_return doesn't have any error.
    IF NOT ls_return-type IS INITIAL.  

      CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.

*      Mensajes de error..
      LOOP AT lt_detail_return ASSIGNING <fs_detail_return> WHERE type = 'E'.
         "error process
ENDLOOP.
3 REPLIES 3
Read only

JJAIMES
Participant
2,045

Hi,


The error wasn’t solved while I was there.


Sorry.

Read only

Sandra_Rossi
Active Contributor
0 Likes
2,045

jose.jaimes Thanks for the feedback. By the way, you may post your feedback as an answer and close the question.

Read only

Sandra_Rossi
Active Contributor
0 Likes
2,045

Please use the COMMENT button for comments, asking for complements, adding details, replying to a comment or a proposed solution or to the OP question, etc., ANSWER is only to propose a solution, dixit SAP text at the right of the answer area.