cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Unmanaged late numbering - ADJUST_NUMBER in save phase

clemrngt
Participant
0 Kudos
526

Hello All,

I usually use unmanaged numbering in managed RAP application.

When I do this, when I create a new entity, then in adjust_number method, I have the entity I just created :

clemrngt_0-1731958689900.png

 

However, in the unmanaged RAP application, MAPPED is empty :

clemrngt_1-1731958836676.png

This is the create by association method I'm using :

  METHOD cba_Orders.
    DATA n TYPE i VALUE 1.

    LOOP AT entities_cba INTO DATA(ls_entity).
    LOOP AT ls_entity-%target INTO DATA(ls_target).

      APPEND VALUE #(
       pid = n
       product_id = ls_target-product_id
       quantity = ls_target-quantity
      ) TO lhc_ZTEST_CUST_NORTHWIND=>mt_buffer_create.

      APPEND VALUE #(
      %cid = ls_target-%cid
      %pid = n
      product_id = ls_target-product_id ) TO mapped-ztest_cust_northwind_order.

      n = n + 1.
    ENDLOOP.
  ENDLOOP.

ENDMETHOD.

Am I doing something wrong ?

 

For now, I'm using a workaround : I store the PID in a buffer table with data created, and I use this buffer table to loop to PID generated in CREATE BY ASSOCIATION and use it in the ADJUST_NUMBER methode :

METHOD adjust_numbers.

  LOOP AT lhc_ZTEST_CUST_NORTHWIND=>mt_buffer_create ASSIGNING FIELD-SYMBOL(<ls_buffer>).

    SELECT MAX( order_id )
      FROM ztest_cust_northwind_order
      WHERE product_id = @<ls_buffer>-product_id
      INTO @DATA(lv_orderid).

      lv_orderid = lv_orderid + 1.

      APPEND VALUE #(
      %pid = <ls_buffer>-pid
      %tmp = VALUE #( product_id = <ls_buffer>-product_id )
      product_id = <ls_buffer>-product_id
      order_id = lv_orderid ) TO mapped-ztest_cust_northwind_order.

      <ls_buffer>-order_id = lv_orderid.

    ENDLOOP.

  ENDMETHOD.

But I don't understand why it is not coming natively in MAPPED structure ?

 

Thx in advance

Accepted Solutions (0)

Answers (0)