I am having problem to insert value to the customize product settype by using report.
The system will auto generate a Package which follow the naming of the settype, YSER_INST_CODE. There are some function modules which also auto generated by system, such as ZOM_YSER_INST_CODE_MAINT_UPD etc.
The purpose of the report is to insert or update the settype value for existing product.
Before start to code the report, I try to get how the standard flow work. I put all the break-point in function modules of Package YSER_INST_CODE, and then go to transaction code commpr01 to manually insert the value of YSER_INST_CODE and save the product.
When change mode, insert the value and then enter, the function modules will be called follow by sequence as below:
when save the product, the function modules are called follow by sequence as below:
So in my report, I do the same thing, I put this flow into my report. Below is the flow of report:-
1. Pass in product id to FM CRM_MAT_GETDETAIL_MAIN to get existing product details such as product guid.
2. follow the standard flow, call FM ZOM_YSER_INST_CODE_MAINT_UPD -> ZOM_YSER_INST_CODE_CHECK -> ZOM_YSER_INST_CODE_MAINT_RD -> ZOM_YSER_INST_CODE_MAINT_UPD -> ZOM_YSER_INST_CODE_CHECK -> ZOM_YSER_INST_CODE_SAVE_LOCL -> ZOM_YSER_INST_CODE_SAVE -> ZOM_YSER_INST_CODE_SAVE_DB
3. Finally, call FM ZOM_YSER_INST_CODE_FREE to free the buffer.
From testing result in commpr01, the report manages to change the value of settype in product master, but the report is not able to insert the value of settype in product master. I need the report works for first time insert value of settype too.
Insert value first time add value to settype.
Change value settype has existing value, change the existing value to another value.
I compare the report of values of input/output parameters for those FM ZOM_* between the report and standard (manually insert the value), it seem like those pass in parameters of FMs are filled same like standard, and I get the output parameters of FMs as like standard too.
I also did the comparison between Insert and Change by manually maintain the settype in commpr01 and check the result of calling those FMs ZOM_*.
The different are:
1. FM ZOM_YSER_INST_CODE_MAINT_RD return set_maintain structure. one of the field of set maintain structure, histex. histex is blank for Insert, whereas histex is X for update.
2. FM ZOM_YSER_INST_CODE_SAVE_DB
- if insert, use it_set_insert as input parameter for ZOM_YSER_INST_CODE_SAVE_DB
- If Change, use it_set_update and it_seth_insert as input parameter for ZOM_YSER_INST_CODE_SAVE_DB.
In my report, I also cater for these different too. I have no idea why my report is not able to do first time insert value. Can anyone give me guide on this?