09-16-2008 3:03 PM
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
09-16-2008 3:51 PM
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.
09-16-2008 3:14 PM
First of all, I think you mean transaction ME9F, not M39F.
Try changing the selection screen:
SELECTION-SCREEN BEGIN OF BLOCK 1.
SELECT-OPTIONS: s_ebeln FOR ekko-ebeln MEMORY ID bes.
SELECTION-SCREEN END OF BLOCK 1.
Rob
09-16-2008 3:22 PM
Hi Rob,
Yes sorry I meant ME9F.
Tried your fix, it didn't work : - (
Any other ideas?
Thanks,
Alec
09-16-2008 3:39 PM
Batch input does not work well with report programs. You want to be able to select a number of POs and then pass it to the report. You could do this with SUBMIT, but then you wouldn't be able to do the other batch input stuff you are trying to do.
Rob
09-16-2008 3:43 PM
One PO at a time would be fine, we don't really raise that many and it's only for internal use.
Can you help any further?
09-16-2008 3:56 PM
Your problem is that you have not moved the purchase order number to wa_ebeln-ebeln.
Rob
09-16-2008 3:51 PM
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.
09-16-2008 4:03 PM
thanks very much, that solved my problem. i have awarded your points
Alec