Skip to Content
author's profile photo Former Member
Former Member

Capture data after 'call transaction using bdcdata'

Hallo,

I am working with an object Delegation to PDOTYPE_SH, and i have build the dialogue method ZCREATEDIALOGPP03, which call PP03 creates a new HR position. Some of the data (as you can see in my semplified method below) necessary to create the position are passed using the call transaction for PP03 using bdc.

At the end, I would like to get the new Position ID created, to use it and pass it on for further processing.

How can I capture that in my method?

Please have a look below at my code.

Regards,

Marco

-


BEGIN_METHOD ZCREATEDIALOGPP03 CHANGING CONTAINER.

DATA:

objtype type PPHDR-OTYPE,

BDCDATA LIKE BDCDATA OCCURS 0 WITH HEADER LINE.

  • prepare parameter ID

objtype = 'S'.

  • set paramater ID PP03

SET PARAMETER ID 'POT' FIELD objtype.

  • open bdc call

clear bdcdata.

refresh bdcdata.

  • bdc for Position Text

perform bdc_dynpro tables bdcdata using 'MP100000' '2000'.

perform bdc_field tables bdcdata using 'P1000-STEXT' PLSTX.

  • call transaction PP03

Call transaction 'PP03' using bdcdata.

end_method.

----


  • Start new screen *

----


FORM BDC_DYNPRO tables ibdcdata USING PROGRAM DYNPRO.

DATA: BDCDATA LIKE BDCDATA OCCURS 0 WITH HEADER LINE.

CLEAR BDCDATA.

BDCDATA-PROGRAM = PROGRAM.

BDCDATA-DYNPRO = DYNPRO.

BDCDATA-DYNBEGIN = 'X'.

APPEND BDCDATA to ibdcdata.

ENDFORM.

----


  • Insert field *

----


FORM BDC_FIELD tables ibdcdata USING FNAM FVAL.

DATA: BDCDATA LIKE BDCDATA OCCURS 0 WITH HEADER LINE.

  • DATA: NODATA_CHARACTER VALUE '/'.

  • IF fval <> NODATA_CHARACTER.

CLEAR BDCDATA.

BDCDATA-FNAM = FNAM.

BDCDATA-FVAL = FVAL.

APPEND BDCDATA to ibdcdata.

  • ENDIF.

ENDFORM.

----


Add comment
10|10000 characters needed characters exceeded

3 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Jul 31, 2006 at 11:26 PM

    Put this in your code :

    DATA: messtab LIKE bdcmsgcoll OCCURS 0 WITH HEADER LINE.

    DATA: opttable LIKE ctu_params.

    INITIALIZATION.

    opttable-dismode = 'N'.

    opttable-updmode = 'L'.

    opttable-racommit = 'X'.

    Change the call transaction statement as follow.

    Call transaction 'PP03' using bdcdata OPTIONS FROM opttable MESSAGES INTO messtab.

    Now loop on messtab and you will find the persons id in messtab-msgv1.

    Let me know if you have questions.

    Award points if usefull.

    Add comment
    10|10000 characters needed characters exceeded

  • Posted on Jul 31, 2006 at 11:23 PM

    maybe the new number is returned in a sap message try something like this:

    data t_messtab LIKE bdcmsgcoll OCCURS 0 WITH HEADER LINE.

    REFRESH t_messtab.

    CALL TRANSACTION tcode USING t_bdcdata

    MESSAGES INTO t_messtab.

    LOOP AT t_messtab.

    PERFORM expand_error_message USING t_messtab

    w_error_message.

    endloop.

    FORM expand_error_message USING f_raw_message STRUCTURE bdcmsgcoll

    f_editted_message.

    DATA v_work_text LIKE bdcmsgcoll-msgv1.

    DATA v_length TYPE i.

    FIELD-SYMBOLS <newtext>.

    SELECT SINGLE * FROM t100

    WHERE sprsl = sy-langu

    AND arbgb = f_raw_message-msgid

    AND msgnr = f_raw_message-msgnr.

    CLEAR f_editted_message.

    MOVE t100-text TO f_editted_message.

    DO 4 TIMES

    VARYING v_work_text FROM f_raw_message-msgv1

    NEXT f_raw_message-msgv2.

    v_length = STRLEN( v_work_text ).

    IF v_length = 0.

    ASSIGN ' ' TO <newtext>.

    ELSE.

    ASSIGN v_work_text(v_length) TO <newtext>.

    ENDIF.

    REPLACE '&' WITH <newtext> INTO f_editted_message.

    CONDENSE f_editted_message.

    ENDDO.

    ENDFORM. "EXPAND_ERROR_MESSAGE

    Add comment
    10|10000 characters needed characters exceeded

  • Posted on Aug 02, 2006 at 02:30 PM

    <b>data: it_mesg like bdcmsgcoll occurs 0 with header line.

    data: v_message(100).

    </b>

    clear bdcdata.

    refresh bdcdata.

    • bdc for Position Text

    perform bdc_dynpro tables bdcdata using 'MP100000' '2000'.

    perform bdc_field tables bdcdata using 'P1000-STEXT' PLSTX.

    • call transaction PP03

    <b>Call transaction 'PP03' using bdcdata update 'S'

    mode 'N

    messages into it_mesg.

    loop at it_mesg.

    call function 'FORMAT_MESSAGE'

    exporting

    id = it_mesg-msgid

    lang = sy-langu

    no = it_mesg-msgnr

    v1 = it_mesg-msgv1

    v2 = it_mesg-msgv2

    v3 = it_mesg-msgv3

    v4 = it_mesg-msgv4

    importing

    msg = v_message

    exceptions

    not_found = 1

    others = 2.

    write:/ v_message.

    endloop.</b>

    Add comment
    10|10000 characters needed characters exceeded