Here is a little sample code, I hope it help you to understand the solution.
DYNPRO 0100:
PROCESS BEFORE OUTPUT.
MODULE STATUS_0100.
PROCESS AFTER INPUT.
MODULE USER_COMMAND_0100.
PBO INCLUDE:
MODULE status_0200 OUTPUT.
"If no barcode is filled set the cursor to that field.
IF I_BARCODE IS INITIAL.
SET CURSOR FIELD 'I_BARCODE'. "BARCODE would be the input of the barcode.
ENDIF.
ENDMODULE. " STATUS_0200 OUTPUT
PAI INCLUDE:
MODULE USER_COMMAND_0100 INPUT.
IF I_BARCODE IS NOT INITIAL.
"Here write your logic to complete the other fields.
ENDIF.
ENDMODULE. " USER_COMMAND_0100
Regards