Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

BAPI_SALESORDER_CREATEFROMDAT2 Credit limit check

Former Member
0 Kudos

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

6 REPLIES 6

Former Member
0 Kudos

Are you getting any other message and if not, does the sales order get created ?

regards,

Advait

0 Kudos

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.

0 Kudos

I guess its not checking for the credit limit before creating the SO.

try using BAPI_CREDITCHECK before that.

0 Kudos

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.

0 Kudos

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

alejandro_bindi
Active Contributor
0 Kudos

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