Skip to Content

Barcode Saving in Invoice Posting

Jul 11, 2017 at 05:33 AM


avatar image
Former Member


During MIRO posting i can able to see barcode pop up enabling, but when i tried to post invoice by using BAPI_INCOMINGINVOICE_CREATE, how i can achieve the barcode posting into SAP.? Is any FM or BAPI is available.?

Thank You

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

3 Answers

avatar image
Former Member Jul 13, 2017 at 08:18 AM

You can use GOS and attach the barcode into sales document. This typeid(BUS1001006) is for material object, you should find sales document id.

** Object_a
    lv_botype LIKE obl_s_pbor-typeid VALUE 'BUS1001006', " e.g. 'BUS2012'
    lv_bo_id  LIKE obl_s_pbor-instid . " material number

* Object_b
    lv_docty       TYPE borident-objtype VALUE 'MESSAGE', "'BILDIRIM',
    lv_reltyp      TYPE breltyp-reltype VALUE 'ATTA',
    lv_filetyp     TYPE sofm-doctp VALUE 'PNG', " EXT " doc extention

       " Create an initial instance of BO 'MESSAGE' - to call the
       " instance-independent method 'Create'. 

        swc_create_object lo_message 'MESSAGE' ls_message_key.

        " define container to pass the parameter values to the method call in next step.
        swc_container lt_message_container.

        " Populate container with parameters for method
        swc_set_element lt_message_container 'DOCUMENTTITLE' lv_filenam. 
        swc_set_element lt_message_container 'DOCUMENTLANGU' 'T'.
        swc_set_element lt_message_container 'NO_DIALOG' 'X'.
        swc_set_element lt_message_container 'DOCUMENTNAME' lv_docty.
        swc_set_element lt_message_container 'DOCUMENTTYPE' lv_filetyp.
        swc_set_element lt_message_container 'FILEEXTENSION' 'DOC'.
        " file in binary form
        swc_set_table   lt_message_container 'DocumentContent' lt_binary.
        swc_set_element lt_message_container 'DOCUMENTSIZE' lv_doc_size.
        swc_refresh_object lo_message.
        swc_call_method lo_message 'CREATE' lt_message_container.

        " Refresh to get the reference of create 'MESSAGE' object for attachment
        " swc_refresh_object lo_message.
        " Get Key of new object
        swc_get_object_key lo_message ls_message_key.

        " fol 42 no 101
        " Now we have attachment as a business object instance. We can now
        " attach it to our main business object instance.
        " Create main BO object_a

        lv_bo_id = ls_matnr.

        DATA: lo_is_object_a TYPE borident.

        lo_is_object_a-objkey = lv_bo_id.
        lo_is_object_a-objtype = lv_botype.

        " Create attachment BO object_b
        DATA: lo_is_object_b TYPE borident.
        lo_is_object_b-objkey = ls_message_key.
        lo_is_object_b-objtype = lv_docty.
        " create link between file and object(sales document in your case.)
            obj_rolea    = lo_is_object_a
            obj_roleb    = lo_is_object_b
            relationtype = lv_reltyp
            OTHERS       = 1.

        IF sy-subrc <> 0.
          " error handling
Show 1 Share
10 |10000 characters needed characters left characters exceeded
Former Member

Well Mr. Oguz,

Thanks for your explanation via code, i will try to do the same on will get back you. Cheerz :)

Richard Harper Jul 13, 2017 at 06:57 AM

I don't follow your question. A Bar code is just a font. It's the data behind the bar code you require.

10 |10000 characters needed characters left characters exceeded
avatar image
Former Member Jul 13, 2017 at 07:27 AM

Hi Richard,

Yes, but it related with Attachment for invoice posting, the attachment where saved into some other software i.e. IXOS software, i have found the RFC for above issue.

We can use ARCHIV_BARCODE_ASSIGN wile posting through BAPI.

Thank You

10 |10000 characters needed characters left characters exceeded