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: 

How to get a Document Number in a response from BAPI?

raj44
Participant
0 Kudos

Hi All,

We are calling BAPIs from MII, and we would like to know if there's a way of figuring out the document number returned from the BAPI. Do we have a unique identifier like a key, that we get back from the BAPI? If not, then how do we go about fetching the document number?

PS- I'm referring to BAPIs in general and not any specific BAPI.

Please advise or share any links/posts.

Thanks,

Rajeev

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi Rajeev

Most BAPI's will return the document number generated as a result of successful processing.

However depending on the BAPI being used the Document Number could be anywhere.

Usually in an Export Parameter, but also can be found in Tables.

Regards

Arden

15 REPLIES 15

Former Member
0 Kudos

Hi Rajeev

Most BAPI's will return the document number generated as a result of successful processing.

However depending on the BAPI being used the Document Number could be anywhere.

Usually in an Export Parameter, but also can be found in Tables.

Regards

Arden

0 Kudos

Thanks for your response Arden, so is the Document Number returned in the "RETURN" field that we get from the BAPI Response or in any of the MESSAGE_V1, MESSAGE_V2 etc?

Also, is there a way to check in ECC for a specific using se37 to get more idea about the document number field? I am fairly new to BAPIs, so I just want to know where we can get the Document Number that we can store in MII.

Regards,

Rajeev

0 Kudos

Hi Rajeev

Actually typically not in Return which is used for error messages.

Which BAPI are you referring to, I maybe able to shed some light on this if I know which one you're dealing with.

Regards

Arden

0 Kudos

Hi Arden,

I am using the following BAPIs-

BAPI_PROCORDCONF_CREATE_TT

ZBAPI_CO_XT_COMPONENT_CHANGE

BAPI_GOODSMVT_CREATE

BAPI_PRODCONF_CREATE_HDR

Regards,

Rajeev

0 Kudos

Hi Rajeev

I'm not an expert on these BAPI's.

Let start with BAPI_PROCORDCONF_CREATE_TT,

I believe the document number will be returned in table: TIMETICKETS

Regards

Arden

0 Kudos

Hi Arden,

Here's the XML returned from Time Tickets-

<TIMETICKETS>

            <item>

                <CONF_NO>0000000000</CONF_NO>

                <ORDERID>100000000000</ORDERID>

                <PHASE>0000</PHASE>

                <SEC_RESOURCE/>

                <FIN_CONF/>

                <CLEAR_RES/>

                <POSTG_DATE>2015-09-16</POSTG_DATE>

                <DEV_REASON/>

                <CONF_TEXT/>

                <PLANT>ABCD</PLANT>

                <RESOURCE>XYZ</RESOURCE>

                <RECORDTYPE/>

                <CONF_QUAN_UNIT/>

                <CONF_QUAN_UNIT_ISO/>

                <YIELD>0</YIELD>

                <SCRAP>0</SCRAP>

                <CONF_ACTI_UNIT1/>

                <CONF_ACTI_UNIT1_ISO/>

                <CONF_ACTIVITY1>0</CONF_ACTIVITY1>

                <NO_REMN_ACTI1/>

                <CONF_ACTI_UNIT2/>

                <CONF_ACTI_UNIT2_ISO/>

                <CONF_ACTIVITY2>0</CONF_ACTIVITY2>

                <NO_REMN_ACTI2/>

                <CONF_ACTI_UNIT3/>

                <CONF_ACTI_UNIT3_ISO/>

                <CONF_ACTIVITY3>0</CONF_ACTIVITY3>

                <NO_REMN_ACTI3/>

                <CONF_ACTI_UNIT4/>

                <CONF_ACTI_UNIT4_ISO/>

                <CONF_ACTIVITY4>0</CONF_ACTIVITY4>

                <NO_REMN_ACTI4/>

                <CONF_ACTI_UNIT5/>

                <CONF_ACTI_UNIT5_ISO/>

                <CONF_ACTIVITY5>0</CONF_ACTIVITY5>

                <NO_REMN_ACTI5/>

                <CONF_ACTI_UNIT6/>

                <CONF_ACTI_UNIT6_ISO/>

                <CONF_ACTIVITY6>0</CONF_ACTIVITY6>

                <NO_REMN_ACTI6/>

                <CONF_BUS_PROC_UNIT1/>

                <CONF_BUS_PROC_UNIT1_ISO/>

                <CONF_BUS_PROC1>0</CONF_BUS_PROC1>

                <NO_REMN_BUS_PROC1/>

                <EXEC_START_DATE>2015-09-04</EXEC_START_DATE>

                <EXEC_START_TIME>09:20:00</EXEC_START_TIME>

                <SETUP_FIN_DATE>0000-00-00</SETUP_FIN_DATE>

                <SETUP_FIN_TIME>00:00:00</SETUP_FIN_TIME>

                <PROC_START_DATE>0000-00-00</PROC_START_DATE>

                <PROC_START_TIME>00:00:00</PROC_START_TIME>

                <PROC_FIN_DATE>0000-00-00</PROC_FIN_DATE>

                <PROC_FIN_TIME>00:00:00</PROC_FIN_TIME>

                <TEARDOWN_START_DATE>0000-00-00</TEARDOWN_START_DATE>

                <TEARDOWN_START_TIME>00:00:00</TEARDOWN_START_TIME>

                <EXEC_FIN_DATE>2015-09-16</EXEC_FIN_DATE>

                <EXEC_FIN_TIME>08:30:25</EXEC_FIN_TIME>

                <FCST_FIN_DATE>0000-00-00</FCST_FIN_DATE>

                <FCST_FIN_TIME>00:00:00</FCST_FIN_TIME>

                <STD_UNIT1/>

                <STD_UNIT1_ISO/>

                <FORCAST_STD_VAL1>0</FORCAST_STD_VAL1>

                <STD_UNIT2/>

                <STD_UNIT2_ISO/>

                <FORCAST_STD_VAL2>0</FORCAST_STD_VAL2>

                <STD_UNIT3/>

                <STD_UNIT3_ISO/>

                <FORCAST_STD_VAL3>0</FORCAST_STD_VAL3>

                <STD_UNIT4/>

                <STD_UNIT4_ISO/>

                <FORCAST_STD_VAL4>0</FORCAST_STD_VAL4>

                <STD_UNIT5/>

                <STD_UNIT5_ISO/>

                <FORCAST_STD_VAL5>0</FORCAST_STD_VAL5>

                <STD_UNIT6/>

                <STD_UNIT6_ISO/>

                <FORCAST_STD_VAL6>0</FORCAST_STD_VAL6>

                <FORCAST_BUS_PROC_UNIT1/>

                <FORC_BUS_PROC_UNIT1_ISO/>

                <FORCAST_BUS_PROC_VAL1>0</FORCAST_BUS_PROC_VAL1>

                <PERS_NO>00000000</PERS_NO>

                <TIMEID_NO>00000000</TIMEID_NO>

                <WAGETYPE/>

                <SUITABILITY/>

                <NO_OF_EMPLOYEE>0</NO_OF_EMPLOYEE>

                <WAGEGROUP/>

                <BREAK_UNIT/>

                <BREAK_UNIT_ISO/>

                <BREAK_TIME>0</BREAK_TIME>

                <EX_CREATED_BY/>

                <EX_CREATED_DATE>0000-00-00</EX_CREATED_DATE>

                <EX_CREATED_TIME>00:00:00</EX_CREATED_TIME>

                <TARGET_ACTI1/>

                <TARGET_ACTI2/>

                <TARGET_ACTI3/>

                <TARGET_ACTI4/>

                <TARGET_ACTI5/>

                <TARGET_ACTI6/>

                <TARGET_BUS_PROC1/>

                <EX_IDENT/>

                <LOGDATE>0000-00-00</LOGDATE>

                <LOGTIME>00:00:00</LOGTIME>

                <WIP_BATCH/>

                <VENDRBATCH/>

            </item>

        </TIMETICKETS>

I don't see any DOC NUM field. Can you perhaps tell me the exact field name for Document Number so that I can manually check for each BAPIs?

Thanks for your assistance so far..

Regards,

Rajeev

0 Kudos

I think you want to be using ORDERID.

Second element in the structure

0 Kudos

Well Order ID is what we are passing from MII to ECC, executing that BAPI for that specific ORDERID.

Regards.

Rajeev

0 Kudos

I think the rest of the community may need to comment here. I really would have expected this ORDERID to be your DOCUMENT ID.

Regards

Arden

0 Kudos

You have to analyze returned parameters else analyze the 'S' returned message for a number, as it depends on each BAPI.

You could start with

  • MATERIALDOCUMENT and MATDOCUMENTYEAR for BAPI_GOODSMVT_CREATE
  • table GOODSMOVEMENTS for BAPI_PROCORDCONF_CREATE_TT

Regards,

Raymond

0 Kudos

Hi Raymond,

Thanks, for GOODSMVT we're looking at the Material Document. For Time Tickets, what do you mean when say "table GOODSMOVEMENTS for BAPI_PROCORDCONF_CREATE_TT"?

We're also checking for the return type, but for all bapis it doesn't give any unique identifier in NUMBER,or MESSAGE_V1, MESSAGE_V2 etc

Regards,

Rajeev

0 Kudos

Open one BAPI source, usually you should first find some MAP2I* FM (map external to internal format) followed by actual transaction, then either some message mapping to RETURN structure ( BALW_BAPIRETURN_GET* FM) and/or some MAP2E* FM (internal to external) to return information back to caller.

For BAPI_PROCORDCONF_CREATE_TT, a fast read of source seems to indicate that it updates data from table TIMETICKETS but don't return it in case of success (use of a TMP temporary table) and fill an internal table GOODSMOVEMENTS.

Note some BAPI may not return any number, so you may be required to use some BAPI_TRANSACTION_COMMIT with WAIT option followed by a BAPI GET/GET_DETAIL to read required information (with buffering problems...)

Regards,

Raymond

0 Kudos

Hi,

what kind of document number u mean?

From DMS or what?

Regards

Sebastian

0 Kudos

Hi Sebastian,

Basically I am looking for a unique key or an identifier what I believe is the Document Number returned by the BAPI for each execution.

Regards,

Rajeev

0 Kudos

Hi

     In BAPI_PROCORDCONF_CREATE_TT there is a DETAIL_RETURN field in tables in that you can find a filed named CONF_NO .

In general BAPI return data via export or return table.