10-29-2008 9:17 PM
Hi all.
I'm trying to create a Sales order document using BAPI_SALESORDER_CREATEFROMDAT2.
I am able to get credit-limit-exceeded message in the TX VA01, but when I call the BAPI it does not give any message for the credit limit in the BAPIRET2 table.
Regards
10-29-2008 9:24 PM
Are you getting any other message and if not, does the sales order get created ?
regards,
Advait
10-29-2008 9:28 PM
Hi Advait:
The BAPI is returning me all the messages except that one, the behaviour of the BAPI is exactly like the VA01, the sales document is created and then blocked.
10-29-2008 9:46 PM
I guess its not checking for the credit limit before creating the SO.
try using BAPI_CREDITCHECK before that.
10-29-2008 10:08 PM
Thanks for your answer Sunil:
I do debugging over the BAPI and the credit limit is already been checked, but only takes into account the dialog call. The code for the static check results is:
IF rc_check_a EQ con_rc_nok AND
sv_ukm_erp2005 IS INITIAL.
static check
IF t691f-strea CA con_warning AND us_warning_to_error EQ space
OR ( t691f-strea CA con_error AND us_error_to_warning EQ true )
OR ( rc_check NE con_rc_ok AND us_error_to_warning EQ true ).
warning static credit check
IF reaction_warning NE true.
reaction_warning = true.
IF us_no_warning NE true.
IF t691f-strea CA con_message_without.
IF da_no_dialog IS INITIAL OR
call_activity EQ gc_activity_lord.
MESSAGE i150 WITH space space credit_check
RAISING warning.
message_collect_lord.
ENDIF.
ELSE.
IF da_no_dialog IS INITIAL OR
call_activity EQ gc_activity_lord.
MESSAGE i150
WITH credit_limit_exceededc credit_limit_currency
credit_check
RAISING warning.
message_collect_lord.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
ELSEIF t691f-strea CA con_error AND us_error_to_warning EQ space
OR ( t691f-strea CA con_warning AND us_warning_to_error EQ true )
OR ( rc_check NE con_rc_ok AND us_warning_to_error EQ true ).
IF update EQ true OR da_no_dialog EQ 'X'.
error static credit check
IF t691f-strea CA con_message_without.
MESSAGE e150 WITH space space credit_check
RAISING error.
ELSE.
MESSAGE e150
WITH credit_limit_exceededc credit_limit_currency
credit_check
RAISING error.
ENDIF.
ELSE.
warning static credit check, but no update possible
IF reaction_error NE true.
reaction_error = true.
IF us_no_warning NE true.
IF t691f-strea CA con_message_without.
IF da_no_dialog IS INITIAL OR
call_activity EQ gc_activity_lord.
MESSAGE i151 WITH space space credit_check
RAISING warning.
message_collect_lord.
ENDIF.
ELSE.
IF da_no_dialog IS INITIAL OR
call_activity EQ gc_activity_lord.
MESSAGE i151
WITH credit_limit_exceededc credit_limit_currency
credit_check
RAISING warning.
message_collect_lord.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
10-30-2008 9:03 PM
Hi,
I dont have the system at the moment so I'm unable to see what the table t691f is used for. But it might me worth checking the t691f-strea field and what settings it has. Probably you need to do some config in the table t691f.
regards,
Advait
11-13-2008 12:52 AM
Check SAP Note 500585 - No credit warning message with order entry via BAPI. According to this note this is the system's standard behaviour (it doesn't clarify why, though).
I have this exact same requirement, and at the moment I'm trying to find out which of the BAPISDHDST structure fields (if any) indicates this condition, enabling me to generate a message on my own. If I'm not wrong it is STATDYNCLC but I have yet to check it, so if you confirm this please post back.
Hope this helps.
Regards