‎2006 Jun 29 12:32 PM
I have got dump while executing BAPI
.
May be with the lv_ctrl_area.
How can i resolve the problem.
Is it because of wa_bapiret2 ?
Please help me out .
FORM get_profit_center .
DATA : lv_ctrl_area LIKE zgfld-lowval.
DATA : lv_progrp LIKE grpdynp-name_coall.
DATA : BEGIN OF gt_hier_nodes OCCURS 0.
INCLUDE STRUCTURE bapiset_hier.
DATA : END OF gt_hier_nodes.
DATA : BEGIN OF gt_hier_values OCCURS 0.
INCLUDE STRUCTURE bapi1116_values.
DATA : END OF gt_hier_values.
DATA : wa_bapiret2 TYPE bapiret2.
SELECT SINGLE lowval
FROM zgfld
INTO lv_ctrl_area
WHERE category = 'KOKRS'
AND fieldname = 'KOKRS'.
lv_progrp = p_progrp.
CALL FUNCTION 'BAPI_PROFITCENTERGRP_GETDETAIL'
EXPORTING
controllingarea = lv_ctrl_area
groupname = lv_progrp
IMPORTING
return = wa_bapiret2
TABLES
hierarchynodes = gt_hier_nodes
hierarchyvalues = gt_hier_values.
‎2006 Jun 29 12:38 PM
Refer the variables
DATA : lv_ctrl_area LIKE zgfld-lowval.
DATA : lv_progrp LIKE grpdynp-name_coall.
to the same data elements as what is being done in the BAPI Parameters. that should resolve the issue.
If it doesn't look at the reason in the dump and post the same here.
Regards,
Ravi
Note : Please mark the helpful answers and close the thread if the issue is resolved
‎2006 Jun 29 1:11 PM
Hi,
Declare Internal tables Like this.
DATA : lv_ctrl_area LIKE BAPICO_GROUP-CO_AREA. " or KOKRS
DATA : lv_progrp LIKE BAPICO_GROUP-GROUPNAME. " or BAPISET_GROUPNAME
DATA : gt_hier_nodes type table of bapiset_hier.
DATA : gt_hier_values type table of bapi1116_values.Hope it solves ur problem.
‎2006 Jun 29 1:43 PM
Hello,
I feel the Dump is due to the error in the internal table declaration. consider this code(Data Declaration Part).
REPORT test.
DATA : salesdocument TYPE bapivbeln-vbeln.
DATA : it_quotation_header_in TYPE bapisdhd1 OCCURS 0 WITH HEADER LINE.
DATA : it_quotation_header_inx TYPE bapisdhd1x OCCURS 0 WITH HEADER LINE.
DATA : reit_text1 TYPE bapiret2 OCCURS 0 WITH HEADER LINE.
DATA : reit_text2 TYPE bapiret2 OCCURS 0 WITH HEADER LINE.
DATA : it_quotation_items_in TYPE bapisditm OCCURS 0 WITH HEADER LINE.
DATA : it_quotation_items_inx TYPE bapisditmx OCCURS 0 WITH HEADER LINE.
DATA : it_quotation_partners TYPE bapiparnr OCCURS 0 WITH HEADER LINE.
DATA : it_quotation_schedules_in TYPE bapischdl OCCURS 0 WITH HEADER LINE.
DATA : it_quotation_schedules_inx TYPE bapischdlx OCCURS 0 WITH HEADER LINE.
CONSTANTS c_x(1) TYPE c VALUE 'X'.
*QUOTATION_HEADER_IN
it_quotation_header_in-doc_type = 'ZQT'.
it_quotation_header_in-sales_org = '1000'.
it_quotation_header_in-distr_chan = '01' .
it_quotation_header_in-division = '01'.
APPEND it_quotation_header_in.
*quotation_header_inx
it_quotation_header_inx-updateflag = c_x.
it_quotation_header_inx-doc_type = c_x.
it_quotation_header_inx-sales_org = c_x.
it_quotation_header_inx-distr_chan = c_x.
it_quotation_header_inx-division = c_x.
APPEND it_quotation_header_inx.
*quotation_items_in
it_quotation_items_in-itm_number = '000010'.
it_quotation_items_in-material = '50000555555162861'.
APPEND it_quotation_items_in.
*quotation_items_inx
it_quotation_items_inx-itm_number = '000000'.
it_quotation_items_inx-updateflag = c_x.
it_quotation_items_inx-material = c_x.
APPEND it_quotation_items_inx.
*quotation_partners
it_quotation_partners-partn_role = 'SP'.
it_quotation_partners-partn_numb = '005455599'.
it_quotation_partners-itm_number = '000000'.
APPEND it_quotation_partners.
CLEAR it_quotation_partners.
it_quotation_partners-partn_role = 'SH'.
it_quotation_partners-partn_numb = '000034548'.
it_quotation_partners-itm_number = '000000'.
APPEND it_quotation_partners.
*QUOTATION_SCHEDULES_IN
it_quotation_schedules_in-itm_number = '000010'.
it_quotation_schedules_in-req_qty = '10.000'.
APPEND it_quotation_schedules_in.
*QUOTATION_SCHEDULES_INX
it_quotation_schedules_inx-itm_number = '000010'.
it_quotation_schedules_inx-updateflag = c_x.
it_quotation_schedules_inx-req_qty = c_x.
APPEND it_quotation_schedules_inx.
CALL FUNCTION 'BAPI_QUOTATION_CREATEFROMDATA2'
EXPORTING
quotation_header_in = it_quotation_header_in
quotation_header_inx = it_quotation_header_inx
convert = c_x
IMPORTING
salesdocument = salesdocument
TABLES
return = reit_text1
quotation_items_in = it_quotation_items_in
quotation_items_inx = it_quotation_items_inx
quotation_partners = it_quotation_partners
quotation_schedules_in = it_quotation_schedules_in
quotation_schedules_inx = it_quotation_schedules_inx.
IF sy-subrc = 0 AND NOT salesdocument IS INITIAL.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = 'X'
IMPORTING
return = reit_text2.
ENDIF.
LOOP AT reit_text1.
WRITE : / reit_text1-type,
reit_text1-id,
reit_text1-number,
reit_text1-message.
ENDLOOP.
Regards,
Arun Sambargi.
‎2006 Jun 29 1:44 PM
Hai Sam Kumar
Go through the following Code
TYPE-POOLS: gsetc.
CONSTANTS: g_class TYPE setclass VALUE gsetc_profitcenter_setclass.
PARAMETERS: p_group TYPE pcgrp MEMORY ID pcg OBLIGATORY,
p_kokrs TYPE kokrs NO-DISPLAY,
receiver LIKE tbdlst-logsys NO-DISPLAY.
Include for Selection screen events
INCLUDE gs_dxtest_include.
Main program
START-OF-SELECTION.
PERFORM main USING p_group p_kokrs receiver.
----
FORM main
----
Create an IDOC from a cost center group
----
--> P_SETID
--> P_RECEIVER
----
FORM main USING p_group TYPE ksgru
p_kokrs TYPE kokrs
p_receiver TYPE logsys.
DATA: lt_hier TYPE STANDARD TABLE OF bapiset_hier,
lt_values TYPE STANDARD TABLE OF bapi1116_values,
lt_receivers TYPE STANDARD TABLE OF bdi_logsys.
CALL FUNCTION 'BAPI_PROFITCENTERGRP_GETDETAIL'
EXPORTING
controllingarea = p_kokrs
groupname = p_group
TABLES
hierarchynodes = lt_hier
hierarchyvalues = lt_values.
APPEND p_receiver TO lt_receivers.
CALL FUNCTION 'ALE_PROFITCENTERGRP_CREATE'
EXPORTING
controllingareaimp = p_kokrs
TABLES
hierarchynodes = lt_hier
hierarchyvalues = lt_values
receivers = lt_receivers.
MESSAGE s840(gs) WITH p_group.
ENDFORM. "main
Thanks & regards
Sreenivasulu P