Application Development and Automation 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: 
Read only

create TOs in background

Former Member
0 Likes
1,903

Hi

I am using l_to_create_single in a program which is run in background mode. I am using this FM in a loop to create TO's. But if at all, any line of the loop has a problem creating a TO, then I am unable to go to the next line in the loop. The function module returns an error in itself, i.e., if there is any error with the material or bin, then it fails inside the function module itself. Does any one have any idea to override this.

Thanks

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,846

hi,

may be you can do some check before calling the FM to avoid it.

is the fm throwing an error message then probably u can chage the type of error message or supress it, i'll can let u know how to do it, once i'll reach my sap system tommorow

14 REPLIES 14
Read only

Former Member
0 Likes
1,847

hi,

may be you can do some check before calling the FM to avoid it.

Read only

0 Likes
1,846

Any one had the similar requirement/situation. any ideas.

Read only

0 Likes
1,846

is the fm throwing an error message then probably u can chage the type of error message or supress it, i'll can let u know how to do it, once i'll reach my sap system tommorow

Read only

0 Likes
1,846

thanks -can wait till tomorrow.

Read only

0 Likes
1,846

If you check the code inside the fm


  if i_kompl = con_x and i_anfme > ltap-vsola.
    message e332 raising no_to_created.
  endif.

I think this will be caused by data . (strange!!!! error message inside fm)

Read only

0 Likes
1,846

(strange!!!! error message inside fm)

Not really - the raising just sets the return code and if the calling program checks for the exception, I don't think the error is produced.

Rob

Read only

0 Likes
1,846

Rob,

I was wrong. sorry about this.

This is documentaiton

If the MESSAGE-statement is processed with the addition RAISING during processing of a method or a function module whose caller assigns a return value to the exception exception with the addition EXCEPTIONS of the statement CALL, it has the same effect as the statement RAISE. If no return value is assigned to the exception exception, then the addition RAISING is ignored and the message is processed according to its message type

Read only

0 Likes
1,846

I've been tripped up on that myself a number of times. But if you put a break-point at the keyword 'message' and then run a standard SAP transaction, you might be surprised to see how often this is done.

Rob

Read only

0 Likes
1,846

Rob,

So is it that I am looking it wrong or is there any work around for my above requirement.

thanks.

Read only

0 Likes
1,846

Hard to say - you haven't given enough information for a good response. You haven't said which FM you are using.

Bear in mind that using unreleased, undocumented FMs can lead to problems. I'd look for a BAPI or failing that use BDC.

Or take the first suggestion and capture the error before calling the FM.

Sorry - I just saw that you did mention the FM, so if you catch the exception, it should work.

Rob

Edited by: Rob Burbank on Mar 23, 2009 5:09 PM

Read only

0 Likes
1,846

ROB/ ARS,

Please see,

There are numerous error messages in this FM,

This is really strange to have error messages directly in the function module,

does any one have any idea how to over come these..

PERFORM RUECKPLATZ_SPERREN USING RETURNCODE.
  IF RETURNCODE = R_PLATZ_GESPERRT.
    PERFORM PROT_MESSAGE USING '145' LTAP-RLPLA BL BL BL.
    MESSAGE E145 WITH LTAP-RLPLA.
  ENDIF.

*........Rückquant prüfen...............................................

  PERFORM RUECKQUANT_PRUEFEN USING RETURNCODE.
  CASE RETURNCODE.
    WHEN R_OK.
    WHEN R_QUANT_NICHT_ANGEG.
    WHEN R_QUANT_NICHT_VORHA.
    WHEN R_SPERRE_EINLAG.
         PERFORM PROT_MESSAGE USING '014' BL BL BL BL.
         MESSAGE E014.
    WHEN R_ZULAG_VERBOTEN.
         PERFORM PROT_MESSAGE USING '035' LTAP-MATNR LTAP-RLTYP BL BL.
         MESSAGE E035 WITH LTAP-MATNR LTAP-RLTYP.
    WHEN R_MISCH_VERBOTEN.
         PERFORM PROT_MESSAGE USING '036' LTAP-RLTYP BL BL BL.
         MESSAGE E036 WITH LTAP-RLTYP.
  ENDCASE.

Read only

0 Likes
1,846

Hello experts,

sorry if i am pushing this again. I am still having this issue, can anyone suggest something here.

Read only

former_member376453
Contributor
0 Likes
1,846

Hi - if you think that this is not coming from FM, then you can try to uncomment the exception after calling the FM, and try to handle the error accordingly, if you get any sy-subrc other than 0, then probably u can give an "continue" to go to next line of loop.

Kuntal

Read only

Former Member
0 Likes
1,846

check this FM CM_F_MESSAGE

it has BADI buiaddin_contr_msg->modify_controllable_message

Use this to change the standard message

кu03B1ятu03B9к