cancel
Showing results for 
Search instead for 
Did you mean: 

In CJ20N, on create material component, copy longtext from other material component

fabian_nelis
Explorer
0 Kudos

Hello, in the project builder (CJ20N), I'm trying to copy the Longtext from an existing componenent, to a newly created one (on creation)

I have played with some FM, but after creation of the component, when visiting the longtext, it stays empty:

- CO_ZK_TEXTKEY_RESB to get the textkey

- READ_TEXT

- COPY_TEXT

- INIT_TEXT

- SAVE_TEXT

- TEXT_COPY

Any solutions to my problem?

Thanks in advance

    IF resbd-rsnum IS NOT INITIAL AND resbd-rspos IS NOT INITIAL AND resbd-matnr IS NOT INITIAL.
*╔═════════════════════════════════════════════════════════════════════════╗
*║ SET LONG TEXTS FROM FIRST COMPONENT ║
*╚═════════════════════════════════════════════════════════════════════════╝
CALL FUNCTION 'CO_BC_RESBBT_GET'
EXPORTING
aufnr_imp = caufvd-aufnr
TABLES
resbbt_exp = lt_resbd.

DELETE lt_resbd WHERE xloek EQ abap_true OR vornr NE afvgd-vornr.

DATA: lv_ltsch_first TYPE stxh-tdname.
DATA: lv_ltsch_new TYPE stxh-tdname.

CALL FUNCTION 'CO_ZK_TEXTKEY_RESB'
EXPORTING
rsnum = lt_resbd[ 1 ]-rsnum
rspos = lt_resbd[ 1 ]-rspos
rsart = lt_resbd[ 1 ]-rsart
IMPORTING
ltsch = lv_ltsch_first.

CALL FUNCTION 'CO_ZK_TEXTKEY_RESB'
EXPORTING
rsnum = resbd-rsnum
rspos = resbd-rspos
rsart = resbd-rsart
IMPORTING
ltsch = lv_ltsch_new.

CALL FUNCTION 'TEXT_COPY'
EXPORTING
* CHECK_ID = 'X'
* ID_NEW = ' '
id_old = 'MATK'
ltsch_new = lv_ltsch_new
ltsch_old = lv_ltsch_first
* OBJECT_NEW = ' '
object_old = 'AUFK'
* SPRAS_NEW = ' '
spras_old = sy-langu
* SAVEMODE_DIRECT = ' '
EXCEPTIONS
not_found = 1
OTHERS = 2.
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.

DATA: lt_component TYPE cobai_t_component.
APPEND CORRESPONDING #( resbd ) TO lt_component.
CALL FUNCTION 'CJBADI_MAINTAIN_LONGTEXT'
EXPORTING
it_component = lt_component.
ENDIF.

Accepted Solutions (0)

Answers (1)

Answers (1)

fabian_nelis
Explorer
0 Kudos

I'm trying to do this in INSERT_COMPONENT(SAPLCOMK)