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: 

BDC report for ME38 to create scheduling lines with reference to Purchase requisition.

pritam_baboo
Participant
0 Kudos
1,054

Hi All,

We have created a BDC report to create scheduling lines with reference to PR and it is working fine. we upload Scheduling agreement , PO item, delivery date, PR and PR item from excel.

Now I am increasing the count in BDC to auto increase the bdc_cursor to pick one line item after the other as shown in below screenshot.

now if the excel file contains only 2 records how to pick the correct material with respect to PR item.

suppose we have only 2 records in excel as below.

and for the above scheduling agreement no we have 4 items with different material code. How to auto select the correct line items .

11 REPLIES 11

raymond_giuseppi
Active Contributor
968

Could you consider using a BAPI such as BAPI_SCHEDULE_MAINTAIN or BAPI_PO_CHANGE?

0 Kudos
968

Yes, sure. Can we use these BAPI to create scheduling line with respect to PR like we do in ME38. We just want to make PR mandatory while creating Scheduling lines.

0 Kudos
968

I checked this BAPI BAPI_SCHEDULE_MAINTAIN, we need to pass PO number which is mandatory, how can we do it with PR. Kindly sugest.

0 Kudos
968

Hi Raymond,

Did you find any solution how to pass PR to these bapi.

0 Kudos
968

Pass the same value that you passed in first dynpro of the batch-input recording (actually it's 'Purchasing document number of the scheduling agreement')

0 Kudos
968

No Sir, It is scheduling agreement number, also I tried to pass it but it is showing error " document not available'.

pritam_baboo
Participant
0 Kudos
968

Hi guys,

Did anyone implemented this scenario Kindly help

JackGraus
Active Contributor
968

Hello, to position the cursor on a specific line the line is first to be selected by populating the line item number in the field RM06E-EBELP (Field for Positioning Within Overview Screen). By doing so the cursor is positioned on the first line of the overview screen and you can select field by using index (1).

0 Kudos
968

Hi Graus,

Thanks for the info, but after passing my Internal table value to "RM06E-EBELP" field also it is not working. I am sharing my code, kindly suggest if any other changes I need to make.

 PERFORM bdc_dynpro      USING 'SAPMM06E' '0205'.
PERFORM bdc_field USING 'BDC_CURSOR'
'RM06E-EVRTN'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'RM06E-EVRTN'
"'5500002360'.
wa_data-evrtn.
PERFORM bdc_dynpro USING 'SAPMM06E' '0222'.


    CONCATENATE 'EKPO-EMATN(' lv_count ')' INTO lv_string.
PERFORM bdc_field USING 'BDC_CURSOR'
"'EKPO-EMATN(1)'.
lv_string.
PERFORM bdc_field USING 'BDC_OKCODE'
'=ET'.
PERFORM bdc_field USING 'RM06E-EBELP'
"'10'.
wa_data-ebelp.
PERFORM bdc_dynpro USING 'SAPMM06E' '1117'.
PERFORM bdc_field USING 'BDC_CURSOR'
'RM06E-LPEIN(01)'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=BS'.
PERFORM bdc_dynpro USING 'SAPMM06E' '0501'.
PERFORM bdc_field USING 'BDC_CURSOR'
'EKET-BNFPO'.
PERFORM bdc_field USING 'BDC_OKCODE'
'ENTE'.
PERFORM bdc_field USING 'EKET-BANFN'
"'11274756'.
wa_data-banfn.
PERFORM bdc_field USING 'EKET-BNFPO'
"'1330'.
wa_data-bnfpo.
PERFORM bdc_field USING 'EBAN-EKGRP'
"'121'.
wa_eban.
PERFORM bdc_dynpro USING 'SAPMM06E' '0125'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=REFH'.
PERFORM bdc_dynpro USING 'SAPMM06E' '0125'.
PERFORM bdc_field USING 'BDC_CURSOR'
'EBAN-BANFN(01)'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=REFH'.
PERFORM bdc_field USING 'RM06E-TCSELFLAG(01)'
'X'.
PERFORM bdc_dynpro USING 'SAPMM06E' '1117'.
PERFORM bdc_field USING 'BDC_CURSOR'
'EKET-SLFDT(01)'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'RM06E-ETNR1'
' 1'.
PERFORM bdc_field USING 'EKET-MENGE(01)'
"' 3'.
wa_data-qty.
PERFORM bdc_field USING 'EKET-SLFDT(01)'
"'30.05.2023'.
wa_data-date.
PERFORM bdc_dynpro USING 'SAPMM06E' '1117'.
PERFORM bdc_field USING 'BDC_CURSOR'
'EKET-SLFDT(01)'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=BU'.
PERFORM bdc_field USING 'RM06E-ETNR1'
' 1'.
PERFORM bdc_dynpro USING 'SAPLSPO1' '0300'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=YES'.

0 Kudos
968

In my above code I am incrementing the line index number 'EKPO-EMATN(1)' and it is also working fine as long as we maintain the data accordingly in the excel. But it is not selecting the line items according to po item(EBELP).

xiswanto
Active Participant
0 Kudos
968

pritam_baboo could you elaborate a bit regarding your issue? I can't understand the part of your statement below:
-> How to auto select the correct line items .

is your data in the excel starting from the 4th row failed to be inserted during BDC process?