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

processing dependent transactions in BDC

Former Member
0 Likes
795

Hai friends!

how to process dependent transactions in BDC such as creating a delivery document & based on the delivery document processing PGI in another...

plz send me some idea & same code..

thanks

6 REPLIES 6
Read only

Former Member
0 Likes
740

You just simply do CALL TRANSACTIONs one after the other, you will get the created document number the message table, use this to run the subsequent transactoin. Also ensure that you chose UPDATE 'S' and do you do a COMMIT WORK AND WAIT, so that you can expect that the first transaction commits before you start the subsequent.

Read only

0 Likes
740

Hai vishnu!

thanks 4 quick reply... if you don't mind plz send me the sample code 4 doing this

thanks

Read only

0 Likes
740

hai !

i tried with your idea of using call transaction 2 times but it is not working properly...

Read only

Former Member
0 Likes
740

Hi,

Check witch transacion want to be update first take that record and next transacion also take record and write code accordingly.

Regards

Md.MahaboobKhan

Read only

Former Member
0 Likes
740

while processing the one transaction with CALL TRANSACTION and the time when that is being done after that call the other transaction in it when looping in the messages and run that transaction accordingly on what message it must run.

This way the other transaction which is dependent on the other can be run after the other.

example:

LOOP AT t_header_data INTO fs_header_data.

PERFORM populate_screen_data USING 'SAPMM06B' '0100'.

PERFORM populate_field_data USING 'EBAN-BSART' 'NB'.

PERFORM populate_field_data USING 'EBAN-KNTTP' 'X'.

PERFORM populate_field_data USING 'RM06B-EEIND' fs_header_data-date.

PERFORM populate_field_data USING 'RM06B-LPEIN' 'T'.

PERFORM populate_field_data USING 'EBAN-WERKS' '1000'.

PERFORM populate_field_data USING 'BDC_OKCODE' '=AB'.

LOOP AT t_item_data

INTO fs_item_data

WHERE com = fs_header_data-com.

PERFORM fill_items_data.

ADD 1 TO w_inc.

ENDLOOP. " LOOP AT T_ITEM_DATA.....

PERFORM populate_screen_data USING 'SAPMM06B' '0106'.

PERFORM populate_field_data USING 'BDC_OKCODE' '=BU'.

CALL TRANSACTION 'ME51' USING t_steps MODE 'N' MESSAGES INTO t_messages.

LOOP AT t_messages INTO fs_messages.

CALL FUNCTION 'FORMAT_MESSAGE'

EXPORTING

id = fs_messages-msgid

lang = sy-langu

no = fs_messages-msgnr

v1 = fs_messages-msgv1

v2 = fs_messages-msgv2

v3 = fs_messages-msgv3

v4 = fs_messages-msgv4

IMPORTING

msg = msg

EXCEPTIONS

not_found = 1

OTHERS = 2.

IF sy-subrc EQ 0.

WRITE : / msg.

IF msg CS 'Purchase Requisition'.

WRITE : fs_messages-msgv1.

ENDIF. " IF msg CS....

ENDIF. " IF SY-SUBRC = 0

ENDLOOP. " LOOP AT T_MESSAGES

CLEAR t_steps.

PERFORM me21_data.(me21 transaction is processed after me51 which is dependent on me51)

ENDLOOP. " LOOP AT T_HEADER_DATA INTO....

ENDFORM. " steps_to_fill_data

&----


*& Form populate_screen_data

&----


  • Populating the Screen Data In the BDC internal Table

----


  • There are no interface parameters to be passed to this subroutine. *

----


FORM populate_screen_data USING value(p_program_name) TYPE any

value(p_screen_number) TYPE any.

CLEAR fs_bdcdata.

fs_bdcdata-program = p_program_name.

fs_bdcdata-dynpro = p_screen_number.

fs_bdcdata-dynbegin = 'X'.

APPEND fs_bdcdata TO t_steps.

ENDFORM. " populate_screen_data

&----


*& Form populate_field_data

&----


  • This Subroutine Populates the Field Data In the BDC internal Table

----


  • There are no interface parameters to be passed to this subroutine. *

----


FORM populate_field_data USING value(p_fieldname) TYPE any

value(p_value) TYPE any.

CLEAR fs_bdcdata.

fs_bdcdata-fnam = p_fieldname.

fs_bdcdata-fval = p_value.

APPEND fs_bdcdata TO t_steps.

ENDFORM. " populate_field_data

&----


*& Form ME21_DATA

&----


  • This Subroutine Fills the Data In ME21 Screens With Bdcdata

----


  • There are no interface parameters to be passed to this subroutine. *

----


FORM me21_data .

  • fs_messages-msgv1 = sy-msgv1.

PERFORM populate_screen_data USING 'SAPMM06E' '0100'.

PERFORM populate_field_data USING 'EKKO-LIFNR' '1000'.

PERFORM populate_field_data USING 'EKKO-EKORG' '1000'.

PERFORM populate_field_data USING 'EKKO-EKGRP' '001'.

PERFORM populate_field_data USING 'BDC_OKCODE' '=BS'.

PERFORM populate_screen_data USING 'SAPMM06E' '0501'.

PERFORM populate_field_data USING 'EKET-BANFN' fs_messages-msgv1.

PERFORM populate_field_data USING 'BDC_OKCODE' '=ENTE'.

PERFORM populate_screen_data USING 'SAPMM06E' '0125'.

PERFORM populate_field_data USING 'BDC_OKCODE' '=MALL'.

PERFORM populate_screen_data USING 'SAPMM06E' '0125'.

PERFORM populate_field_data USING 'BDC_OKCODE' '=REFH'.

DO w_inc TIMES.

PERFORM populate_screen_data USING 'SAPMM06E' '0504'.

PERFORM populate_field_data USING 'BDC_OKCODE' '=ENTE'.

IF sy-index EQ 1.

PERFORM populate_screen_data USING 'SAPMM06E' '0111'.

PERFORM populate_field_data USING 'EKPO-KNTTP' 'X'.

PERFORM populate_field_data USING 'BDC_OKCODE' 'BU'.

PERFORM populate_screen_data USING 'SAPLSPO1' '0300'.

PERFORM populate_field_data USING 'BDC_OKCODE' 'YES'.

ENDIF.

ENDDO. " DO w_inc TIMES.

PERFORM populate_screen_data USING 'SAPMM06E' '0120'.

PERFORM populate_field_data USING 'BDC_OKCODE' '=BU'.

CLEAR t_messages[].

CALL TRANSACTION 'ME21' USING t_steps MODE 'A' MESSAGES INTO t_messages.

LOOP AT t_messages INTO fs_messages.

ADD 1 TO w_inc.

CALL FUNCTION 'FORMAT_MESSAGE'

EXPORTING

id = fs_messages-msgid

lang = sy-langu

no = fs_messages-msgnr

v1 = fs_messages-msgv1

v2 = fs_messages-msgv2

v3 = fs_messages-msgv3

v4 = fs_messages-msgv4

IMPORTING

msg = msg

EXCEPTIONS

not_found = 1

OTHERS = 2.

IF sy-subrc EQ 0.

WRITE : / msg.

ENDIF. " IF SY-SUBRC = 0

ENDLOOP. " LOOP AT T_MESSAGES....

CLEAR t_steps[].

PERFORM me22_data.(here other transaction me22 is run which is dependent on me21)

ENDFORM. " ME21_DATA

Read only

Former Member
0 Likes
740

Hi,

write t_steps screen navigations of one transaction code.

call transaction 'TCODE' using t_steps mode 'A' messages into t_messages..

take the number required of TCODE through sy-msgv1 or sy-msgv2....

refresh t_steps.

write t_steps screen navigations of another transaction code.

call transaction 'TCODE1' using t_steps mode 'A' messages into t_messages..

This works.