cancel
Showing results for 
Search instead for 
Did you mean: 

BADI Implementation for Forecast Consumption

Former Member
0 Kudos

We are trying to implement a new consumption mode to consume the forecast within the current month. Does anybody now if there is any BADI we could use to implement this change in the standard behavior?.

Thanks in advance.

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

One last comment.

We had also to implement the badi /SAPAPO/SDP_RELDATA, to delete existing forecast previous to the release.

Best Regards,

Susana

Former Member
0 Kudos

-

Former Member
0 Kudos

Hello Susana,

If you maintain the settings in the product master the consumption will happen automatically. Go to the demand tab , set the value of proposed strategy (20) , backward and forward consumption. After fixing the setting delete the existing forecast and create the new 1 to see the difference. You can view the consumption calculation in the product view under the forecast tab.

Please let me if i'm wrong.

Thanks,

Siva.

Former Member
0 Kudos

Hi Siva,

This is the standard behaviour. But you can only select fixed periods for backward and forward consumption. We want to do a monthly consumption. So SO only consume forecast of the month that is placed. We are working with daily and monthly planning books.

Thanks,

Former Member
0 Kudos

Set consumption mode to none. This will consume forecast from the same period

Use a monthly planning AREA in DP to release forecast. This will normally transfer the forecast date as middle of the month or so. If you dont have a Monthly planning area (the storage bucket should be months ONLY) create one and use it as an interim PA for copy of data (you can automate the complete copy and release process)

Make sure the sales forecast also is transferred with the same date on it (you can use an user exit on the CIF to ensure all SO in the month has its date changed to the middle of the month)

Former Member
0 Kudos

Dear All,

What we have finally implement is the following:

We have change the period consumption for each forecast order, by using a user exit that is available in the release from DP to SNP:

Enhacement: APODM017

Exit : EXIT_/SAPAPO/SAPLAPO_EXIT_001

For each order that appear in table SCHEDULE_LINE_TAB, we change:

- SCHEDULE_LINE_TAB-line_bucket_start = "Beginning of the month"

- SCHEDULE_LINE_TAB-line_bucket_end = "End of the month"

In this way, any SO with date within this period will consume the forecast.

I hope this helps to anybody that s¡could face the same issue in the future.

Best Regards,

Susana

Former Member
0 Kudos

Thanks Naveen for your quick answer.

The problem is that I don't know the exactly point in which forecast is consume in APO, and therefore which in transaction or program look for the BADI.

I have check the BADI's, and none of them seems to fit the requirement, so I was wondering if somebody has ever done something similar.

Thanks lot,

Susana

Former Member
0 Kudos

Hi Susana

The forecast is genarrly consumed when DP is released to SNP, there is a user-exit in enhancement APODM017 with function module 'EXIT_/SAPAPO/SAPLAPO_EXIT_001' available there.

Regards

Ian

P.S. I'll get the obvious joke out of the way, I take it you don't sing "Marlene on the Wall" 🐵

Former Member
0 Kudos

Hi Ian,

I have been checking the enhancement you mentioned and It could be a point where to do some kind of consumption.

But there is also consumption anytime that a SO is coming via CIF, and forecast is withdraw at the GI moment. Therefore I was looking for the exactly moment where the consumption is done... but I think it is called dinamically somehow...

If anybody else have some king of idea about the topic...I would really appreciate it.

Thanks a lot,

Susana

Former Member
0 Kudos

Hi,

You can check this on your own.

Please check this sample program from other thread to find BADI and enhancement for a given transaction code. You just need to create a custom program in your system by cut and paste below codes.

REPORT ZTEST.

TABLES: TSTC,

TADIR,

MODSAPT,

MODACT,

TRDIR,

TFDIR,

ENLFDIR,

SXS_ATTRT ,

TSTCT.

DATA: JTAB LIKE TADIR OCCURS 0 WITH HEADER LINE.

DATA: FIELD1(30).

DATA: V_DEVCLASS LIKE TADIR-DEVCLASS.

PARAMETERS: P_TCODE LIKE TSTC-TCODE,

P_PGMNA LIKE TSTC-PGMNA .

DATA: WA_TADIR TYPE TADIR.

START-OF-SELECTION.

IF NOT P_TCODE IS INITIAL.

SELECT SINGLE * FROM TSTC WHERE TCODE EQ P_TCODE.

ELSEIF NOT P_PGMNA IS INITIAL.

TSTC-PGMNA = P_PGMNA.

ENDIF.

IF SY-SUBRC EQ 0.

SELECT SINGLE * FROM TADIR

WHERE PGMID = 'R3TR'

AND OBJECT = 'PROG'

AND OBJ_NAME = TSTC-PGMNA.

MOVE : TADIR-DEVCLASS TO V_DEVCLASS.

IF SY-SUBRC NE 0.

SELECT SINGLE * FROM TRDIR

WHERE NAME = TSTC-PGMNA.

IF TRDIR-SUBC EQ 'F'.

SELECT SINGLE * FROM TFDIR

WHERE PNAME = TSTC-PGMNA.

SELECT SINGLE * FROM ENLFDIR

WHERE FUNCNAME = TFDIR-FUNCNAME.

SELECT SINGLE * FROM TADIR

WHERE PGMID = 'R3TR'

AND OBJECT = 'FUGR'

AND OBJ_NAME EQ ENLFDIR-AREA.

MOVE : TADIR-DEVCLASS TO V_DEVCLASS.

ENDIF.

ENDIF.

SELECT * FROM TADIR INTO TABLE JTAB

WHERE PGMID = 'R3TR'

AND OBJECT in ('SMOD', 'SXSD')

AND DEVCLASS = V_DEVCLASS.

SELECT SINGLE * FROM TSTCT

WHERE SPRSL EQ SY-LANGU

AND TCODE EQ P_TCODE.

FORMAT COLOR COL_POSITIVE INTENSIFIED OFF.

WRITE:/(19) 'Transaction Code - ',

20(20) P_TCODE,

45(50) TSTCT-TTEXT.

SKIP.

IF NOT JTAB[] IS INITIAL.

WRITE:/(105) SY-ULINE.

FORMAT COLOR COL_HEADING INTENSIFIED ON.

  • Sorting the internal Table

sort jtab by OBJECT.

data : wf_txt(60) type c,

wf_smod type i ,

wf_badi type i ,

wf_object2(30) type C.

clear : wf_smod, wf_badi , wf_object2.

  • Get the total SMOD.

LOOP AT JTAB into wa_tadir.

at first.

FORMAT COLOR COL_HEADING INTENSIFIED ON.

WRITE:/1 SY-VLINE,

2 'Enhancement/ Business Add-in',

41 SY-VLINE ,

42 'Description',

105 SY-VLINE.

WRITE:/(105) SY-ULINE.

endat.

clear wf_txt.

at new object.

if wa_tadir-object = 'SMOD'.

wf_object2 = 'Enhancement' .

elseif wa_tadir-object = 'SXSD'.

wf_object2 = ' Business Add-in'.

endif.

FORMAT COLOR COL_GROUP INTENSIFIED ON.

WRITE:/1 SY-VLINE,

2 wf_object2,

105 SY-VLINE.

endat.

case wa_tadir-object.

when 'SMOD'.

wf_smod = wf_smod + 1.

SELECT SINGLE MODTEXT into wf_txt

FROM MODSAPT

WHERE SPRSL = SY-LANGU

AND NAME = wa_tadir-OBJ_NAME.

FORMAT COLOR COL_NORMAL INTENSIFIED OFF.

when 'SXSD'.

  • For BADis

wf_badi = wf_badi + 1 .

select single TEXT into wf_txt

from SXS_ATTRT

where sprsl = sy-langu

and EXIT_NAME = wa_tadir-OBJ_NAME.

FORMAT COLOR COL_NORMAL INTENSIFIED ON.

endcase.

WRITE:/1 SY-VLINE,

2 wa_tadir-OBJ_NAME hotspot on,

41 SY-VLINE ,

42 wf_txt,

105 SY-VLINE.

AT END OF object.

write : /(105) sy-ULINE.

ENDAT.

ENDLOOP.

WRITE:/(105) SY-ULINE.

SKIP.

FORMAT COLOR COL_TOTAL INTENSIFIED ON.

WRITE:/ 'No.of Exits:' , wf_smod.

WRITE:/ 'No.of BADis:' , wf_badi.

ELSE.

FORMAT COLOR COL_NEGATIVE INTENSIFIED ON.

WRITE:/(105) 'No userexits or BADis exist'.

ENDIF.

ELSE.

FORMAT COLOR COL_NEGATIVE INTENSIFIED ON.

WRITE:/(105) 'Transaction does not exist'.

ENDIF.

AT LINE-SELECTION.

data : wf_object type tadir-object.

clear wf_object.

GET CURSOR FIELD FIELD1.

CHECK FIELD1(8) EQ 'WA_TADIR'.

read table jtab with key obj_name = sy-lisel+1(20).

move jtab-object to wf_object.

case wf_object.

when 'SMOD'.

SET PARAMETER ID 'MON' FIELD SY-LISEL+1(10).

CALL TRANSACTION 'SMOD' AND SKIP FIRST SCREEN.

when 'SXSD'.

SET PARAMETER ID 'EXN' FIELD SY-LISEL+1(20).

CALL TRANSACTION 'SE18' AND SKIP FIRST SCREEN.

ENDCASE.

Alternatively, you can do the following:

1. For what ever transaction u want the enhancement .. just check for the System-->status (menu) and find out the PROGRAM name....

2. Double click on to the program name and go inside the program (Abap editor)

3. Search for "Call Customer-function " ... and u'll get some search results .. If u get results then u have enhancement in that tcode .....

4. Then it actually calls a Function module .... copy the Function module name .... go to SE80 (object navigator) click on "Repository Information system" then Customer Enhancements .... Give the Function module name in the "Components" field and click Execute ....

ull get a list of Enhancements related to that Componene....

5. Choose which ever enhancement will suit ur business need ..

6. Go to CMOD... create a project .... assign ur enhancement ... and then code ur logic.... activate ur enhancement in CMOD ....... Ur Buisness need will be solved...

For a user exit......

Finding whether there is any User Exit or not for tcode VA42

1. For what ever transaction u want the user exit .. just check for the System-->status (menu) and find out the PROGRAM name.... ( The program name would be for our scenario "SAPMV45A" )

2. Double click on to the program name and go inside the program (Abap editor)

3. Search for the word "USEREXIT" .... u ll find all the user exits in the search result .. and find ur's then ...

Hope this will help.

Regards,

Naveen.