Application Development 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: 

Dynamically call Tcode COR8 thru ABAP

DarcyMorse
Participant
0 Kudos
371

We would like to be able to call up COR8 based on a different selection screen allowing multiple Production Supervisors and Stock Planners. When we do this with a call transaction there is no way to default in the dates. When we use a Call Transaction with a background recording stopping at the ALV Grid Screen of COR8, it will only process 1 process order selected (even when multiple are selected to be converted).

We would like to avoid an implicit enhancement if possible. Any ideas?

1 ACCEPTED SOLUTION

raymond_giuseppi
Active Contributor
238

Could you try to perform some test with the 'OPTIONS FROM opt' option of 'CALL TRANSACTION' statement, using fields RACOMMIT, NOBINPT and/or OPT-NOBIEND of opt.

7 REPLIES 7

ArthurParisius
Contributor
0 Kudos
238

Without providing your code, we will not be able to give you any indication of what you might be doing wrong.

DarcyMorse
Participant
0 Kudos
238

First I am selecting valid entries from the PLAF table for the selection screen. I am then removing duplicates to get unique values to feed into COR8. This is the code within the loop:

clear it_bdcmsgcoll[].
clear it_bdcdata[].
PERFORM bdc_dynpro USING 'SAPLCOUP' '5100'.
PERFORM bdc_field USING 'CAUFVD-WERKS' fp_plwrk.
PERFORM bdc_field USING 'CAUFVD-SLDTV' g_date1.
PERFORM bdc_field USING 'CAUFVD-SLDTB' g_date2.
PERFORM bdc_field USING 'CAUFVD-DISPO' fp_dispo.
PERFORM bdc_field USING 'CAUFVD-FEVOR' fp_plgrp.
PERFORM bdc_field USING 'AUFPAR-PI_AUFART' p_aufart.
PERFORM bdc_field USING 'BDC_OKCODE' '=AUSF'.

CALL TRANSACTION 'COR8' without AUTHORITY-CHECK
USING it_bdcdata
MODE 'E' "'N' no show, e = error a = all
UPDATE 'S' " lc_update "'A'
MESSAGES INTO it_bdcmsgcoll.

-------------------------------------------------------------------

I had a break-point before and after, and it stops successfully at the Grid, so they can make quantity changes, and select the plans they want converted, but I think that it is coming across another screen, so the transaction is then kicking out. I know that if the Process order type isn't entered in COR8 that there is a popup.

DominikTylczyn
Active Contributor
238

Hello dmorse

As far as I've understood your requirement, you need to build a custom tool to convert planned order. If so, why don't you use BAPI_PRODORD_CREATE_FROM_PLORD function to convert them instead of calling COR8 in background? It's going to be much easier to implement and maintain. BDC are not best practice if there is a BAPI in place.

You might also consider using BAPI_PLANNEDORDER_GET_DET_LIST function to select planned orders.

Both functions are nicely documented.

Best regards

Dominik Tylczynski

raymond_giuseppi
Active Contributor
239

Could you try to perform some test with the 'OPTIONS FROM opt' option of 'CALL TRANSACTION' statement, using fields RACOMMIT, NOBINPT and/or OPT-NOBIEND of opt.

0 Kudos
238

The combination of racommit and nobiend seemed to do the trick. Thank you!

DarcyMorse
Participant
0 Kudos
238

They want to be able to change the quantities and dates of the planned order when converting. I'll review the BAPI's you suggested and what I can come up with.

0 Kudos
238

Please use the COMMENT button for comments, questions, adding details, replying to OP comment, etc., ANSWER is only to propose a solution, dixit SAP text at the right of the answer area.

If you want to target someone, if this person has posted an Answer, use the button COMMENT, if this person is the Original Poster of the question he/she will be automatically informed, otherwise copy/paste their hyperlinked name so that the person receives a warning (NB: @ doesn't work/but typing this character will suggest hyperlinked names).