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

Barcode Saving in Invoice Posting

former_member209372
Participant
0 Likes
2,119

Hi,

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

4 REPLIES 4
Read only

Former Member
0 Likes
1,104

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

Read only

former_member209372
Participant
0 Likes
1,104

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

Read only

Former Member
0 Likes
1,104

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
  DATA:
    lv_botype LIKE obl_s_pbor-typeid VALUE 'BUS1001006', " e.g. 'BUS2012'
    lv_bo_id  LIKE obl_s_pbor-instid . " material number

* Object_b
  DATA:
    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
    lv_filenam(20).

       " 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.)
        CALL FUNCTION 'BINARY_RELATION_CREATE'
          EXPORTING
            obj_rolea    = lo_is_object_a
            obj_roleb    = lo_is_object_b
            relationtype = lv_reltyp
          EXCEPTIONS
            OTHERS       = 1.

        IF sy-subrc <> 0.
          " error handling
        ENDIF.
Read only

0 Likes
1,104

Well Mr. Oguz,

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