Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Need help with an SHDB BDC program

Hello ABAP Gurus,

I have created an SHDB Program to send Purchase order's via email from transaction M39F. I have added the purchase order number to the selection screen of the program but when trying execute the program it does not bring through the purchase order number to the selection screen of transaction code M39F when processing the session.

I am not an ABAP'er I have simply copied the logic from another program we have. Here is the source code, any tips on where I am going wrong will be much appreciated:

report Z_PO_EMAIL

no standard page heading line-size 255.

TABLES: EKKO. " Purchase Orders

SELECTION-SCREEN BEGIN OF BLOCK 1.

SELECT-OPTIONS: S_EBELN FOR EKKO-EBELN.

SELECTION-SCREEN END OF BLOCK 1.

include bdcrecx1.

**************************

*Global Data Declaration

**************************

TYPES: BEGIN OF ty_ebeln,

ebeln LIKE ekko-ebeln,

END OF ty_ebeln.

TYPES: typ_ebeln TYPE STANDARD TABLE OF ty_ebeln.

DATA: wa_ebeln TYPE ty_ebeln.

DATA: t_ebeln LIKE STANDARD TABLE OF wa_ebeln.

START-OF-SELECTION.

PERFORM select_po_number CHANGING t_ebeln.

END-OF-SELECTION.

PERFORM do_bdc_processing.

&----


*& Form select_po_number

&----


  • text

----


  • <--P_T_ABKRS text

----


FORM select_po_number CHANGING p_t_ebeln TYPE typ_ebeln.

CLEAR: p_t_ebeln.

FREE: p_t_ebeln.

SELECT ebeln

INTO TABLE p_t_ebeln

FROM EKKO

WHERE ebeln IN s_ebeln.

ENDFORM. " select_po_number

&----


*& Form do_bdc_processing

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM do_bdc_processing .

perform open_group.

perform bdc_dynpro using 'RM06ENDR_ALV' '1000'.

perform bdc_field using 'BDC_CURSOR'

'S_EBELN-LOW'.

perform bdc_field using 'BDC_OKCODE'

'=ONLI'.

perform bdc_field using 'S_EBELN-LOW'

wa_ebeln-ebeln.

perform bdc_field using 'S_EKORG-LOW'

'1000'.

perform bdc_field using 'P_KAPPL'

'EF'.

perform bdc_field using 'P_VSTAT'

'1'.

perform bdc_field using 'P_ERUHR'

'00:00:00'.

perform bdc_dynpro using 'SAPMSSY0' '0120'.

perform bdc_field using 'BDC_CURSOR'

'06/03'.

perform bdc_field using 'BDC_OKCODE'

'=&ALL'.

perform bdc_dynpro using 'SAPMSSY0' '0120'.

perform bdc_field using 'BDC_CURSOR'

'06/03'.

perform bdc_field using 'BDC_OKCODE'

'=9NDE'.

perform bdc_dynpro using 'SAPDV70A' '0100'.

perform bdc_field using 'BDC_CURSOR'

'DV70A-STATUSICON(01)'.

perform bdc_field using 'BDC_OKCODE'

'=V70R'.

perform bdc_field using 'DV70A-SELKZ(01)'

'X'.

perform bdc_dynpro using 'SAPDV70A' '0100'.

perform bdc_field using 'BDC_CURSOR'

'DV70A-STATUSICON(01)'.

perform bdc_field using 'BDC_OKCODE'

'=V70I'.

perform bdc_field using 'DV70A-SELKZ(01)'

'X'.

perform bdc_dynpro using 'SAPDV70A' '0102'.

perform bdc_field using 'BDC_CURSOR'

'NAST-VSZTP'.

perform bdc_field using 'BDC_OKCODE'

'=V70B'.

perform bdc_field using 'NAST-VSZTP'

'4'.

perform bdc_field using 'NAST-VSURA'

'00:00:00'.

perform bdc_field using 'NAST-VSURB'

'00:00:00'.

perform bdc_dynpro using 'SAPDV70A' '0100'.

perform bdc_field using 'BDC_CURSOR'

'DNAST-KSCHL(01)'.

perform bdc_field using 'BDC_OKCODE'

'=V70P'.

perform bdc_dynpro using 'SAPDV70A' '0101'.

perform bdc_field using 'BDC_CURSOR'

'NAST-LDEST'.

perform bdc_field using 'BDC_OKCODE'

'=V70B'.

perform bdc_field using 'NAST-LDEST'

'EXTM'.

perform bdc_field using 'NAST-ANZAL'

'1'.

perform bdc_field using 'NAST-DIMME'

'X'.

perform bdc_field using 'NAST-TDRECEIVER'

'AFLETCHER'.

perform bdc_dynpro using 'SAPDV70A' '0100'.

perform bdc_field using 'BDC_CURSOR'

'DNAST-KSCHL(01)'.

perform bdc_field using 'BDC_OKCODE'

'=V70S'.

perform bdc_transaction using 'ME9F'.

perform close_group.

ENDFORM. "do_bdc_processing

Tags:
replied

Use LOOP statement before perform open_group.

and ENDLOOP after perform Close_group.

FORM do_bdc_processing .

loop at t_ebeln into wa_ebeln.

perform open_group.

perform bdc_dynpro using 'RM06ENDR_ALV' '1000'.

perform bdc_field using 'BDC_CURSOR'

'S_EBELN-LOW'.

perform bdc_field using 'BDC_OKCODE'

'=ONLI'.

perform bdc_field using 'S_EBELN-LOW'

wa_ebeln-ebeln.

perform bdc_field using 'S_EKORG-LOW'

'1000'.

perform bdc_field using 'P_KAPPL'

'EF'.

perform bdc_field using 'P_VSTAT'

'1'.

perform bdc_field using 'P_ERUHR'

'00:00:00'.

perform bdc_dynpro using 'SAPMSSY0' '0120'.

perform bdc_field using 'BDC_CURSOR'

'06/03'.

perform bdc_field using 'BDC_OKCODE'

'=&ALL'.

perform bdc_dynpro using 'SAPMSSY0' '0120'.

perform bdc_field using 'BDC_CURSOR'

'06/03'.

perform bdc_field using 'BDC_OKCODE'

'=9NDE'.

perform bdc_dynpro using 'SAPDV70A' '0100'.

perform bdc_field using 'BDC_CURSOR'

'DV70A-STATUSICON(01)'.

perform bdc_field using 'BDC_OKCODE'

'=V70R'.

perform bdc_field using 'DV70A-SELKZ(01)'

'X'.

perform bdc_dynpro using 'SAPDV70A' '0100'.

perform bdc_field using 'BDC_CURSOR'

'DV70A-STATUSICON(01)'.

perform bdc_field using 'BDC_OKCODE'

'=V70I'.

perform bdc_field using 'DV70A-SELKZ(01)'

'X'.

perform bdc_dynpro using 'SAPDV70A' '0102'.

perform bdc_field using 'BDC_CURSOR'

'NAST-VSZTP'.

perform bdc_field using 'BDC_OKCODE'

'=V70B'.

perform bdc_field using 'NAST-VSZTP'

'4'.

perform bdc_field using 'NAST-VSURA'

'00:00:00'.

perform bdc_field using 'NAST-VSURB'

'00:00:00'.

perform bdc_dynpro using 'SAPDV70A' '0100'.

perform bdc_field using 'BDC_CURSOR'

'DNAST-KSCHL(01)'.

perform bdc_field using 'BDC_OKCODE'

'=V70P'.

perform bdc_dynpro using 'SAPDV70A' '0101'.

perform bdc_field using 'BDC_CURSOR'

'NAST-LDEST'.

perform bdc_field using 'BDC_OKCODE'

'=V70B'.

perform bdc_field using 'NAST-LDEST'

'EXTM'.

perform bdc_field using 'NAST-ANZAL'

'1'.

perform bdc_field using 'NAST-DIMME'

'X'.

perform bdc_field using 'NAST-TDRECEIVER'

'AFLETCHER'.

perform bdc_dynpro using 'SAPDV70A' '0100'.

perform bdc_field using 'BDC_CURSOR'

'DNAST-KSCHL(01)'.

perform bdc_field using 'BDC_OKCODE'

'=V70S'.

perform bdc_transaction using 'ME9F'.

perform close_group.

endloop.

0 View this answer in context

Helpful Answer

by
Not what you were looking for? View more on this topic or Ask a question