1 1 1 1 1 Rating 0% (0 Votes)
Attachments:
Access this URL (http://abapblog.com/files/nugg/ZAB_MASS_REPLACE.nugg)ZAB_MASS_REPLACE.nugg
If you imported NUGG file from previous article you could be surprised that there is one additional FM available called Z_AB_POPUP_GRID_MULTI_SEL. This FM can be used to call a popup with ALV grid which allows multiple row selects. 
1) In order to prepare such popup you'll need to firstly define some global variables in FG which you can find bellow:

constantsc_ccname_grid_popup type scrfname value 'CC_GRID_POPUP'.
datago_popup_custom_cont      type ref to cl_gui_custom_container.
datago_popup_grid             type ref to cl_gui_alv_grid.
datags_popup_layout           type lvc_s_layo.
datags_popup_variant          type disvariant.
datagt_popup_fcat             type lvc_t_fcat.
datag_popup_question          type char70.
field-symbols<gt_popup_outtab> type standard table.

2) Then you need to create GUI status with Cancel and Enter Buttons
Read more ...

5 1 1 1 1 1 Rating 100% (4 Votes)
This topic was raised many times, I always found it's not possible to (or at least to hard to try) to update components allocation for routing operations. Fortunately I had to do it somehow and I manage to do it in two ways : 
1) with BDC (yeah I know, creepy but possible)
2) using EWB FM's basing on the SAP note 488765 - "Do it yourself EWB programming".
Today I will present program which is using EWB, in future I will post an example of doing this by BDC.
 
 
This program reads data from Excel file with proper structure (you can find Excel template in attachment). After reading data it collects all routings which needs to be updated to be sure that each routing is updated only once. Then the most important part is done in following way:
1) We need to load each routing and connected BOM to memory with CP_CC_S_LOAD_COMPLEX_BY_TSK and CP_CC_S_LOAD_COMPLEX_BY_BOM,
2) Next step is to get the BOM into internal table using CP_CC_S_PROVIDE_ITM_BY_AS_PATH.  BOM table contains also a explosion of sub-assemblies which are not phantoms which at the beginning seem to be useless, but after a while you'll notice that we need all levels of multilevel BOM in order to calculate Path (PLMZ-KANTE) and order level (PLMZ-STLST).  If you have to do components allocation for single level BOM then reworking the table is not needed, but in my example I did it as I needed to allocate components from multi-level BOM. You'll find here a form ITEM_CHECK which do the manipulation of the table. 
3) After it's done we need load operation data (CP_CC_S_PROVIDE_COM_BY_OPR) and current allocation of components (CP_CL_P_OPR_ALLOCATION_PROVIDE). We need to do it in order to delete current allocation.
4) Deletion is done with CM_CL_P_COM_DELETE and saved with CP_CC_S_SAVE. Deletion is committed as in other case there is no possibility to create new allocation.
5) Allocation is deleted, so we can now recreate it with new values. Firstly we need to reload again operation data to memory with CP_CC_S_OPR_PROVIDE_BY_MTK and then create allocation with  CP_CC_S_CREATE_COM. Again we need to save allocation with CP_CC_S_SAVE.
 
Bellow you'll find the code of the program. You can download also NUGG file for it!.
 
Program works in two steps, firstly it displays reading log, if it is ok you have to press first button on the toolbar  to create allocation.
Read more ...

5 1 1 1 1 1 Rating 100% (1 Vote)
As promised today I'll put code for a method to reset the rejection of the Purchase requisition. Most of the code is the same like in the check method, in fact even the code is repeated again so you can use this one without checking if reset of rejection can be done or not.
 
Importing:

I_BANFN TYPE EBAN-BANFN -> Purchase Requistion number

Changing:

C_FACTORY TYPE REF TO IF_PURCHASE_REQ_FACTORY -> Purchase requisition factory

Exporting:

E_RESET TYPE FLAG -> Reset was successful

Exceptions:

HEADER_COULDNT_BE_CREATED
ERROR_DURING_RESET
CANNOT_RESET

Read more ...

1 1 1 1 1 Rating 0% (0 Votes)
In the previous article I've shown how to check if we can reset the rejection of the purchase requisition. In the same way you can check if rejection is allowed or if release is allowed or if reset of release is allowed. To do that you'll have to replace  following piece of code from previous example fo_releasable->is_reset_rej_allowed( )
 with one of the following:
  • fo_releasable->is_rejection_allowed( ) 
  • fo_releasable->is_release_allowed( )
  • fo_releasable->is_reset_rel_allowed( ) 
 
In next article I will show you how to reset the rejection of PR .

1 1 1 1 1 Rating 0% (0 Votes)
Working with Purchase Requisitions in ABAP is quite pleasant job, but sometimes it's not so easy like with other documents types. You cannot easily say if Requisition is rejected and can be reset by checking EBAN table. You have to use OO PR objects to be able to do so. Bellow you can find a method how to check if you can reset the rejection of the requisition done in the WF. 
 
Importing:

I_BANFN TYPE EBAN-BANFN ->Purchase Requisition Number

Exporting:

E_RESETABLE TYPE FLAG -> If rejection can be reset this parameter will be set to 'X'

Changing:

CO_FACTORY TYPE REF TO IF_PURCHASE_REQ_FACTORY -> Purchase requisition factory

Exception:

HEADER_COULDNT_BE_CREATED

Read more ...

1 1 1 1 1 Rating 0% (0 Votes)
We got all needed functions, so I'll give you an example how to call the methods correctly to get characteristics update window like this:
 
Program bellow is reading firstly the info about stored values in given characteristic and then throws an update screen. After exiting from the screen it's saving data to database.
Read more ...

1 1 1 1 1 Rating 0% (0 Votes)
Now it's time to save the values entered into database. I will use here previously created method to move data from reference structure to BAPI tables, then I will read values from database to see if something has changed with BAPI_OBJCL_GETDETAIL, then save the values with BAPI_OBJCL_CHANGE. Just one remark, you have to pass all values always to that FM!
 
Importing:

I_DATA TYPE DATA OPTIONAL
value( I_CHANGE_NUMBER ) TYPE BAPI1003_KEY-CHANGENUMBER OPTIONAL -> Change Number 

Exception:

NO_DATA  

Read more ...

1 1 1 1 1 Rating 0% (0 Votes)
Our characteristics update screen was displayed, data was changes so we need to read the reference data and put the values into BAPI structures in order to be able to save the values to database.
I will use here BAPI_CLASS_READ to read all possible characteristics and COC1_FEATURE_CHECK to get characteristic details.
 
Importing:

I_DATA TYPE REF TO DATA

Changing:

CT_OBJVALUESNUM TYPE TT_BAPI1003_ALLOC_VALUES_NUM
CT_OBJVALUESCHAR TYPE TT_BAPI1003_ALLOC_VALUES_CHAR
CT_OBJVALUESCURR TYPE TT_BAPI1003_ALLOC_VALUES_CURR

Exceptions:

NO_DATA_TO_PASS 

Read more ...
Page 2 of 5