Skip to Content

Problem with BAPI_BUS1077_CREATE

Hello all, I am working with EH&S module and we need to create new values assignments in a property using BAPI_BUS1077_CREATE. Please can you give us some examples to do it? I have the substance created and I need only create values por a specific characteristic.

I tried with other references in this forum but it is not working for us.

Thanks in advance

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

2 Answers

  • Nov 27, 2018 at 04:29 PM

    Our code is this if you want to check it and you can help us to solve the issue.

    Thanks in advance.

    SPAN { font-family: "Courier New"; font-size: 10pt; color: #000000; background: #FFFFFF; } .L0S31 { font-style: italic; color: #808080; } .L0S32 { color: #3399FF; } .L0S33 { color: #4DA619; } .L0S52 { color: #0000FF; } .L0S55 { color: #800080; } .L0S70 { color: #808080; }

    REPORT zprueba_sust.

    CONSTANTS: c_prov(6) TYPE c VALUE 'C_PROV'.
    CONSTANTS: c_n_prov(8) TYPE c VALUE 'C_N_PROV'.

    DATA: ls_sustancia TYPE zsustancia_s,
    lt_return TYPE TABLE OF bapiret2,
    lt_return_c TYPE TABLE OF bapiret2,
    lt_return_s TYPE TABLE OF bapiret2,
    ls_return_t TYPE bapiret2,
    lt_sub_header TYPE TABLE OF bapi1077rh,
    ls_sub_header TYPE bapi1077rh,
    lt_prop_data TYPE TABLE OF bapi1077pr,
    lt_prop_data_bapi TYPE TABLE OF bapi1077pr,
    lt_prop_data_bapi_create TYPE TABLE OF bapi1077pr,
    lt_prop_datax TYPE TABLE OF bapisubprx,
    ls_prop_datax TYPE bapisubprx,
    ls_prop_data TYPE bapi1077pr,
    ls_estva TYPE estva,
    ls_estvh TYPE estvh,
    lt_estmj TYPE STANDARD TABLE OF estmj WITH HEADER LINE,
    lt_eine TYPE STANDARD TABLE OF eine WITH HEADER LINE,
    ls_eina TYPE eina,
    lv_cont TYPE i,
    lv_c TYPE i,
    lt_prop_header TYPE STANDARD TABLE OF bapi1077vh,
    ls_prop_header TYPE bapi1077vh,
    lt_prop_val TYPE STANDARD TABLE OF bapi1077va,
    ls_prop_val TYPE bapi1077va,
    lt_ident_header TYPE STANDARD TABLE OF bapi1077ri,
    lt_ident_longtext TYPE STANDARD TABLE OF bapi1077il,
    lt_ident_sublist TYPE STANDARD TABLE OF bapi1077rl,
    lt_prop_usage TYPE STANDARD TABLE OF bapi1077du,
    lt_prop_component TYPE STANDARD TABLE OF bapi1077vp,
    ls_prop_component TYPE bapi1077vp,
    lt_prop_componentx TYPE STANDARD TABLE OF bapisubvpx,
    ls_prop_componentx TYPE bapisubvpx,
    lt_prop_ftext TYPE STANDARD TABLE OF bapi1077df,
    lt_prop_ftext_longtext TYPE STANDARD TABLE OF bapi1077fl,
    lt_prop_source TYPE STANDARD TABLE OF bapi1077ds.

    DATA: lv_val1 TYPE atnam.
    DATA: lv_val2 TYPE atnam.
    DATA: lv_flag(1) TYPE c.
    DATA: ls_lfa1 TYPE lfa1.
    DATA: lv_prov TYPE atwrt.
    DATA: lv_name TYPE atwrt.
    DATA: lv_tb TYPE sy-tabix.

    DATA: record_no_wa TYPE eserecn.
    DATA: l_estva_wa TYPE estva.

    DATA: lt_refsubs TYPE TABLE OF bapi1077rr,
    ls_refsubs TYPE bapi1077rr.

    REFRESH lt_sub_header.
    ls_sub_header-substance = '000000100335'.
    APPEND ls_sub_header TO lt_sub_header.

    *se obtienen los detalles de las sustancias obtenidas mediante la siguiente bapi:
    CALL FUNCTION 'Z_EHS_OBTAIN_EAN_TABLA'
    TABLES
    it_sub_header = lt_sub_header
    prop_header = lt_prop_header
    et_return = lt_return.

    SELECT SINGLE valor
    INTO ls_prop_data-name_char
    FROM zmaestro_valores
    WHERE programa = sy-repid
    AND id = c_prov.
    lv_val1 = ls_prop_data-name_char.
    CLEAR ls_prop_data.

    SELECT SINGLE valor
    INTO ls_prop_data-name_char
    FROM zmaestro_valores
    WHERE programa = sy-repid
    AND id = c_n_prov.
    lv_val2 = ls_prop_data-name_char.
    CLEAR ls_prop_data.

    READ TABLE lt_prop_header INTO ls_prop_header WITH KEY subchacat = 'ZSAP_EHS_1000_007A'.
    READ TABLE lt_sub_header INTO ls_sub_header INDEX 1.

    ls_prop_val-function = '009'.
    ls_prop_val-primarykey = 1.
    ls_prop_val-flgprimkey = 'X'.
    ls_prop_val-foreignkey = ls_prop_header-record_no.
    ls_prop_val-flgfrgnkey = ' '.
    ls_prop_val-sequence = 1.
    APPEND ls_prop_val TO lt_prop_val.

    ls_prop_data-function = '009'.
    ls_prop_data-primarykey = 2.
    ls_prop_data-flgprimkey = 'X'.
    ls_prop_data-foreignkey = ls_prop_val-primarykey.
    ls_prop_data-flgfrgnkey = ls_prop_val-flgprimkey.
    ls_prop_data-name_char = lv_val1.
    ls_prop_data-char_value = '6'.
    ls_prop_data-oper_inc = 0.
    APPEND ls_prop_data TO lt_prop_data.

    REFRESH lt_return.
    CALL FUNCTION 'BAPI_BUS1077_CREATE'
    EXPORTING
    flg_prop_data = 'X'
    flg_prop_header = 'X'
    TABLES
    return = lt_return
    sub_header = lt_sub_header
    prop_val = lt_prop_val
    prop_data = lt_prop_data.

    CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
    EXPORTING
    wait = 'X'
    IMPORTING
    return = ls_return_t.

    CALL FUNCTION 'BAPI_BUS1077_SAVEFROMBUFFER'
    EXPORTING
    flg_luw_close_for_bapi = 'X'
    TABLES
    return = lt_return_s.

    Add comment
    10|10000 characters needed characters exceeded

  • Dec 29, 2018 at 12:53 PM

    Hello

    with EHS installaiotn i believe three or four BAPI examples are delivered. They are discvussed very often here. Please check other threads (e.g. EHS for Beginners etc.)

    C.B.

    Add comment
    10|10000 characters needed characters exceeded